Changeset 2404


Ignore:
Timestamp:
20 Oct 2007, 12:55:04 (17 years ago)
Author:
Henrik Bettermann
Message:

forgotten to check in

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/base/skins/waeup_statistics/getPaymentStatistics.py

    r2394 r2404  
    88##title=
    99##
    10 # $Id: getPaymentStatistic.py 2391 2007-10-19 09:24:16Z joachim $
     10# $Id: getPaymentStatistics.py 2391 2007-10-19 09:24:16Z joachim $
    1111"""
    1212"""
     
    1616    def set_trace():
    1717        pass
    18 mtool = context.portal_membership
    19 member = mtool.getAuthenticatedMember()
    20 if str(member) not in ('admin','joachim'):
    21     return
    2218
    2319import logging
    2420import DateTime
    25 logger = logging.getLogger('Skins.getPaymentStatistic')
     21logger = logging.getLogger('Skins.getPaymentStatistics')
    2622from Products.AdvancedQuery import Eq, Between, Le,In
     23
     24
     25mtool = context.portal_membership
     26member = mtool.getAuthenticatedMember()
     27logger.info('%s starts getPaymentStatistics' % (member))
     28if str(member) not in ('admin','joachim','isouaba','hetomi'):
     29    return
     30
    2731pins = context.portal_pins
    2832aq_pins = context.portal_pins.evalAdvancedQuery
     
    7983fees['hostel'] = {'anz': len(ah),
    8084                 'fee': 500,
    81                  'title': 'Hostel Maintainance',
     85                 'title': 'Hostel maintainance scratch cards',
    8286                  'prefixes': hostel_pbs,
    8387                 }
     
    8690fees['clearance'] = {'anz': len(ac),
    8791                     'fee': 250,
    88                      'title': 'Clearance',
     92                     'title': 'Clearance scratch cards',
    8993                     'prefixes': clearance_pbs,
    9094                 }
     
    9397fees['application'] = {'anz' : len(aa),
    9498                 'fee': 200,
    95                  'title': 'Application',
     99                 'title': 'Application scratch cards',
    96100                  'prefixes': application_pbs,
    97101                 }
     102                 
    98103aso_query = Eq('portal_type','Payment') & Eq("SearchableText","approved")
    99104aso = aq_portal(aso_query)
     
    103108fees['schoolfee_onl'] = {'anz' : len(aso),
    104109                 'fee': 1000,
    105                  'title': 'Schoolfee (online)',
     110                 'title': 'School fee Wema/Interswitch payments',
    106111                  'prefixes': (),
    107112                 }
    108 aspaysc_query = Eq('portal_type','Payment') &\
    109                     Eq("SearchableText","payment") &\
    110                     Eq("SearchableText","successful") &\
    111                     ~ Eq("SearchableText","transfer")
    112113
    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)
    114121#rwrite("*"*80)
    115122# for pp in aspaysc:
    116123    # indexdata = portal.getIndexDataForRID(pp.getRID())
    117124    # 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
    136146#assc = [pin for pin in aq_pins(In('prefix_batch', schoolfee_pbs)) if pin.student]
    137147assc = aq_pins(In('prefix_batch', schoolfee_pbs) & missing_query)
    138148fees['schoolfee_scratch'] = {'anz' : len(assc),
    139                  'fee': 0,
    140                  'title': 'Schoolfee (Scratchcard counting)',
     149                 'fee': 1000,
     150                 'title': 'School fee scratch cards',
    141151                  'prefixes': schoolfee_pbs,
    142152                 }
    143 rwrite("Payed fees")
     153
     154current = DateTime.DateTime()
     155rwrite("Portal Service Charges (of %s)" % current)
     156rwrite('------------------------------------------------------------------')
     157
    144158total = 0
    145159keys = fees.keys()
     
    149163    t = fee['value'] = fee['anz'] * fee['fee']
    150164    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)
    152166gt = float(total)/1000000
    153 rwrite("Total %10.2f Million N" % gt)
     167rwrite("Total %10.2f Million Nairas" % gt)
     168
Note: See TracChangeset for help on using the changeset viewer.