File tree 3 files changed +25
-2
lines changed
esp/program/modules/handlers
public/media/scripts/program/modules
templates/program/modules/adminvitals
3 files changed +25
-2
lines changed Original file line number Diff line number Diff line change 56
56
from esp .users .models import UserAvailability
57
57
from esp .utils .decorators import cached_module_view , json_response
58
58
from esp .utils .no_autocookie import disable_csrf_cookie_update
59
- from esp .accounting .controllers import IndividualAccountingController
59
+ from esp .accounting .controllers import ProgramAccountingController , IndividualAccountingController
60
+ from esp .accounting .models import Transfer
60
61
61
62
from decimal import Decimal
62
63
@@ -762,6 +763,15 @@ def student_max_count(clslist):
762
763
}
763
764
dictOut ["stats" ].append ({"id" : "splashinfo" , "data" : splashinfo_data })
764
765
766
+ # Add accounting stats
767
+ lt = ProgramAccountingController (prog ).default_payments_lineitemtype ()
768
+ payments = Transfer .objects .filter (line_item = lt )
769
+ accounting_data = {
770
+ 'num_payments' : payments .count (),
771
+ 'total_payments' : payments .aggregate (total = Sum ('amount_dec' ))['total' ],
772
+ }
773
+ dictOut ["stats" ].append ({"id" : "accounting" , "data" : accounting_data })
774
+
765
775
return dictOut
766
776
stats .cached_function .depend_on_row (ClassSubject , lambda cls : {'prog' : cls .parent_program })
767
777
stats .cached_function .depend_on_row (SplashInfo , lambda si : {'prog' : si .program })
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ function fillStats(data)
9
9
grades = stats . grades ;
10
10
shirtnum = stats . shirtnum ;
11
11
splashinfo = stats . splashinfo ;
12
+ accounting = stats . accounting ;
12
13
13
14
// Fill in student num data
14
15
$studentnum = $j ( "#stats_students > .module_group_body" ) ;
@@ -158,6 +159,11 @@ function fillStats(data)
158
159
}
159
160
else
160
161
$splashinfo . html ( "SplashInfo module is not enabled -- no statistics" ) ;
162
+
163
+ // Fill in the accounting table
164
+ $accounting = $j ( "#stats_accounting > .module_group_body" ) ;
165
+ $accounting . html ( "<strong>Number of credit card payments</strong>: " + accounting . data . num_payments + "<br />" ) ;
166
+ $accounting . append ( "<strong>Total amount of credit card payments</strong>: $" + accounting . data . total_payments . toFixed ( 2 ) ) ;
161
167
}
162
168
163
169
function getStats ( )
Original file line number Diff line number Diff line change 16
16
. add ( "#stats_hours" )
17
17
. add ( "#stats_timeslots" )
18
18
. add ( "#stats_tshirts" )
19
- . add ( "#stats_splashinfo" ) ;
19
+ . add ( "#stats_splashinfo" )
20
+ . add ( "#stats_accounting" ) ;
20
21
$module_group_headers = $module_groups . children ( ".module_group_header" ) ;
21
22
$module_group_headers . click ( getStats ) ;
22
23
} ) ;
86
87
Loading data...
87
88
</ div >
88
89
</ div >
90
+ < div class ="module_group " id ="stats_accounting ">
91
+ < div class ="module_group_header module_group_expandable "> Accounting < span class ="expand_collapse_text "> (click to expand)</ span > </ div >
92
+ < div class ="module_group_body " style ="display:none ">
93
+ Loading data...
94
+ </ div >
95
+ </ div >
89
96
</ div > <!-- div#program_vitals_wrapper -->
90
97
</ div >
91
98
</ div > <!-- div#program_form -->
You can’t perform that action at this time.
0 commit comments