summaryrefslogtreecommitdiff
path: root/httemplate/search/cust_bill_pkg.cgi
diff options
context:
space:
mode:
authorivan <ivan>2011-02-10 01:03:59 +0000
committerivan <ivan>2011-02-10 01:03:59 +0000
commit428faf8a60752ea3d571edc876dd83ebc6875a3c (patch)
treed5d7cd0b3ca309a82259a7349e306952b33b90f9 /httemplate/search/cust_bill_pkg.cgi
parent6b10752baaf502c7cad8c777c1d2ef4e96168161 (diff)
fix cch tax report for more than one cust_bill_pkg_tax_rate_location per line item, RT#11483
Diffstat (limited to 'httemplate/search/cust_bill_pkg.cgi')
-rw-r--r--httemplate/search/cust_bill_pkg.cgi10
1 files changed, 8 insertions, 2 deletions
diff --git a/httemplate/search/cust_bill_pkg.cgi b/httemplate/search/cust_bill_pkg.cgi
index 96de75ba5..b9743049d 100644
--- a/httemplate/search/cust_bill_pkg.cgi
+++ b/httemplate/search/cust_bill_pkg.cgi
@@ -463,7 +463,8 @@ if ( $cgi->param('pkg_tax') ) {
} else {
- $count_query = "SELECT COUNT(*), ";
+ #$count_query = "SELECT COUNT(*), ";
+ $count_query = "SELECT COUNT(DISTINCT billpkgnum), ";
if ( $use_usage eq 'recurring' ) {
$count_query .= "SUM(setup + recur - usage)";
@@ -472,7 +473,12 @@ if ( $cgi->param('pkg_tax') ) {
} elsif ( $unearned ) {
$count_query .= "SUM(cust_bill_pkg.recur)";
} else {
- $count_query .= "SUM(cust_bill_pkg.setup + cust_bill_pkg.recur)";
+ if ( scalar( grep( /locationtaxid/, $cgi->param ) ) ||
+ $cgi->param('iscredit') eq 'rate') {
+ $count_query .= "SUM( COALESCE(amount, cust_bill_pkg.setup + cust_bill_pkg.recur))";
+ } else {
+ $count_query .= "SUM(cust_bill_pkg.setup + cust_bill_pkg.recur)";
+ }
}
if ( $unearned ) {