Ignore:
Timestamp:
19 Oct 2022, 21:23:06 (2 years ago)
Author:
Henrik Bettermann
Message:

Show all sf payments. Start with entry session.

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

    r17033 r17137  
    261261    grok.template('paymentsmanagepage')
    262262
    263     @property
    264     def manage_payments_allowed(self):
    265         return checkPermission('waeup.manageStudent', self.context)
    266 
    267     @property
    268     def schoolfee_payments_made(self):
     263    def _schoolfee_payments_made(self):
    269264        cs = self.context.student.current_session
    270265        SF_PAYMENTS = ('schoolfee', 'schoolfee40', 'secondinstal', 'clearance')
    271         if cs > self.context.student.entry_session:
    272             sf_paid = {cs-1: 0.0, cs: 0.0, cs+1: 0.0}
    273             sessions = (cs-1, cs, cs+1)
    274         else:
    275             sf_paid = {cs: 0.0, cs+1: 0.0}
    276             sessions = (cs, cs+1)
     266        sf_paid = dict()
     267        session = self.context.student.entry_session
     268        while session < cs + 2:
     269            sf_paid[session] = 0.0
     270            session += 1
     271        sessions = sf_paid.keys()
    277272        try:
    278273            certificate = self.context.student['studycourse'].certificate
     
    298293               ticket.p_category == 'brought_fwd':
    299294                  brought_fwd += ticket.amount_auth
    300         return sf_paid, total_sf, brought_fwd
     295        return sorted(sf_paid.items(), key=lambda value: value[0]), total_sf, brought_fwd
     296
     297    def update(self):
     298        super(CustomPaymentsManageFormPage, self).update()
     299        self.sfp_made = self._schoolfee_payments_made()
     300        return
     301
     302    @property
     303    def manage_payments_allowed(self):
     304        return checkPermission('waeup.manageStudent', self.context)
    301305
    302306class StudentGetMatricNumberPage(UtilityView, grok.View):
  • main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/browser_templates/paymentsmanagepage.pt

    r16748 r17137  
    4545  <br /><br />
    4646  <p>
    47   <strong>Balance Brought Forward:</strong> <span tal:content ="python: view.schoolfee_payments_made[2]">BROUGHTFORWARD</span>
     47  <strong>Balance Brought Forward:</strong> <span tal:content ="python: view.sfp_made[2]">BROUGHTFORWARD</span>
    4848  </p>
    4949  <br />
     
    5858    </thead>
    5959    <tbody>
    60       <tr tal:repeat="sfpm python: view.schoolfee_payments_made[0].items()">
     60      <tr tal:repeat="sfpm python: view.sfp_made[0]">
    6161        <td tal:content ="python: '%s/%s' %(sfpm[0],sfpm[0]+1)">SESSION</td>
    62         <td tal:content ="python: view.schoolfee_payments_made[1]">TOTAL</td>
     62        <td tal:content ="python: view.sfp_made[1]">TOTAL</td>
    6363        <td tal:content ="python: sfpm[1]">AMOUNT</td>
    64         <td tal:content ="python: view.schoolfee_payments_made[1]+view.schoolfee_payments_made[2]-sfpm[1]">DUE</td>
     64        <td tal:content ="python: view.sfp_made[1]+view.sfp_made[2]-sfpm[1]">DUE</td>
    6565       
    6666      </tr>
Note: See TracChangeset for help on using the changeset viewer.