Ignore:
Timestamp:
Mar 27, 2010, 10:54:50 PM (15 years ago)
Author:
Alex Dehnert <adehnert@…>
Branches:
master, client
Children:
1c178d5
Parents:
d1692e8
git-author:
Alex Dehnert <adehnert@…> (03/27/10 22:54:50)
git-committer:
Alex Dehnert <adehnert@…> (03/27/10 22:54:50)
Message:

Add row and column totals

File:
1 edited

Legend:

Unmodified
Added
Removed
  • remit/finance_core/reporting.py

    rd1692e8 ra838ee3  
    106106}
    107107
     108def append_totals(table):
     109    # Row totals
     110    for row in table:
     111        row.append(sum(row))
     112    # Column totals
     113    if len(table) > 0:
     114        totalrow = [None]*len(table[0])
     115        for col in xrange(len(table[0])):
     116            totalrow[col] = sum([row[col] for row in table])
     117        table.append(totalrow)
Note: See TracChangeset for help on using the changeset viewer.