Ignore:
Timestamp:
6 Feb 2015, 18:47:37 (10 years ago)
Author:
Henrik Bettermann
Message:

Configure reportable payment categories in KofaUtils?.

Format amount string, use thousands separator.

Location:
main/waeup.kofa/trunk/src/waeup/kofa
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/reports/student_payment_statistics.py

    r12563 r12564  
    5454    """
    5555    site = grok.getSite()
    56     payment_cats = ('clearance', 'gown', 'hostel_maintenance', 'schoolfee')
    57     payment_cats = payment_cats + ('Total',)
     56    payment_cats_dict = getUtility(IKofaUtils).REPORTABLE_PAYMENT_CATEGORIES
     57    payment_cats = tuple(sorted(payment_cats_dict.keys())) + ('Total',)
    5858    if breakdown == 'faccode':
    5959        codes = tuple(sorted([x for x in site['faculties'].keys()],
     
    108108
    109109    # Build table header
    110     utils = getUtility(IKofaUtils)
    111 
    112 
    113110    table_header = ['' for x in xrange(len(payment_cats))]
    114111    for cat in payment_cats:
    115         cat_title = utils.PAYMENT_CATEGORIES.get(cat, cat)
     112        cat_title = payment_cats_dict.get(cat, cat)
    116113        table_header[payment_cats.index(cat)] = cat_title
    117114
    118     # Convert float into int
    119     table = [[int(col) for col in row] for row in table]
    120115    # Turn lists into tuples
    121116    table = tuple([tuple(row) for row in table])
     
    148143        i = 0
    149144        while i < len(data[idx]):
    150             row.append("%s (%s)" % (data[idx][i+1], data[idx][i]))
     145            row.append("%s (%s)" % ("{:,}".format(data[idx][i+1]), data[idx][i]))
    151146            i += 2
    152147        row = [row_name] + row
     
    160155    ('FONT', (0,-1), (-1,-1), 'Helvetica-Bold', 8),
    161156    ('FONT', (-1,0), (-1,-1), 'Helvetica-Bold', 8),
    162     ('ALIGN', (1,1), (-1,-1), 'RIGHT'),
     157    ('ALIGN', (0,0), (-1,-1), 'RIGHT'),
    163158    ('INNERGRID', (0,0), (-1,-1), 0.25, colors.black),
    164159    ('LINEBELOW', (0,-1), (-1,-1), 0.25, colors.black),
  • main/waeup.kofa/trunk/src/waeup/kofa/students/reports/tests/test_student_payment_statistics.py

    r12563 r12564  
    3737              'Hostel Maintenance Fee', 'School Fee',
    3838              'Total'],
    39               ((0, 0, 0, 0, 0, 0, 1, 5, 1, 5),
    40               (0, 0, 0, 0, 0, 0, 1, 5, 1, 5)))
     39              ((0, 0, 0, 0, 0, 0, 1, 12345.678, 1, 12345.678),
     40              (0, 0, 0, 0, 0, 0, 1, 12345.678, 1, 12345.678)))
    4141            )
    4242        self.assertEqual(
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_catalog.py

    r12562 r12564  
    9090        payment.p_session = 2010
    9191        payment.p_category = 'schoolfee'
    92         payment.amount_auth = 5.678
     92        payment.amount_auth = 12345.678
    9393        payment.p_state = 'paid'
    9494        self.student['payments'][payment.p_id] = payment
  • main/waeup.kofa/trunk/src/waeup/kofa/utils/utils.py

    r11969 r12564  
    181181    PREVIOUS_PAYMENT_CATEGORIES = deepcopy(SELECTABLE_PAYMENT_CATEGORIES)
    182182
     183    REPORTABLE_PAYMENT_CATEGORIES = {
     184        'schoolfee': 'School Fee',
     185        'clearance': 'Acceptance Fee',
     186        'hostel_maintenance': 'Hostel Maintenance Fee',
     187        'gown': 'Gown Hire Fee',
     188        }
     189
    183190    BALANCE_PAYMENT_CATEGORIES = {
    184191        'schoolfee': 'School Fee',
Note: See TracChangeset for help on using the changeset viewer.