X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Fcust_pay.cgi;h=e4dba01e98d6ff00e9be48430b58f3f7c818ab0f;hb=ead5b6fc593ed0d9777a2e390a761110f5731a28;hp=d601617f91f423e47675e184e52bab381b85652d;hpb=3d7644882ebf59fcac7230a408d06e7c4e1bb34b;p=freeside.git diff --git a/httemplate/search/cust_pay.cgi b/httemplate/search/cust_pay.cgi index d601617f9..e4dba01e9 100755 --- a/httemplate/search/cust_pay.cgi +++ b/httemplate/search/cust_pay.cgi @@ -23,8 +23,9 @@ if ( $cgi->param('magic') && $cgi->param('magic') eq '_date' ) { my $ending = str2time($1) + 86400; $range .= ( $range ? ' AND ' : ' WHERE ' ). " _date <= $ending "; } + $range =~ s/^\s*WHERE/ AND/ if scalar(keys %search) ; - @cust_pay = qsearch('cust_pay', \%search, '', " $range" ); + @cust_pay = qsearch('cust_pay', \%search, '', $range ); $sortby = \*date_sort; @@ -71,6 +72,7 @@ if (0) { END my(%saw, $cust_pay); + my $tot_amount = 0; foreach my $cust_pay ( sort $sortby grep(!$saw{$_->paynum}++, @cust_pay) ) { @@ -82,6 +84,7 @@ END sprintf("%.2f", $cust_pay->paid), $cust_pay->_date, ); + $tot_amount += $amount; my $pdate = time2str("%b %d %Y", $date); my $rowspan = 1; @@ -126,7 +129,13 @@ END print ""; } - print <
'. table(). < + Total Amount + \$$tot_amount +