summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2015-10-09 00:05:25 -0700
committerMark Wells <mark@freeside.biz>2015-10-09 00:06:17 -0700
commitbdbda2196d839c13a25da3ec5569b93d121d10f3 (patch)
treeda75415f8b3d1aa42a18f5b6956fdb85220d376c
parentd1f18bfcf62f379dc28679481149be31eded4c9b (diff)
make credit date filtering work, #37088
-rw-r--r--httemplate/search/cust_bill_pkg.cgi7
-rw-r--r--httemplate/search/report_tax.cgi1
2 files changed, 6 insertions, 2 deletions
diff --git a/httemplate/search/cust_bill_pkg.cgi b/httemplate/search/cust_bill_pkg.cgi
index ec3785bbc..4ef13df4e 100644
--- a/httemplate/search/cust_bill_pkg.cgi
+++ b/httemplate/search/cust_bill_pkg.cgi
@@ -705,8 +705,11 @@ if ( $cgi->param('credit_begin') or $cgi->param('credit_end') ) {
"AND cust_credit_bill._date <= $cr_end";
}
-my $credit_sub = "SELECT SUM(amount) AS credit_amount, billpkgnum
- FROM cust_credit_bill_pkg $credit_where GROUP BY billpkgnum";
+my $credit_sub = "SELECT SUM(cust_credit_bill_pkg.amount) AS credit_amount, billpkgnum
+ FROM cust_credit_bill_pkg
+ JOIN cust_credit_bill USING (creditbillnum)
+ $credit_where
+ GROUP BY billpkgnum";
$join_pkg .= " LEFT JOIN ($credit_sub) AS item_credit
ON (cust_bill_pkg.billpkgnum = item_credit.billpkgnum)";
diff --git a/httemplate/search/report_tax.cgi b/httemplate/search/report_tax.cgi
index 04bdf12ad..9e625c80f 100644
--- a/httemplate/search/report_tax.cgi
+++ b/httemplate/search/report_tax.cgi
@@ -319,6 +319,7 @@ my $salescreditlink = $p. "search/cust_bill_pkg.cgi?$dateagentlink;nottax=1;cred
if ( $params{'credit_date'} eq 'cust_credit_bill' ) {
$salescreditlink =~ s/begin/credit_begin/;
$salescreditlink =~ s/end/credit_end/;
+ $saleslink .= ";credit_begin=$beginning;credit_end=$ending";
}
#my $creditlink = $p. "search/cust_bill_pkg.cgi?$dateagentlink;credit=1;istax=1";
#if ( $params{'credit_date'} eq 'cust_credit_bill' ) {