4 %my $syear = $cgi->param('start_year'); # || 1899+$curyear;
5 %my $smonth = $cgi->param('start_month'); # || $curmon+1;
8 %my $eyear = $cgi->param('end_year'); # || 1900+$curyear;
9 %my $emonth = $cgi->param('end_month'); # || $curmon+1;
12 %my( $agentnum, $agent ) = ('', '');
13 %if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
15 % $agent = qsearchs('agent', { 'agentnum' => $agentnum } );
16 % die "agentnum $agentnum not found!" unless $agent;
18 %my $agentname = $agent ? $agent->agent.' ' : '';
20 %my @items = qw( invoiced netsales credits payments receipts );
21 %if ( $cgi->param('12mo') == 1 ) {
22 % @items = map $_.'_12mo', @items;
26 % 'invoiced' => 'Gross Sales',
27 % 'netsales' => 'Net Sales',
28 % 'credits' => 'Credits',
29 % 'payments' => 'Gross Receipts',
30 % 'receipts' => 'Net Receipts',
34 % 'invoiced' => ' (invoiced)',
35 % 'netsales' => ' (invoiced - applied credits)',
37 % 'payments' => ' (payments)',
38 % 'receipts' => '/Cashflow (payments - refunds)',
40 %my %graph_label = map { $_ => $label{$_}.$graph_suffix{$_} } keys %label;
42 %$label{$_.'_12mo'} = $label{$_}. " (previous 12 months)"
43 % foreach keys %label;
45 %$graph_label{$_.'_12mo'} = $graph_label{$_}. " (previous 12 months)"
46 % foreach keys %graph_label;
49 % 'invoiced' => '9999ff', #light blue
50 % 'netsales' => '0000cc', #blue
51 % 'credits' => 'cc0000', #red
52 % 'payments' => '99cc99', #light green
53 % 'receipts' => '00cc00', #green
55 %$color{$_.'_12mo'} = $color{$_}
56 % foreach keys %color;
59 % 'invoiced' => "${p}search/cust_bill.html?agentnum=$agentnum;",
60 % 'credits' => "${p}search/cust_credit.html?agentnum=$agentnum;",
61 % 'payments' => "${p}search/cust_pay.cgi?magic=_date;agentnum=$agentnum;",
66 <% include('elements/monthly.html',
67 'title' => $agentname.
68 'Sales, Credits and Receipts Summary',
71 'graph_labels' => \%graph_label,
74 'start_month' => $smonth,
75 'start_year' => $syear,
76 'end_month' => $emonth,
78 'agentnum' => $agentnum,
79 'nototal' => scalar($cgi->param('12mo')),