source: WAeUP_SRP/trunk/skins/waeup_aaua/getPaymentStatistics.py @ 17877

Last change on this file since 17877 was 5580, checked in by Henrik Bettermann, 14 years ago

Edit doc string.

  • Property svn:keywords set to Id
File size: 5.0 KB
Line 
1## Script (Python) "getPaymentStatistics"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=session_id=None
8##title=
9##
10# $Id: getPaymentStatistics.py 5580 2010-11-08 08:51:16Z henrik $
11"""
12return Payment Statistics for AAUA
13"""
14
15from Products.AdvancedQuery import Eq, Between, Le,In
16
17import logging
18logger = logging.getLogger('Skins.getPaymentStatistics')
19
20import DateTime,csv
21
22member = context.portal_membership.getAuthenticatedMember()
23logger.info('%s invoked statistics' % member)
24if not context.isStaff():
25    return
26
27IPTP = ('ACC','BFN','BUS','HIS','ECO','PAD','PGD','SOC')
28
29#INE = ('ATE','CEM','EDU','GST','SSE','STE ')
30
31catA =      (      'school_fee_paid',
32                   'courses_registered',
33                   'courses_validated',
34                   )
35                   
36if not session_id:
37    session_id  = context.getSessionId()[0]
38
39L1 = ('100','110','120')
40L2 = ('200','210','220')
41L3 = ('300','310','320')
42L4 = ('400','410','420')
43L5 = ('500','510','520')
44L6 = ('600','610','620')
45L7 = ('700','710','720')
46L8 = ('800','810','820')
47d = {}
48
49# Diploma and Direct entry students
50
51query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','dp_pt')
52d['dp_pt'] = len(context.students_catalog.evalAdvancedQuery(query))
53
54query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','de_pt')
55d['de_pt'] = len(context.students_catalog.evalAdvancedQuery(query))
56
57query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','de_sw')
58d['de_sw'] = len(context.students_catalog.evalAdvancedQuery(query))
59
60# IPTP students
61
62query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','ug_pt') & In('department',IPTP) & In('level',L1)
63d['ug_pt_iptp_100'] = len(context.students_catalog.evalAdvancedQuery(query))
64
65
66query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','ug_pt') & In('department',IPTP) & In('level',L2)
67d['ug_pt_iptp_200'] = len(context.students_catalog.evalAdvancedQuery(query))
68
69
70query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','ug_pt') & In('department',IPTP) & In('level',L3)
71d['ug_pt_iptp_300'] = len(context.students_catalog.evalAdvancedQuery(query))
72
73query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','ug_pt') & In('department',IPTP) & In('level',L4)
74d['ug_pt_iptp_400'] = len(context.students_catalog.evalAdvancedQuery(query))
75
76query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','ug_pt') & In('department',IPTP) & In('level',L5)
77d['ug_pt_iptp_500'] = len(context.students_catalog.evalAdvancedQuery(query))
78
79query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','pg_pt') & In('department',IPTP) & In('level',L6)
80d['pg_pt_iptp_600'] = len(context.students_catalog.evalAdvancedQuery(query))
81
82query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','pg_pt') & In('department',IPTP) & In('level',L7)
83d['pg_pt_iptp_700'] = len(context.students_catalog.evalAdvancedQuery(query))
84
85query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','pg_pt') & In('department',IPTP) & In('level',L8)
86d['pg_pt_iptp_800'] = len(context.students_catalog.evalAdvancedQuery(query))
87
88#INE  sandwich
89
90
91query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','ug_sw') & ~In('department',IPTP) & In('level',L1)
92d['ug_sw_ine_100'] = len(context.students_catalog.evalAdvancedQuery(query))
93
94
95query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','ug_sw') & ~In('department',IPTP) & In('level',L2)
96d['ug_sw_ine_200'] = len(context.students_catalog.evalAdvancedQuery(query))
97
98
99query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','ug_sw') & ~In('department',IPTP) & In('level',L3)
100d['ug_sw_ine_300'] = len(context.students_catalog.evalAdvancedQuery(query))
101
102
103query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','ug_sw') & ~In('department',IPTP) & In('level',L4)
104d['ug_sw_ine_400'] = len(context.students_catalog.evalAdvancedQuery(query))
105
106
107query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','ug_sw') & ~In('department',IPTP) & In('level',L5)
108d['ug_sw_ine_500'] = len(context.students_catalog.evalAdvancedQuery(query))
109
110
111query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','pg_sw') & ~In('department',IPTP) & In('level',L6)
112d['pg_sw_ine_600'] = len(context.students_catalog.evalAdvancedQuery(query))
113
114query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','pg_sw') & ~In('department',IPTP) & In('level',L7)
115d['pg_sw_ine_700'] = len(context.students_catalog.evalAdvancedQuery(query))
116
117query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','pg_sw') & ~In('department',IPTP) & In('level',L8)
118d['pg_sw_ine_800'] = len(context.students_catalog.evalAdvancedQuery(query))
119
120l = []
121l += d,
122
123csv_name = context.waeup_tool.dumpListToCSV(l,'payments_statistics')
124logger.info('%s dumped payments statistics to %s' % (member,csv_name))
125
126return d
Note: See TracBrowser for help on using the repository browser.