Changeset 7151 for main/waeup.custom/trunk/src/waeup/custom
- Timestamp:
- 20 Nov 2011, 07:46:49 (13 years ago)
- Location:
- main/waeup.custom/trunk/src/waeup/custom/students
- Files:
-
- 1 deleted
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.custom/trunk/src/waeup/custom/students/utils.py
r7145 r7151 1 from grok import getSite 1 import grok 2 2 from waeup.sirp.students.vocabularies import academic_sessions_vocab 3 3 from waeup.sirp.students.workflow import CLEARED, RETURNING 4 from waeup.sirp.students.utils import StudentsUtils 5 from waeup.sirp.students.interfaces import IStudentsUtils 4 6 5 def get_payment_details(category, student): 6 d = {} 7 d['surcharge_1'] = d['surcharge_2'] = d['surcharge_3'] = 0 8 d['p_item'] = u'' 9 d['amount'] = 0 10 d['error'] = u'' 11 d['p_session'] = student['studycourse'].current_session 12 session = str(d['p_session']) 13 try: 14 academic_session = getSite()['configuration'][session] 15 except KeyError: 16 d['error'] = u'Session configuration object is not available.' 7 class StudentsUtils(StudentsUtils): 8 """A collection of customized methods. 9 10 """ 11 grok.implements(IStudentsUtils) 12 13 def get_payment_details(self, category, student): 14 d = {} 15 d['surcharge_1'] = d['surcharge_2'] = d['surcharge_3'] = 0 16 d['p_item'] = u'' 17 d['amount'] = 0 18 d['error'] = u'' 19 d['p_session'] = student['studycourse'].current_session 20 session = str(d['p_session']) 21 try: 22 academic_session = grok.getSite()['configuration'][session] 23 except KeyError: 24 d['error'] = u'Session configuration object is not available.' 25 return d 26 if category == 'transfer': 27 d['amount'] = academic_session.transfer_fee 28 elif category == 'gown': 29 d['amount'] = academic_session.gown_fee 30 elif category == 'bed_allocation': 31 d['amount'] = academic_session.booking_fee 32 elif category == 'hostel_maintenance': 33 d['amount'] = academic_session.maint_fee 34 elif category == 'clearance': 35 d['p_item'] = student['studycourse'].certificate.code 36 d['amount'] = academic_session.clearance_fee 37 elif category == 'schoolfee': 38 d['surcharge_1'] = academic_session.surcharge_1 39 d['surcharge_2'] = academic_session.surcharge_2 40 d['amount'] = self.getSchoolFee(student, d['surcharge_1'] + d['surcharge_2']) 41 code = student['studycourse'].certificate.code 42 #session_string = academic_sessions_vocab.by_value[p_session + 1].title 43 d['p_item'] = code 44 d['p_session'] += 1 45 if d['amount'] == 0: 46 d['error'] = u'Amount could not be determined.' 17 47 return d 18 if category == 'transfer':19 d['amount'] = academic_session.transfer_fee20 elif category == 'gown':21 d['amount'] = academic_session.gown_fee22 elif category == 'bed_allocation':23 d['amount'] = academic_session.booking_fee24 elif category == 'hostel_maintenance':25 d['amount'] = academic_session.maint_fee26 elif category == 'clearance':27 d['p_item'] = student['studycourse'].certificate.code28 d['amount'] = academic_session.clearance_fee29 elif category == 'schoolfee':30 d['surcharge_1'] = academic_session.surcharge_131 d['surcharge_2'] = academic_session.surcharge_232 d['amount'] = getSchoolFee(student, d['surcharge_1'] + d['surcharge_2'])33 code = student['studycourse'].certificate.code34 #session_string = academic_sessions_vocab.by_value[p_session + 1].title35 d['p_item'] = code36 d['p_session'] += 137 if d['amount'] == 0:38 d['error'] = u'Amount could not be determined.'39 return d40 48 41 def getSchoolFee(student, surcharge):42 study_mode = student['studycourse'].certificate.study_mode43 entry_mode = student['studycourse'].entry_mode44 state = student.state45 #lga = student.lga46 lga = 'nothing'47 current_level = student['studycourse'].current_level49 def getSchoolFee(self, student, surcharge): 50 study_mode = student['studycourse'].certificate.study_mode 51 entry_mode = student['studycourse'].entry_mode 52 state = student.state 53 #lga = student.lga 54 lga = 'nothing' 55 current_level = student['studycourse'].current_level 48 56 49 if study_mode.endswith('_ft'): 50 # fresh 51 if state == CLEARED: 52 return 40000 - surcharge 53 # returning 54 elif state == RETURNING: 55 return 20000 - surcharge 57 if study_mode.endswith('_ft'): 58 # fresh 59 if state == CLEARED: 60 return 40000 - surcharge 61 # returning 62 elif state == RETURNING: 63 return 20000 - surcharge 64 else: 65 return 0 56 66 else: 57 67 return 0 58 else:59 return 0
Note: See TracChangeset for help on using the changeset viewer.