- Timestamp:
- 17 Aug 2023, 07:43:50 (13 months ago)
- File:
-
- 1 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):
Note: See TracChangeset for help on using the changeset viewer.