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 credits payments receipts );
29 if ( $cgi->param('12mo') == 1 ) {
30 @items = map $_.'_12mo', @items;
34 'invoiced' => 'Gross Sales',
35 'netsales' => 'Net Sales',
36 'credits' => 'Credits',
37 'payments' => 'Gross Receipts',
38 'receipts' => 'Net Receipts',
42 'invoiced' => ' (invoiced)',
43 'netsales' => ' (invoiced - applied credits)',
45 'payments' => ' (payments)',
46 'receipts' => '/Cashflow (payments - refunds)',
48 my %graph_label = map { $_ => $label{$_}.$graph_suffix{$_} } keys %label;
50 $label{$_.'_12mo'} = $label{$_}. " (previous 12 months)"
53 $graph_label{$_.'_12mo'} = $graph_label{$_}. " (previous 12 months)"
54 foreach keys %graph_label;
57 'invoiced' => '9999ff', #light blue
58 'netsales' => '0000cc', #blue
59 'credits' => 'cc0000', #red
60 'payments' => '99cc99', #light green
61 'receipts' => '00cc00', #green
63 $color{$_.'_12mo'} = $color{$_}
67 'invoiced' => "${p}search/cust_bill.html?agentnum=$agentnum;",
68 'netsales' => "${p}search/cust_bill.html?agentnum=$agentnum;net=1;",
69 'credits' => "${p}search/cust_credit.html?agentnum=$agentnum;",
70 'payments' => "${p}search/cust_pay.cgi?magic=_date;agentnum=$agentnum;",