- Timestamp:
- 17 Aug 2023, 07:43:50 (17 months ago)
- 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
r17137 r17546 265 265 SF_PAYMENTS = ('schoolfee', 'schoolfee40', 'secondinstal', 'clearance') 266 266 sf_paid = dict() 267 session = self.context.student.entry_session268 while session < cs + 2:269 sf_paid[session] = 0.0270 session += 1271 sessions = sf_paid.keys()272 267 try: 273 268 certificate = self.context.student['studycourse'].certificate 274 269 except (AttributeError, TypeError): 275 return sf_paid, 0, 0 276 total_sf = 0.0 277 if self.context.student in (ADMITTED, CLEARANCE, REQUESTED, CLEARED): 278 sf = getattr(certificate, 'school_fee_1', 0.0) 279 else: 280 sf = getattr(certificate, 'school_fee_2', 0.0) 281 if sf is not None: 282 total_sf = sf 270 return sf_paid, 0 271 session = self.context.student.entry_session 272 # Initiliaze sf_paid dict with items 273 # session: [school fee in session,, amount paid in session, amount due] 274 sf_paid[session] = [getattr(certificate, 'school_fee_1', 0.0), 0.0, 0.0] 275 while session < cs + 1: 276 session += 1 277 sf_paid[session]= [getattr(certificate, 'school_fee_2', 0.0), 0.0, 0.0] 278 sessions = sf_paid.keys() 283 279 brought_fwd = 0.0 280 # Collect all payments made or brought forward 284 281 for ticket in self.context.values(): 285 282 amt = ticket.net_amt … … 289 286 ticket.p_state == 'paid' and \ 290 287 ticket.p_session in sessions: 291 sf_paid[ticket.p_session] += amt288 sf_paid[ticket.p_session][1] += amt 292 289 if ticket.p_state != 'paid' and\ 293 290 ticket.p_category == 'brought_fwd': 294 291 brought_fwd += ticket.amount_auth 295 return sorted(sf_paid.items(), key=lambda value: value[0]), total_sf, brought_fwd 292 # Calculate due, first entry session 293 entry_session = sessions[0] 294 # amount due in session = brought forward from previous sessions + school fee in session - amount paid in session 295 sf_paid[entry_session][2] = brought_fwd + sf_paid[entry_session][0] - sf_paid[entry_session][1] 296 for session in sessions[1:]: 297 # amount due in session = brought forward from previous session + school fee in session - amount paid in session 298 sf_paid[session][2] = sf_paid[session-1][2] + sf_paid[session][0] - sf_paid[session][1] 299 return sorted(sf_paid.items(), key=lambda value: value[0]), brought_fwd 296 300 297 301 def update(self): -
main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/browser_templates/paymentsmanagepage.pt
r17483 r17546 44 44 </div> 45 45 <br /><br /> 46 <p tal:condition="python: False">47 <strong>Balance Brought Forward:</strong> <span tal:content ="python: view.sfp_made[ 2]">BROUGHTFORWARD</span>46 <p tal:condition="python: True"> 47 <strong>Balance Brought Forward:</strong> <span tal:content ="python: view.sfp_made[1]">BROUGHTFORWARD</span> 48 48 </p> 49 49 <br /> 50 <table class="table" style="width: 50%;" tal:condition="python: False">50 <table class="table" style="width: 50%;" tal:condition="python: True"> 51 51 <thead> 52 52 <tr> 53 53 <th i18n:translate="">Session</th> 54 54 <th i18n:translate="">School Fees</th> 55 <th i18n:translate=""> SumPaid</th>55 <th i18n:translate="">Amount Paid</th> 56 56 <th i18n:translate="">Amount Due</th> 57 57 </tr> … … 60 60 <tr tal:repeat="sfpm python: view.sfp_made[0]"> 61 61 <td tal:content ="python: '%s/%s' %(sfpm[0],sfpm[0]+1)">SESSION</td> 62 <td tal:content ="python: view.sfp_made[1]">TOTAL</td> 63 <td tal:content ="python: sfpm[1]">AMOUNT</td> 64 <td tal:content ="python: view.sfp_made[1]+view.sfp_made[2]-sfpm[1]">DUE</td> 65 62 <td tal:content ="python: sfpm[1][0]">FEE</td> 63 <td tal:content ="python: sfpm[1][1]">AMOUNT PAID</td> 64 <td tal:content ="python: sfpm[1][2]">TOTAL AMOUNT DUE</td> 66 65 </tr> 67 66 </tbody>
Note: See TracChangeset for help on using the changeset viewer.