4 #my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
5 my ($curmon,$curyear) = (localtime(time))[4,5];
8 my $syear = $cgi->param('syear') || 1899+$curyear;
9 my $smonth = $cgi->param('smonth') || $curmon+1;
12 my $eyear = $cgi->param('eyear') || 1900+$curyear;
13 my $emonth = $cgi->param('emonth') || $curmon+1;
19 <TITLE>Sales, Credits and Receipts Summary</TITLE>
21 <BODY BGCOLOR="#e8e8e8">
22 <IMG SRC="money_time-graph.cgi?<%= $cgi->query_string %>" WIDTH="976" HEIGHT="384">
25 <%= table('e8e8e8') %>
28 my @items = qw( invoiced netsales credits payments receipts );
30 'invoiced' => 'Gross Sales',
31 'netsales' => 'Net Sales',
32 'credits' => 'Credits',
33 'payments' => 'Gross Receipts',
34 'receipts' => 'Net Receipts',
37 'invoiced' => '9999ff', #light blue
38 'netsales' => '0000cc', #blue
39 'credits' => 'cc0000', #red
40 'payments' => '99cc99', #light green
41 'receipts' => '00cc00', #green
44 'invoiced' => "${p}search/cust_bill.html?",
45 'credits' => "${p}search/cust_credit.html?",
46 'payments' => "${p}search/cust_pay.cgi?magic=_date;",
49 my $report = new FS::Report::Table::Monthly (
51 'start_month' => $smonth,
52 'start_year' => $syear,
53 'end_month' => $emonth,
56 my $data = $report->data;
58 my @mon = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
63 <% foreach my $column ( @{$data->{label}} ) {
64 #$column =~ s/^(\d+)\//$mon[$1-1]<BR>/e;
65 $column =~ s/^(\d+)\//$mon[$1-1]<BR>/;
67 <TH><%= $column %></TH>
71 <% foreach my $row (@items) { %>
72 <TR><TH><FONT COLOR="#<%= $color{$row} %>"><%= $label{$row} %></FONT></TH>
73 <% my $link = exists($link{$row})
74 ? qq(<A HREF="$link{$row})
76 my @speriod = @{$data->{speriod}};
77 my @eperiod = @{$data->{eperiod}};
79 <% foreach my $column ( @{$data->{$row}} ) { %>
80 <TD ALIGN="right" BGCOLOR="#ffffff">
81 <%= $link ? $link. 'begin='. shift(@speriod). ';end='. shift(@eperiod). '">' : '' %><FONT COLOR="#<%= $color{$row} %>">$<%= sprintf("%.2f", $column) %></FONT><%= $link ? '</A>' : '' %>
91 <INPUT TYPE="checkbox" NAME="ar">
92 Accounts receivable (invoices - applied credits)<BR>
93 <INPUT TYPE="checkbox" NAME="charged">
95 <INPUT TYPE="checkbox" NAME="defer">
96 Accounts receivable, with deferred revenue (invoices - applied credits, with charges for annual/semi-annual/quarterly/etc. services deferred over applicable time period) (there has got to be a shorter description for this)<BR>
97 <INPUT TYPE="checkbox" NAME="cash">
98 Cashflow (payments - refunds)<BR>
101 From <SELECT NAME="smonth">
102 <% foreach my $mon ( 1..12 ) { %>
103 <OPTION VALUE="<%= $mon %>"<%= $mon == $smonth ? ' SELECTED' : '' %>><%= $mon[$mon-1] %>
106 <SELECT NAME="syear">
107 <% foreach my $y ( 1999 .. 2010 ) { %>
108 <OPTION VALUE="<%= $y %>"<%= $y == $syear ? ' SELECTED' : '' %>><%= $y %>
111 to <SELECT NAME="emonth">
112 <% foreach my $mon ( 1..12 ) { %>
113 <OPTION VALUE="<%= $mon %>"<%= $mon == $emonth ? ' SELECTED' : '' %>><%= $mon[$mon-1] %>
116 <SELECT NAME="eyear">
117 <% foreach my $y ( 1999 .. 2010 ) { %>
118 <OPTION VALUE="<%= $y %>"<%= $y == $eyear ? ' SELECTED' : '' %>><%= $y %>
122 <INPUT TYPE="submit" VALUE="Redisplay">