1 <% include('elements/monthly.html',
3 'Daily Sales, Credits and Receipts Summary',
6 'graph_labels' => \%graph_label,
9 'agentnum' => $agentnum,
10 'cust_classnum'=> \@classnums,
11 'nototal' => scalar($cgi->param('12mo')),
13 'start_day' => $smday,
14 'start_month' => $smon+1,
15 'start_year' => $syear,
17 'end_month' => $emon+1,
24 unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
27 my( $agentnum, $agent ) = ('', '');
28 if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
30 $agent = qsearchs('agent', { 'agentnum' => $agentnum } );
31 die "agentnum $agentnum not found!" unless $agent;
34 my $agentname = $agent ? $agent->agent.' ' : '';
37 if ( $cgi->param('cust_classnum') ) {
38 @classnums = grep /^\d+$/, $cgi->param('cust_classnum');
41 my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi);
42 my ($ssec,$smin,$shour,$smday,$smon,$syear,$swday,$syday,$sisdst)
43 = localtime($beginning);
44 my ($esec,$emin,$ehour,$emday,$emon,$eyear,$ewday,$eyday,$eisdst)
47 my @items = qw( invoiced netsales
53 if ( $cgi->param('12mo') == 1 ) {
54 @items = map $_.'_12mo', @items;
58 'invoiced' => 'Gross Sales',
59 'netsales' => 'Net Sales',
60 'credits' => 'Gross Credits',
61 'netcredits' => 'Net Credits',
62 'payments' => 'Gross Receipts',
63 'receipts' => 'Net Receipts',
64 'refunds' => 'Gross Refunds',
65 'netrefunds' => 'Net Refunds',
66 'cashflow' => 'Gross Cashflow',
67 'netcashflow' => 'Net Cashflow',
71 'invoiced' => ' (invoiced)',
72 'netsales' => ' (invoiced - applied credits)',
73 'credits' => ' (credited)',
74 'netcredits' => ' (applied credits)',
75 'payments' => ' (payments)',
76 'receipts' => ' (applied payments)',
77 'refunds' => ' (refunds)',
78 'netrefunds' => ' (applied refunds)',
79 'cashflow' => ' (payments - refunds)',
80 'netcashflow' => ' (applied payments - applied refunds)',
82 my %graph_label = map { $_ => $label{$_}.$graph_suffix{$_} } keys %label;
84 $label{$_.'_12mo'} = $label{$_}. " (prev 12 months)"
87 $graph_label{$_.'_12mo'} = $graph_label{$_}. " (prev 12 months)"
88 foreach keys %graph_label;
91 'invoiced' => '9999ff', #light blue
92 'netsales' => '0000cc', #blue
93 'credits' => 'ff9999', #light red
94 'netcredits' => 'cc0000', #red
95 'payments' => '99cc99', #light green
96 'receipts' => '00cc00', #green
97 'refunds' => 'ffcc99', #light orange
98 'netrefunds' => 'ff9900', #orange
99 'cashflow' => '99cc33', #light olive
100 'netcashflow' => '339900', #olive
102 $color{$_.'_12mo'} = $color{$_}
106 'invoiced' => "${p}search/cust_bill.html?agentnum=$agentnum;",
107 'netsales' => "${p}search/cust_bill.html?agentnum=$agentnum;net=1;",
108 'credits' => "${p}search/cust_credit.html?agentnum=$agentnum;",
109 'netcredits' => "${p}search/cust_credit_bill.html?agentnum=$agentnum;",
110 'payments' => "${p}search/cust_pay.html?magic=_date;agentnum=$agentnum;",
111 'receipts' => "${p}search/cust_bill_pay.html?agentnum=$agentnum;",
112 'refunds' => "${p}search/cust_refund.html?magic=_date;agentnum=$agentnum;",
113 'netrefunds' => "${p}search/cust_credit_refund.html?agentnum=$agentnum;",