From d70e3f97ae64081dc724c77e64d71f3747fdddf1 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 1 Sep 2001 12:35:39 +0000 Subject: [PATCH] totals --- httemplate/search/cust_bill.cgi | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/httemplate/search/cust_bill.cgi b/httemplate/search/cust_bill.cgi index a961455be..d6d942b1b 100755 --- a/httemplate/search/cust_bill.cgi +++ b/httemplate/search/cust_bill.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi $invnum $query $sortby @cust_bill ); @@ -82,25 +82,29 @@ if ( scalar(@cust_bill) == 1 ) { END my(%saw, $cust_bill); + my($tot_balance, $tot_amount) = (0, 0); foreach $cust_bill ( sort $sortby grep(!$saw{$_->invnum}++, @cust_bill) ) { my($invnum, $owed, $charged, $date ) = ( $cust_bill->invnum, - $cust_bill->owed, - $cust_bill->charged, + sprintf("%.2f", $cust_bill->owed), + sprintf("%.2f", $cust_bill->charged), $cust_bill->_date, ); my $pdate = time2str("%b %d %Y", $date); + $tot_balance += $owed; + $tot_amount += $charged; + my $rowspan = 1; my $view = popurl(2). "view/cust_bill.cgi?$invnum"; print < $invnum - \$$owed - \$$charged + \$$owed + \$$charged $pdate END my $custnum = $cust_bill->custnum; @@ -123,8 +127,11 @@ END print ""; } - + $tot_balance = sprintf("%.2f", $tot_balance); + $tot_amount = sprintf("%.2f", $tot_amount); print <TotalTotal + \$$tot_balance\$$tot_amount -- 2.11.0