summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2002-07-07 14:00:49 +0000
committerivan <ivan>2002-07-07 14:00:49 +0000
commit012523fcc0f3bc9994a429eb96b32eab6b3c04ce (patch)
treeb25afdc3cec020f8764ef586d2f771a999addf20
parentf9bab439b413fa0c9a3f495da090ce1c67f6e654 (diff)
try for correct totals
-rwxr-xr-xhttemplate/search/cust_bill.cgi13
1 files changed, 7 insertions, 6 deletions
diff --git a/httemplate/search/cust_bill.cgi b/httemplate/search/cust_bill.cgi
index 3b6b8fad9..6d00593bd 100755
--- a/httemplate/search/cust_bill.cgi
+++ b/httemplate/search/cust_bill.cgi
@@ -70,11 +70,13 @@ if ( $cgi->keywords ) {
my $extra_sql = scalar(@where) ? 'WHERE '. join(' AND ', @where) : '';
- my $statement = "SELECT COUNT(*) FROM cust_bill $extra_sql";
+ my $statement = "SELECT COUNT(*), sum(charged), sum($owed)
+ FROM cust_bill $extra_sql";
my $sth = dbh->prepare($statement) or die dbh->errstr. " doing $statement";
$sth->execute or die "Error executing \"$statement\": ". $sth->errstr;
- $total = $sth->fetchrow_arrayref->[0];
+ #$total = $sth->fetchrow_arrayref->[0];
+ ( $total, $tot_amount, $tot_balance ) = @{$sth->fetchrow_arrayref};
@cust_bill = qsearch(
'cust_bill',
@@ -91,8 +93,7 @@ if ( $cgi->keywords ) {
}
#if ( scalar(@cust_bill) == 1 ) {
-if ( scalar(@cust_bill) == 1 && $total == 1) {
-#if ( $total == 1 ) {
+if ( $total == 1 ) {
my $invnum = $cust_bill[0]->invnum;
print $cgi->redirect(popurl(2). "view/cust_bill.cgi?$invnum"); #redirect
} elsif ( scalar(@cust_bill) == 0 ) {
@@ -159,8 +160,8 @@ END
);
my $pdate = time2str("%b %d %Y", $date);
- $tot_balance += $owed;
- $tot_amount += $charged;
+ #$tot_balance += $owed;
+ #$tot_amount += $charged;
my $rowspan = 1;