1 <% include('elements/monthly.html',
3 'Sales, Credits and Receipts Summary',
6 'graph_labels' => \%graph_label,
9 'agentnum' => $agentnum,
10 'nototal' => scalar($cgi->param('12mo')),
16 unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
19 my( $agentnum, $agent ) = ('', '');
20 if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
22 $agent = qsearchs('agent', { 'agentnum' => $agentnum } );
23 die "agentnum $agentnum not found!" unless $agent;
26 my $agentname = $agent ? $agent->agent.' ' : '';
28 my @items = qw( invoiced netsales
34 if ( $cgi->param('12mo') == 1 ) {
35 @items = map $_.'_12mo', @items;
39 'invoiced' => 'Gross Sales',
40 'netsales' => 'Net Sales',
41 'credits' => 'Gross Credits',
42 'netcredits' => 'Net Credits',
43 'payments' => 'Gross Receipts',
44 'receipts' => 'Net Receipts',
45 'refunds' => 'Gross Refunds',
46 'netrefunds' => 'Net Refunds',
47 'cashflow' => 'Gross Cashflow',
48 'netcashflow' => 'Net Cashflow',
52 'invoiced' => ' (invoiced)',
53 'netsales' => ' (invoiced - applied credits)',
54 'credits' => ' (credited)',
55 'netcredits' => ' (applied credits)',
56 'payments' => ' (payments)',
57 'receipts' => ' (applied payments)',
58 'refunds' => ' (refunds)',
59 'netrefunds' => ' (applied refunds)',
60 'cashflow' => ' (payments - refunds)',
61 'netcashflow' => ' (applied payments - applied refunds)',
63 my %graph_label = map { $_ => $label{$_}.$graph_suffix{$_} } keys %label;
65 $label{$_.'_12mo'} = $label{$_}. " (prev 12 months)"
68 $graph_label{$_.'_12mo'} = $graph_label{$_}. " (prev 12 months)"
69 foreach keys %graph_label;
72 'invoiced' => '9999ff', #light blue
73 'netsales' => '0000cc', #blue
74 'credits' => 'ff9999', #light red
75 'netcredits' => 'cc0000', #red
76 'payments' => '99cc99', #light green
77 'receipts' => '00cc00', #green
78 'refunds' => 'ffcc99', #light orange
79 'netrefunds' => 'ff9900', #orange
80 'cashflow' => '99cc33', #light olive
81 'netcashflow' => '339900', #olive
83 $color{$_.'_12mo'} = $color{$_}
87 'invoiced' => "${p}search/cust_bill.html?agentnum=$agentnum;",
88 'netsales' => "${p}search/cust_bill.html?agentnum=$agentnum;net=1;",
89 'credits' => "${p}search/cust_credit.html?agentnum=$agentnum;",
90 'netcredits' => "${p}search/cust_credit_bill.html?agentnum=$agentnum;",
91 'payments' => "${p}search/cust_pay.cgi?magic=_date;agentnum=$agentnum;",
92 'receipts' => "${p}search/cust_bill_pay.html?agentnum=$agentnum;",
93 'refunds' => "${p}search/cust_refund.html?magic=_date;agentnum=$agentnum;",
94 'netrefunds' => "${p}search/cust_credit_refund.html?agentnum=$agentnum;",