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 netcredits payments receipts );
29 if ( $cgi->param('12mo') == 1 ) {
30 @items = map $_.'_12mo', @items;
34 'invoiced' => 'Gross Sales',
35 'netsales' => 'Net Sales',
36 'credits' => 'Gross Credits',
37 'netcredits' => 'Net Credits',
38 'payments' => 'Gross Receipts',
39 'receipts' => 'Net Receipts',
43 'invoiced' => ' (invoiced)',
44 'netsales' => ' (invoiced - applied credits)',
45 'credits' => ' (credited)',
46 'netcredits' => ' (applied credits)',
47 'payments' => ' (payments)',
48 'receipts' => '/Cashflow (payments - refunds)',
50 my %graph_label = map { $_ => $label{$_}.$graph_suffix{$_} } keys %label;
52 $label{$_.'_12mo'} = $label{$_}. " (previous 12 months)"
55 $graph_label{$_.'_12mo'} = $graph_label{$_}. " (previous 12 months)"
56 foreach keys %graph_label;
59 'invoiced' => '9999ff', #light blue
60 'netsales' => '0000cc', #blue
61 'credits' => 'ff9999', #light red
62 'netcredits' => 'cc0000', #red
63 'payments' => '99cc99', #light green
64 'receipts' => '00cc00', #green
66 $color{$_.'_12mo'} = $color{$_}
70 'invoiced' => "${p}search/cust_bill.html?agentnum=$agentnum;",
71 'netsales' => "${p}search/cust_bill.html?agentnum=$agentnum;net=1;",
72 'credits' => "${p}search/cust_credit.html?agentnum=$agentnum;",
73 'netcredits' => "${p}search/cust_credit_bill.html?agentnum=$agentnum;",
74 'payments' => "${p}search/cust_pay.cgi?magic=_date;agentnum=$agentnum;",