1 <% include('elements/monthly.html', #well, not really, daily flag below
3 'Daily Sales, Credits and Receipts Summary',
6 'graph_labels' => \%graph_label,
9 'agentnum' => $agentnum,
10 'cust_classnum'=> \@classnums,
12 'start_day' => $smday,
13 'start_month' => $smon+1,
14 'start_year' => $syear,
16 'end_month' => $emon+1,
23 unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
26 my( $agentnum, $agent ) = ('', '');
27 if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
29 $agent = qsearchs('agent', { 'agentnum' => $agentnum } );
30 die "agentnum $agentnum not found!" unless $agent;
33 my $agentname = $agent ? $agent->agent.' ' : '';
36 if ( $cgi->param('cust_classnum') ) {
37 @classnums = grep /^\d+$/, $cgi->param('cust_classnum');
40 my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi);
41 my ($ssec,$smin,$shour,$smday,$smon,$syear,$swday,$syday,$sisdst)
42 = localtime($beginning);
43 my ($esec,$emin,$ehour,$emday,$emon,$eyear,$ewday,$eyday,$eisdst)
46 my @items = ($cgi->param('exclude_discount') ? 'invoiced' : 'gross');
48 qw( discounted netsales
56 'gross' => 'Gross Sales',
57 'invoiced' => 'Invoiced Sales',
58 'netsales' => 'Net Sales',
59 'discounted' => 'Discounts',
60 'credits' => 'Gross Credits',
61 'netcredits' => 'Net Credits',
62 'payments' => 'Gross Receipts',
63 'receipts' => 'Net Receipts',
64 'refunds' => 'Gross Refunds',
65 'netrefunds' => 'Net Refunds',
66 'cashflow' => 'Gross Cashflow',
67 'netcashflow' => 'Net Cashflow',
71 'gross' => ' (invoiced + discounts)',
73 'netsales' => ' (invoiced - applied credits)',
75 'credits' => ' (credited)',
76 'netcredits' => ' (applied credits)',
77 'payments' => ' (payments)',
78 'receipts' => ' (applied payments)',
79 'refunds' => ' (refunds)',
80 'netrefunds' => ' (applied refunds)',
81 'cashflow' => ' (payments - refunds)',
82 'netcashflow' => ' (applied payments - applied refunds)',
84 my %graph_label = map { $_ => $label{$_}.$graph_suffix{$_} } keys %label;
87 'gross' => '9999ff', #light blue
88 'invoiced' => '9999ff', #light blue
89 'netsales' => '0000cc', #blue
90 'credits' => 'ff9999', #light red
91 'netcredits' => 'cc0000', #red
92 'payments' => '99cc99', #light green
93 'receipts' => '00cc00', #green
94 'refunds' => 'ffcc99', #light orange
95 'netrefunds' => 'ff9900', #orange
96 'cashflow' => '99cc33', #light olive
97 'netcashflow' => '339900', #olive
98 'discounted' => 'cc33cc', #purple-ish?
102 'gross' => "${p}search/cust_bill.html?agentnum=$agentnum;",
103 'invoiced' => "${p}search/cust_bill.html?agentnum=$agentnum;invoiced=1;",
104 'netsales' => "${p}search/cust_bill.html?agentnum=$agentnum;net=1;",
105 'credits' => "${p}search/cust_credit.html?agentnum=$agentnum;",
106 'netcredits' => "${p}search/cust_credit_bill.html?agentnum=$agentnum;",
107 'payments' => "${p}search/cust_pay.html?magic=_date;agentnum=$agentnum;",
108 'receipts' => "${p}search/cust_bill_pay.html?agentnum=$agentnum;",
109 'refunds' => "${p}search/cust_refund.html?magic=_date;agentnum=$agentnum;",
110 'netrefunds' => "${p}search/cust_credit_refund.html?agentnum=$agentnum;",
111 'discounted' => "${p}search/cust_bill_pkg_discount.html?agentnum=$agentnum;",