+ # sum of tax paid
+ # this suffers from the same ambiguity as anything else that applies
+ # received payments to specific packages, but in reality the discrepancy
+ # should be minimal since people either pay their bill or don't.
+ # the join is on billpkgtaxlocationnum to avoid cross-producting.
+
+ my $paidfrom = $taxfrom .
+ ' JOIN cust_bill_pay_pkg'.
+ ' ON (cust_bill_pay_pkg.billpkgtaxlocationnum ='.
+ ' cust_bill_pkg_tax_location.billpkgtaxlocationnum)';
+
+ $sql{tax_paid} = "$select SUM(cust_bill_pay_pkg.amount)
+ $paidfrom
+ $where AND $istax
+ $group";
+
+ $all_sql{tax_paid} = "$select_all SUM(cust_bill_pay_pkg.amount)
+ $paidfrom
+ $where AND $istax
+ $group_all";
+