Ignore:
Timestamp:
2 Nov 2020, 18:08:34 (4 years ago)
Author:
Henrik Bettermann
Message:

Add page with current session payments.

Location:
main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/browser.py

    r16292 r16296  
    174174                )
    175175
     176    @property
     177    def tabletitle(self):
     178        portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
     179        tabletitle = []
     180        tabletitle.append(translate(_('_PB_Successful Current Session Payments'), 'waeup.kofa',
     181            target_language=portal_language))
     182        return tabletitle
     183
    176184    def render(self):
    177185        studentview = StudentBasePDFFormPage(self.context.student,
    178186            self.request, self.omit_fields)
    179187        students_utils = getUtility(IStudentsUtils)
     188
     189        portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
     190        P_ID = translate(_('Payment Id'), 'waeup.kofa', target_language=portal_language)
     191        #CD = translate(_('Creation Date'), 'waeup.kofa', target_language=portal_language)
     192        PD = translate(_('Payment Date'), 'waeup.kofa', target_language=portal_language)
     193        CAT = translate(_('Payment Category'), 'waeup.kofa', target_language=portal_language)
     194        ITEM = translate(_('Payment Item'), 'waeup.kofa', target_language=portal_language)
     195        AMT = translate(_('Amount (Naira)'), 'waeup.kofa', target_language=portal_language)
     196        SSS = translate(_('Payment Session'), 'waeup.kofa', target_language=portal_language)
     197        tabledata = []
     198        tableheader = []
     199        tabledata.append(sorted(
     200            [value for value in self.context['payments'].values()
     201             if value.p_state in ('paid', 'waived', 'scholarship')
     202             and value.p_session >= value.student.current_session],
     203             key=lambda value: value.p_session))
     204        tableheader.append([(P_ID,'p_id', 4.2),
     205                         #(CD,'creation_date', 3),
     206                         (PD,'formatted_p_date', 3),
     207                         (CAT,'category', 3),
     208                         (ITEM, 'p_item', 3),
     209                         (AMT, 'amount_auth', 2),
     210                         (SSS, 'p_session', 2),
     211                         ])
    180212
    181213        #watermark_path = os.path.join(
     
    192224            omit_fields=self.omit_fields,
    193225            signatures=self._signatures(),
     226
     227            tableheader=tableheader,
     228            tabledata=tabledata,
     229
    194230            pagebreak=True,
    195231        #    mergefiles=mergefiles,
  • main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/tests/test_browser.py

    r16292 r16296  
    1919import shutil
    2020import tempfile
     21from time import time
     22from datetime import datetime, timedelta
    2123from StringIO import StringIO
    2224from hurry.workflow.interfaces import IWorkflowState, IWorkflowInfo
     
    151153
    152154    def test_student_personal_slip(self):
     155        payment1 = createObject(u'waeup.StudentOnlinePayment')
     156        timestamp = ("%d" % int(time()*10000))[1:]
     157        payment1.p_id = "LSCNEW-2-4153206270" # the longest possible p_id
     158        payment1.p_category = 'schoolfee'
     159        payment1.p_item = u'My School Fee'
     160        payment1.p_session = 2015
     161        payment1.p_level = 100
     162        payment1.p_current = True
     163        payment1.amount_auth = 23456.9
     164        payment1.approve()
     165        payment2 = createObject(u'waeup.StudentOnlinePayment')
     166        timestamp = ("%d" % int(time()*10000))[1:]
     167        payment2.p_id = "p%s" % timestamp
     168        payment2.p_category = 'clearance'
     169        payment2.p_item = u'My Clearance Fee'
     170        payment2.p_session = 2015
     171        payment2.p_level = 100
     172        payment2.p_current = True
     173        payment2.amount_auth = 5678.6
     174        payment2.approve()
     175        self.student['payments'][payment1.p_id] = payment1
     176        self.student['payments'][payment2.p_id] = payment2
    153177        IWorkflowState(self.student).setState('school fee paid')
    154178        self.browser.open(self.login_path)
Note: See TracChangeset for help on using the changeset viewer.