summaryrefslogtreecommitdiff
path: root/httemplate/graph
diff options
context:
space:
mode:
authorivan <ivan>2002-11-05 02:15:41 +0000
committerivan <ivan>2002-11-05 02:15:41 +0000
commit6e98f45f5fb306a76bef37c746a6eaf9c9184f88 (patch)
treebc6fe5ad0d56407091946a88d52a4c36476f9eab /httemplate/graph
parentbaaa14867224a536143b843ff33787f74d1c5032 (diff)
local kludge
Diffstat (limited to 'httemplate/graph')
-rwxr-xr-xhttemplate/graph/money_time-graph.cgi10
1 files changed, 9 insertions, 1 deletions
diff --git a/httemplate/graph/money_time-graph.cgi b/httemplate/graph/money_time-graph.cgi
index 93a80d165..32c2d89e3 100755
--- a/httemplate/graph/money_time-graph.cgi
+++ b/httemplate/graph/money_time-graph.cgi
@@ -57,7 +57,15 @@ while ( $syear < $eyear || ( $syear == $eyear && $smonth < $emonth ) ) {
$refunded_sth->execute or die $refunded_sth->errstr;
my $refunded = $refunded_sth->fetchrow_arrayref->[0] || 0;
- push @{$data{cash}}, $paid-$refunded;
+ #horrible local kludge that doesn't even really work right
+ my $expenses_sql = "SELECT SUM(cust_bill_pay.amount) FROM cust_bill_pay, cust_bill WHERE cust_bill_pay.invnum = cust_bill.invnum AND cust_bill_pay._date >= $speriod AND cust_bill_pay._date < $eperiod AND 0 < ( select count(*) from cust_bill_pkg, cust_pkg, part_pkg WHERE cust_bill.invnum = cust_bill_pkg.invnum AND cust_pkg.pkgnum = cust_bill_pkg.pkgnum AND cust_pkg.pkgpart = part_pkg.pkgpart AND LOWER(part_pkg.pkg) LIKE 'expense _%' )";
+
+# my $expenses_sql = "SELECT SUM(cust_bill_pay.amount) FROM cust_bill_pay, cust_bill_pkg, cust_bill, cust_pkg, part_pkg WHERE cust_bill_pay.invnum = cust_bill.invnum AND cust_bill.invnum = cust_bill_pkg.invnum AND cust_bill_pay._date >= $speriod AND cust_bill_pay._date < $eperiod AND cust_pkg.pkgnum = cust_bill_pkg.pkgnum AND cust_pkg.pkgpart = part_pkg.pkgpart AND LOWER(part_pkg.pkg) LIKE 'expense _%'";
+ my $expenses_sth = dbh->prepare($expenses_sql) or die dbh->errstr;
+ $expenses_sth->execute or die $expenses_sth->errstr;
+ my $expenses = $expenses_sth->fetchrow_arrayref->[0] || 0;
+
+ push @{$data{cash}}, $paid-$refunded-$expenses;
}