Changeset a838ee3


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

Location:
remit/finance_core
Files:
2 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)
  • remit/finance_core/views.py

    rd1692e8 ra838ee3  
    9595        raise Http404("Unknown compute_method selected")
    9696    table = build_table(line_items, primary_field, secondary_field, primary_axis, secondary_axis, )
     97    finance_core.reporting.append_totals(table)
     98    primary_labels.append("Total")
     99    secondary_labels.append("Total")
    97100
    98101    debug = True
Note: See TracChangeset for help on using the changeset viewer.