1 <% include('elements/monthly.html',
3 'Sales, Credits and Receipts Summary',
6 'graph_labels' => \%graph_label,
9 'start_month' => $smonth,
10 'start_year' => $syear,
11 'end_month' => $emonth,
13 'agentnum' => $agentnum,
14 'nototal' => scalar($cgi->param('12mo')),
20 unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
23 my $syear = $cgi->param('start_year'); # || 1899+$curyear;
24 my $smonth = $cgi->param('start_month'); # || $curmon+1;
27 my $eyear = $cgi->param('end_year'); # || 1900+$curyear;
28 my $emonth = $cgi->param('end_month'); # || $curmon+1;
31 my( $agentnum, $agent ) = ('', '');
32 if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
34 $agent = qsearchs('agent', { 'agentnum' => $agentnum } );
35 die "agentnum $agentnum not found!" unless $agent;
38 my $agentname = $agent ? $agent->agent.' ' : '';
40 my @items = qw( invoiced netsales credits payments receipts );
41 if ( $cgi->param('12mo') == 1 ) {
42 @items = map $_.'_12mo', @items;
46 'invoiced' => 'Gross Sales',
47 'netsales' => 'Net Sales',
48 'credits' => 'Credits',
49 'payments' => 'Gross Receipts',
50 'receipts' => 'Net Receipts',
54 'invoiced' => ' (invoiced)',
55 'netsales' => ' (invoiced - applied credits)',
57 'payments' => ' (payments)',
58 'receipts' => '/Cashflow (payments - refunds)',
60 my %graph_label = map { $_ => $label{$_}.$graph_suffix{$_} } keys %label;
62 $label{$_.'_12mo'} = $label{$_}. " (previous 12 months)"
65 $graph_label{$_.'_12mo'} = $graph_label{$_}. " (previous 12 months)"
66 foreach keys %graph_label;
69 'invoiced' => '9999ff', #light blue
70 'netsales' => '0000cc', #blue
71 'credits' => 'cc0000', #red
72 'payments' => '99cc99', #light green
73 'receipts' => '00cc00', #green
75 $color{$_.'_12mo'} = $color{$_}
79 'invoiced' => "${p}search/cust_bill.html?agentnum=$agentnum;",
80 'credits' => "${p}search/cust_credit.html?agentnum=$agentnum;",
81 'payments' => "${p}search/cust_pay.cgi?magic=_date;agentnum=$agentnum;",