1 <% include('elements/monthly.html',
3 'Daily Sales, Credits and Receipts Summary',
6 'graph_labels' => \%graph_label,
9 'agentnum' => $agentnum,
10 'nototal' => scalar($cgi->param('12mo')),
12 'start_day' => $smday,
13 'start_month' => $smon+1,
14 'start_year' => $syear,
16 'end_month' => $emon+1,
23 unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
26 my( $agentnum, $agent ) = ('', '');
27 if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
29 $agent = qsearchs('agent', { 'agentnum' => $agentnum } );
30 die "agentnum $agentnum not found!" unless $agent;
33 my $agentname = $agent ? $agent->agent.' ' : '';
35 my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi);
36 my ($ssec,$smin,$shour,$smday,$smon,$syear,$swday,$syday,$sisdst)
37 = localtime($beginning);
38 my ($esec,$emin,$ehour,$emday,$emon,$eyear,$ewday,$eyday,$eisdst)
41 my @items = qw( invoiced netsales
47 if ( $cgi->param('12mo') == 1 ) {
48 @items = map $_.'_12mo', @items;
52 'invoiced' => 'Gross Sales',
53 'netsales' => 'Net Sales',
54 'credits' => 'Gross Credits',
55 'netcredits' => 'Net Credits',
56 'payments' => 'Gross Receipts',
57 'receipts' => 'Net Receipts',
58 'refunds' => 'Gross Refunds',
59 'netrefunds' => 'Net Refunds',
60 'cashflow' => 'Gross Cashflow',
61 'netcashflow' => 'Net Cashflow',
65 'invoiced' => ' (invoiced)',
66 'netsales' => ' (invoiced - applied credits)',
67 'credits' => ' (credited)',
68 'netcredits' => ' (applied credits)',
69 'payments' => ' (payments)',
70 'receipts' => ' (applied payments)',
71 'refunds' => ' (refunds)',
72 'netrefunds' => ' (applied refunds)',
73 'cashflow' => ' (payments - refunds)',
74 'netcashflow' => ' (applied payments - applied refunds)',
76 my %graph_label = map { $_ => $label{$_}.$graph_suffix{$_} } keys %label;
78 $label{$_.'_12mo'} = $label{$_}. " (prev 12 months)"
81 $graph_label{$_.'_12mo'} = $graph_label{$_}. " (prev 12 months)"
82 foreach keys %graph_label;
85 'invoiced' => '9999ff', #light blue
86 'netsales' => '0000cc', #blue
87 'credits' => 'ff9999', #light red
88 'netcredits' => 'cc0000', #red
89 'payments' => '99cc99', #light green
90 'receipts' => '00cc00', #green
91 'refunds' => 'ffcc99', #light orange
92 'netrefunds' => 'ff9900', #orange
93 'cashflow' => '99cc33', #light olive
94 'netcashflow' => '339900', #olive
96 $color{$_.'_12mo'} = $color{$_}
100 'invoiced' => "${p}search/cust_bill.html?agentnum=$agentnum;",
101 'netsales' => "${p}search/cust_bill.html?agentnum=$agentnum;net=1;",
102 'credits' => "${p}search/cust_credit.html?agentnum=$agentnum;",
103 'netcredits' => "${p}search/cust_credit_bill.html?agentnum=$agentnum;",
104 'payments' => "${p}search/cust_pay.html?magic=_date;agentnum=$agentnum;",
105 'receipts' => "${p}search/cust_bill_pay.html?agentnum=$agentnum;",
106 'refunds' => "${p}search/cust_refund.html?magic=_date;agentnum=$agentnum;",
107 'netrefunds' => "${p}search/cust_credit_refund.html?agentnum=$agentnum;",