X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fgraph%2Fmoney_time.cgi;h=9c0a94ff3754d7d287c362d90135bc04619a36b9;hp=1c7d54266c04d59e6ea6726b2374ab404438b235;hb=6a5ebd04bc59509c5fb934d226d6dd144cf034bd;hpb=f7fd2a3e34da751cbc02bbf215e99c6dc89adc15 diff --git a/httemplate/graph/money_time.cgi b/httemplate/graph/money_time.cgi index 1c7d54266..9c0a94ff3 100644 --- a/httemplate/graph/money_time.cgi +++ b/httemplate/graph/money_time.cgi @@ -12,13 +12,23 @@ my $smonth = $cgi->param('smonth') || $curmon+1; my $eyear = $cgi->param('eyear') || 1900+$curyear; my $emonth = $cgi->param('emonth') || $curmon+1; +#XXX or virtual +my( $agentnum, $agent ) = ('', ''); +if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) { + $agentnum = $1; + $agent = qsearchs('agent', { 'agentnum' => $agentnum } ); + die "agentnum $agentnum not found!" unless $agent; +} +my $agentname = $agent ? $agent->agent.' ' : ''; +warn $agentname; + +%> + +<%= include('/elements/header.html', + $agentname. 'Sales, Credits and Receipts Summary' + ) %> - - - Sales, Credits and Receipts Summary - -
@@ -41,9 +51,9 @@ my %color = ( 'receipts' => '00cc00', #green ); my %link = ( - 'invoiced' => "${p}search/cust_bill.html?", - 'credits' => "${p}search/cust_credit.html?", - 'payments' => "${p}search/cust_pay.cgi?magic=_date;", + 'invoiced' => "${p}search/cust_bill.html?agentnum=$agentnum;", + 'credits' => "${p}search/cust_credit.html?agentnum=$agentnum;", + 'payments' => "${p}search/cust_pay.cgi?magic=_date;agentnum=$agentnum;", ); my $report = new FS::Report::Table::Monthly ( @@ -52,6 +62,7 @@ my $report = new FS::Report::Table::Monthly ( 'start_year' => $syear, 'end_month' => $emonth, 'end_year' => $eyear, + 'agentnum' => $agentnum, ); my $data = $report->data; @@ -66,6 +77,7 @@ my @mon = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec); %> <%= $column %> <% } %> + Total <% foreach my $row (@items) { %> @@ -75,12 +87,15 @@ my @mon = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec); : ''; my @speriod = @{$data->{speriod}}; my @eperiod = @{$data->{eperiod}}; + my $total = 0; %> <% foreach my $column ( @{$data->{$row}} ) { %> <%= $link ? $link. 'begin='. shift(@speriod). ';end='. shift(@eperiod). '">' : '' %>$<%= sprintf("%.2f", $column) %><%= $link ? '' : '' %> + <% $total += $column; %> <% } %> + <%= sprintf("%.2f", $total) %> <% } %> @@ -119,6 +134,8 @@ From +for agent: <%= include('/elements/select-agent.html', $agentnum) %> +