X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Fcust_bill.cgi;h=41a4a546e379f998d31209521f06b046755ff747;hb=f91771606ce8a2bb4f2fa44e7bf54c9b7c945db6;hp=5550b5513b898e29c4ee4127d145b38d3ead5de1;hpb=51984ac3d3da3006809c6866fdecd4ad83610731;p=freeside.git
diff --git a/httemplate/search/cust_bill.cgi b/httemplate/search/cust_bill.cgi
index 5550b5513..41a4a546e 100755
--- a/httemplate/search/cust_bill.cgi
+++ b/httemplate/search/cust_bill.cgi
@@ -1,37 +1,5 @@
<%
-#
-# $Id: cust_bill.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $
-#
-# Usage: post form to:
-# http://server.name/path/cust_bill.cgi
-#
-# ivan@voicenet.com 97-apr-4
-#
-# Changes to allow page to work at a relative position in server
-# bmccane@maxbaud.net 98-apr-3
-#
-# $Log: cust_bill.cgi,v $
-# Revision 1.1 2001-07-30 07:36:04 ivan
-# templates!!!
-#
-# Revision 1.6 2001/04/22 01:38:39 ivan
-# svc_domain needs to import dbh sub from Record
-# view/cust_main.cgi needs to use ->owed method, not check (depriciated) owed field
-# search/cust_bill.cgi redirect error when there's only one invoice
-#
-# Revision 1.5 2000/07/17 16:45:41 ivan
-# first shot at invoice browsing and some other cleanups
-#
-# Revision 1.4 1999/02/28 00:03:54 ivan
-# removed misleading comments
-#
-# Revision 1.3 1999/01/19 05:14:11 ivan
-# for mod_perl: no more top-level my() variables; use vars instead
-# also the last s/create/new/;
-#
-# Revision 1.2 1998/12/17 09:41:07 ivan
-# s/CGI::(Base|Request)/CGI.pm/;
-#
+#
use strict;
use vars qw ( $cgi $invnum $query $sortby @cust_bill );
@@ -99,8 +67,7 @@ if ( scalar(@cust_bill) == 1 ) {
eidiot("Invoice not found.");
} else {
my $total = scalar(@cust_bill);
- print $cgi->header( '-expires' => 'now' ),
- &header("Invoice Search Results", menubar(
+ print header("Invoice Search Results", menubar(
'Main Menu', popurl(2)
)), "$total matching invoices found
", &table(), <
@@ -114,25 +81,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;
@@ -155,8 +126,11 @@ END
print "";
}
-
+ $tot_balance = sprintf("%.2f", $tot_balance);
+ $tot_amount = sprintf("%.2f", $tot_amount);
print < | Total | Total |
+ | \$$tot_balance | \$$tot_amount |