- Timestamp:
- 20 Oct 2007, 12:55:04 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/base/skins/waeup_statistics/getPaymentStatistics.py
r2394 r2404 8 8 ##title= 9 9 ## 10 # $Id: getPaymentStatistic .py 2391 2007-10-19 09:24:16Z joachim $10 # $Id: getPaymentStatistics.py 2391 2007-10-19 09:24:16Z joachim $ 11 11 """ 12 12 """ … … 16 16 def set_trace(): 17 17 pass 18 mtool = context.portal_membership19 member = mtool.getAuthenticatedMember()20 if str(member) not in ('admin','joachim'):21 return22 18 23 19 import logging 24 20 import DateTime 25 logger = logging.getLogger('Skins.getPaymentStatistic ')21 logger = logging.getLogger('Skins.getPaymentStatistics') 26 22 from Products.AdvancedQuery import Eq, Between, Le,In 23 24 25 mtool = context.portal_membership 26 member = mtool.getAuthenticatedMember() 27 logger.info('%s starts getPaymentStatistics' % (member)) 28 if str(member) not in ('admin','joachim','isouaba','hetomi'): 29 return 30 27 31 pins = context.portal_pins 28 32 aq_pins = context.portal_pins.evalAdvancedQuery … … 79 83 fees['hostel'] = {'anz': len(ah), 80 84 'fee': 500, 81 'title': 'Hostel Maintainance',85 'title': 'Hostel maintainance scratch cards', 82 86 'prefixes': hostel_pbs, 83 87 } … … 86 90 fees['clearance'] = {'anz': len(ac), 87 91 'fee': 250, 88 'title': 'Clearance ',92 'title': 'Clearance scratch cards', 89 93 'prefixes': clearance_pbs, 90 94 } … … 93 97 fees['application'] = {'anz' : len(aa), 94 98 'fee': 200, 95 'title': 'Application ',99 'title': 'Application scratch cards', 96 100 'prefixes': application_pbs, 97 101 } 102 98 103 aso_query = Eq('portal_type','Payment') & Eq("SearchableText","approved") 99 104 aso = aq_portal(aso_query) … … 103 108 fees['schoolfee_onl'] = {'anz' : len(aso), 104 109 'fee': 1000, 105 'title': 'School fee (online)',110 'title': 'School fee Wema/Interswitch payments', 106 111 'prefixes': (), 107 112 } 108 aspaysc_query = Eq('portal_type','Payment') &\109 Eq("SearchableText","payment") &\110 Eq("SearchableText","successful") &\111 ~ Eq("SearchableText","transfer")112 113 113 aspaysc = aq_portal(aspaysc_query) 114 115 #aspaysc_query = Eq('portal_type','Payment') &\ 116 # Eq("SearchableText","payment") &\ 117 # Eq("SearchableText","successful") &\ 118 # ~ Eq("SearchableText","transfer") 119 120 #aspaysc = aq_portal(aspaysc_query) 114 121 #rwrite("*"*80) 115 122 # for pp in aspaysc: 116 123 # indexdata = portal.getIndexDataForRID(pp.getRID()) 117 124 # rwrite("%s %s %s" % (pp.id,pp.listCreators,indexdata['SearchableText'])) 118 fees['schoolfee_paysc'] = {'anz' : len(aspaysc), 119 'fee': 1000, 120 'title': 'Schoolfee (sc in payments)', 121 'prefixes': (), 122 } 123 not_query = ~aso_query & ~aspaysc_query 124 not_res = aq_portal(aspaysc_query) 125 fees['schoolfee_not'] = {'anz' : len(not_res), 126 'fee': 0, 127 'title': 'Not Schoolfee', 128 'prefixes': (), 129 } 130 anewschool = aq_pins(In('prefix_batch', newschoolfee_pbs) & missing_query) 131 fees['newschoolfee_sc'] = {'anz' : len(anewschool), 132 'fee': 1000, 133 'title': 'Schoolfee (..NEW SC)', 134 'prefixes': newschoolfee_pbs, 135 } 125 #fees['schoolfee_paysc'] = {'anz' : len(aspaysc), 126 # 'fee': 1000, 127 # 'title': 'Schoolfee (sc in payments)', 128 # 'prefixes': (), 129 # } 130 131 #not_query = ~aso_query & ~aspaysc_query 132 #not_res = aq_portal(aspaysc_query) 133 #fees['schoolfee_not'] = {'anz' : len(not_res), 134 # 'fee': 0, 135 # 'title': 'Not Schoolfee', 136 # 'prefixes': (), 137 # } 138 139 #anewschool = aq_pins(In('prefix_batch', newschoolfee_pbs) & missing_query) 140 #fees['newschoolfee_sc'] = {'anz' : len(anewschool), 141 # 'fee': 1000, 142 # 'title': 'Schoolfee (..NEW SC)', 143 # 'prefixes': newschoolfee_pbs, 144 # } 145 136 146 #assc = [pin for pin in aq_pins(In('prefix_batch', schoolfee_pbs)) if pin.student] 137 147 assc = aq_pins(In('prefix_batch', schoolfee_pbs) & missing_query) 138 148 fees['schoolfee_scratch'] = {'anz' : len(assc), 139 'fee': 0,140 'title': 'School fee (Scratchcard counting)',149 'fee': 1000, 150 'title': 'School fee scratch cards', 141 151 'prefixes': schoolfee_pbs, 142 152 } 143 rwrite("Payed fees") 153 154 current = DateTime.DateTime() 155 rwrite("Portal Service Charges (of %s)" % current) 156 rwrite('------------------------------------------------------------------') 157 144 158 total = 0 145 159 keys = fees.keys() … … 149 163 t = fee['value'] = fee['anz'] * fee['fee'] 150 164 total += t 151 rwrite("%(title)s fees %(anz)d = %(value)d (%(fee)d N%(prefixes)s)" % fee)165 rwrite("%(title)s: %(anz)d * %(fee)d Nairas = %(value)d Nairas" % fee) #(Prefixes %(prefixes)s)" % fee) 152 166 gt = float(total)/1000000 153 rwrite("Total %10.2f Million N" % gt) 167 rwrite("Total %10.2f Million Nairas" % gt) 168
Note: See TracChangeset for help on using the changeset viewer.