Index: WAeUP_SRP/base/skins/waeup_statistics/getPaymentStatistics.py
===================================================================
--- WAeUP_SRP/base/skins/waeup_statistics/getPaymentStatistics.py	(revision 2394)
+++ WAeUP_SRP/base/skins/waeup_statistics/getPaymentStatistics.py	(revision 2394)
@@ -0,0 +1,153 @@
+## Script (Python) "getPaymentStatistic"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=
+##title=
+##
+# $Id: getPaymentStatistic.py 2391 2007-10-19 09:24:16Z joachim $
+"""
+"""
+try:
+    from Products.zdb import set_trace
+except:
+    def set_trace():
+        pass
+mtool = context.portal_membership
+member = mtool.getAuthenticatedMember()
+if str(member) not in ('admin','joachim'):
+    return
+
+import logging
+import DateTime
+logger = logging.getLogger('Skins.getPaymentStatistic')
+from Products.AdvancedQuery import Eq, Between, Le,In
+pins = context.portal_pins
+aq_pins = context.portal_pins.evalAdvancedQuery
+portal = context.portal_catalog_real
+aq_portal = context.portal_catalog_real.evalAdvancedQuery
+request = context.REQUEST
+session = request.SESSION
+response = request.RESPONSE
+setheader = request.RESPONSE.setHeader
+def rwrite(s):
+    response.setHeader('Content-type','text/html; charset=ISO-8859-15')
+    response.write("%s<br>\n\r" % s)
+
+# aso = aq_portal(Eq('portal_type','Payment') &\
+#                 #Eq('review_state','closed') &\
+#                 ~Eq("SearchableText",'sc') &\
+#                 ~Eq("SearchableText",'approved') &\
+#                 ~Eq("SearchableText",'incomplete') &\
+#                 ~Eq("SearchableText",'invalid') &\
+#                 ~Eq("SearchableText",'incorrect') &\
+#                 ~Eq("SearchableText",'card') &\
+#                 ~Eq("SearchableText",'error') &\
+#                 ~Eq("SearchableText",'channels') &\
+#                 ~Eq("SearchableText",'exceeded') &\
+#                 ~Eq("SearchableText",'insufficient'))
+# #set_trace()
+# count = 0
+# rwrite("total: %d" % len(aso))
+# for pp in aso:
+#     count += 1
+#     if count > 1000:
+#         break
+#     indexdata = portal.getIndexDataForRID(pp.getRID())
+#     rwrite("%s %s %s" % (pp.id,pp.listCreators,indexdata['SearchableText']))
+# return
+
+pbs = pins.uniqueValuesFor('prefix_batch')
+hostel_pbs = []
+for pb in pbs:
+    if pb.startswith('HMU') or pb.startswith('HMF'):
+        hostel_pbs.append(pb)
+clearance_pbs = [pb for pb in pbs if pb.startswith('CLR')]
+application_pbs = [pb for pb in pbs if pb.startswith('APP')]
+
+newschoolfee_pbs = [pb for pb in pbs if pb.endswith('NEW1')]
+
+schoolfee_pbs = list(pbs)[:]
+for pb in application_pbs + hostel_pbs + clearance_pbs + newschoolfee_pbs +['HOS1','HOS2']:
+    schoolfee_pbs.remove(pb)
+fees = {}
+missing_query = ~Eq('student','')
+#ah = [pin for pin in aq_pins(In('prefix_batch', hostel_pbs)) if pin.student]
+ah = aq_pins(In('prefix_batch', hostel_pbs) & missing_query)
+fees['hostel'] = {'anz': len(ah),
+                 'fee': 500,
+                 'title': 'Hostel Maintainance',
+                  'prefixes': hostel_pbs,
+                 }
+#ac = [pin for pin in aq_pins(In('prefix_batch', clearance_pbs)) if pin.student]
+ac = aq_pins(In('prefix_batch', clearance_pbs)& missing_query)
+fees['clearance'] = {'anz': len(ac),
+                     'fee': 250,
+                     'title': 'Clearance',
+                     'prefixes': clearance_pbs,
+                 }
+#aa = [pin for pin in aq_pins(In('prefix_batch', application_pbs)) if pin.student]
+aa = aq_pins(In('prefix_batch', application_pbs) & missing_query)
+fees['application'] = {'anz' : len(aa),
+                 'fee': 200,
+                 'title': 'Application',
+                  'prefixes': application_pbs,
+                 }
+aso_query = Eq('portal_type','Payment') & Eq("SearchableText","approved")
+aso = aq_portal(aso_query)
+# for pp in aso:
+#     indexdata = portal.getIndexDataForRID(pp.getRID())
+#     rwrite("%s %s %s" % (pp.id,pp.listCreators,indexdata['SearchableText']))
+fees['schoolfee_onl'] = {'anz' : len(aso),
+                 'fee': 1000,
+                 'title': 'Schoolfee (online)',
+                  'prefixes': (),
+                 }
+aspaysc_query = Eq('portal_type','Payment') &\
+                    Eq("SearchableText","payment") &\
+                    Eq("SearchableText","successful") &\
+                    ~ Eq("SearchableText","transfer")
+
+aspaysc = aq_portal(aspaysc_query)
+#rwrite("*"*80)
+# for pp in aspaysc:
+    # indexdata = portal.getIndexDataForRID(pp.getRID())
+    # rwrite("%s %s %s" % (pp.id,pp.listCreators,indexdata['SearchableText']))
+fees['schoolfee_paysc'] = {'anz' : len(aspaysc),
+                 'fee': 1000,
+                 'title': 'Schoolfee (sc in payments)',
+                  'prefixes': (),
+                 }
+not_query = ~aso_query & ~aspaysc_query
+not_res = aq_portal(aspaysc_query)
+fees['schoolfee_not'] = {'anz' : len(not_res),
+                 'fee': 0,
+                 'title': 'Not Schoolfee',
+                  'prefixes': (),
+                 }
+anewschool = aq_pins(In('prefix_batch', newschoolfee_pbs) & missing_query)
+fees['newschoolfee_sc'] = {'anz' : len(anewschool),
+                 'fee': 1000,
+                 'title': 'Schoolfee (..NEW SC)',
+                  'prefixes': newschoolfee_pbs,
+                 }
+#assc = [pin for pin in aq_pins(In('prefix_batch', schoolfee_pbs)) if pin.student]
+assc = aq_pins(In('prefix_batch', schoolfee_pbs) & missing_query)
+fees['schoolfee_scratch'] = {'anz' : len(assc),
+                 'fee': 0,
+                 'title': 'Schoolfee (Scratchcard counting)',
+                  'prefixes': schoolfee_pbs,
+                 }
+rwrite("Payed fees")
+total = 0
+keys = fees.keys()
+keys.sort()
+for key in keys:
+    fee = fees[key]
+    t = fee['value'] = fee['anz'] * fee['fee']
+    total += t
+    rwrite("%(title)s fees %(anz)d = %(value)d (%(fee)d N %(prefixes)s)" % fee)
+gt = float(total)/1000000
+rwrite("Total %10.2f Million N" % gt)
Index: WAeUP_SRP/base/skins/waeup_utilities/getPaymentStatistic.py
===================================================================
--- WAeUP_SRP/base/skins/waeup_utilities/getPaymentStatistic.py	(revision 2393)
+++ 	(revision )
@@ -1,153 +1,0 @@
-## Script (Python) "getPaymentStatistic"
-##bind container=container
-##bind context=context
-##bind namespace=
-##bind script=script
-##bind subpath=traverse_subpath
-##parameters=
-##title=
-##
-# $Id$
-"""
-"""
-try:
-    from Products.zdb import set_trace
-except:
-    def set_trace():
-        pass
-mtool = context.portal_membership
-member = mtool.getAuthenticatedMember()
-if str(member) not in ('admin','joachim'):
-    return
-
-import logging
-import DateTime
-logger = logging.getLogger('Skins.getPaymentStatistic')
-from Products.AdvancedQuery import Eq, Between, Le,In
-pins = context.portal_pins
-aq_pins = context.portal_pins.evalAdvancedQuery
-portal = context.portal_catalog_real
-aq_portal = context.portal_catalog_real.evalAdvancedQuery
-request = context.REQUEST
-session = request.SESSION
-response = request.RESPONSE
-setheader = request.RESPONSE.setHeader
-def rwrite(s):
-    response.setHeader('Content-type','text/html; charset=ISO-8859-15')
-    response.write("%s<br>\n\r" % s)
-
-# aso = aq_portal(Eq('portal_type','Payment') &\
-#                 #Eq('review_state','closed') &\
-#                 ~Eq("SearchableText",'sc') &\
-#                 ~Eq("SearchableText",'approved') &\
-#                 ~Eq("SearchableText",'incomplete') &\
-#                 ~Eq("SearchableText",'invalid') &\
-#                 ~Eq("SearchableText",'incorrect') &\
-#                 ~Eq("SearchableText",'card') &\
-#                 ~Eq("SearchableText",'error') &\
-#                 ~Eq("SearchableText",'channels') &\
-#                 ~Eq("SearchableText",'exceeded') &\
-#                 ~Eq("SearchableText",'insufficient'))
-# #set_trace()
-# count = 0
-# rwrite("total: %d" % len(aso))
-# for pp in aso:
-#     count += 1
-#     if count > 1000:
-#         break
-#     indexdata = portal.getIndexDataForRID(pp.getRID())
-#     rwrite("%s %s %s" % (pp.id,pp.listCreators,indexdata['SearchableText']))
-# return
-
-pbs = pins.uniqueValuesFor('prefix_batch')
-hostel_pbs = []
-for pb in pbs:
-    if pb.startswith('HMU') or pb.startswith('HMF'):
-        hostel_pbs.append(pb)
-clearance_pbs = [pb for pb in pbs if pb.startswith('CLR')]
-application_pbs = [pb for pb in pbs if pb.startswith('APP')]
-
-newschoolfee_pbs = [pb for pb in pbs if pb.endswith('NEW1')]
-
-schoolfee_pbs = list(pbs)[:]
-for pb in application_pbs + hostel_pbs + clearance_pbs + newschoolfee_pbs +['HOS1','HOS2']:
-    schoolfee_pbs.remove(pb)
-fees = {}
-missing_query = ~Eq('student','')
-#ah = [pin for pin in aq_pins(In('prefix_batch', hostel_pbs)) if pin.student]
-ah = aq_pins(In('prefix_batch', hostel_pbs) & missing_query)
-fees['hostel'] = {'anz': len(ah),
-                 'fee': 500,
-                 'title': 'Hostel Maintainance',
-                  'prefixes': hostel_pbs,
-                 }
-#ac = [pin for pin in aq_pins(In('prefix_batch', clearance_pbs)) if pin.student]
-ac = aq_pins(In('prefix_batch', clearance_pbs)& missing_query)
-fees['clearance'] = {'anz': len(ac),
-                     'fee': 250,
-                     'title': 'Clearance',
-                     'prefixes': clearance_pbs,
-                 }
-#aa = [pin for pin in aq_pins(In('prefix_batch', application_pbs)) if pin.student]
-aa = aq_pins(In('prefix_batch', application_pbs) & missing_query)
-fees['application'] = {'anz' : len(aa),
-                 'fee': 200,
-                 'title': 'Application',
-                  'prefixes': application_pbs,
-                 }
-aso_query = Eq('portal_type','Payment') & Eq("SearchableText","approved")
-aso = aq_portal(aso_query)
-# for pp in aso:
-#     indexdata = portal.getIndexDataForRID(pp.getRID())
-#     rwrite("%s %s %s" % (pp.id,pp.listCreators,indexdata['SearchableText']))
-fees['schoolfee_onl'] = {'anz' : len(aso),
-                 'fee': 1000,
-                 'title': 'Schoolfee (online)',
-                  'prefixes': (),
-                 }
-aspaysc_query = Eq('portal_type','Payment') &\
-                    Eq("SearchableText","payment") &\
-                    Eq("SearchableText","successful") &\
-                    ~ Eq("SearchableText","transfer")
-
-aspaysc = aq_portal(aspaysc_query)
-#rwrite("*"*80)
-# for pp in aspaysc:
-    # indexdata = portal.getIndexDataForRID(pp.getRID())
-    # rwrite("%s %s %s" % (pp.id,pp.listCreators,indexdata['SearchableText']))
-fees['schoolfee_paysc'] = {'anz' : len(aspaysc),
-                 'fee': 1000,
-                 'title': 'Schoolfee (sc in payments)',
-                  'prefixes': (),
-                 }
-not_query = ~aso_query & ~aspaysc_query
-not_res = aq_portal(aspaysc_query)
-fees['schoolfee_not'] = {'anz' : len(not_res),
-                 'fee': 0,
-                 'title': 'Not Schoolfee',
-                  'prefixes': (),
-                 }
-anewschool = aq_pins(In('prefix_batch', newschoolfee_pbs) & missing_query)
-fees['newschoolfee_sc'] = {'anz' : len(anewschool),
-                 'fee': 1000,
-                 'title': 'Schoolfee (..NEW SC)',
-                  'prefixes': newschoolfee_pbs,
-                 }
-#assc = [pin for pin in aq_pins(In('prefix_batch', schoolfee_pbs)) if pin.student]
-assc = aq_pins(In('prefix_batch', schoolfee_pbs) & missing_query)
-fees['schoolfee_scratch'] = {'anz' : len(assc),
-                 'fee': 0,
-                 'title': 'Schoolfee (Scratchcard counting)',
-                  'prefixes': schoolfee_pbs,
-                 }
-rwrite("Payed fees")
-total = 0
-keys = fees.keys()
-keys.sort()
-for key in keys:
-    fee = fees[key]
-    t = fee['value'] = fee['anz'] * fee['fee']
-    total += t
-    rwrite("%(title)s fees %(anz)d = %(value)d (%(fee)d N %(prefixes)s)" % fee)
-gt = float(total)/1000000
-rwrite("Total %10.2f Million N" % gt)
