- } elsif ( @tax_where or $cgi->param('taxable') ) {
-
- my $taxable = 'cust_bill_pkg.setup + cust_bill_pkg.recur '.
- '- COALESCE(item_exempt.exempt_amount, 0) '.
- '- COALESCE(item_credit.credit_amount, 0)';
-
- push @where, "(item_tax.billpkgnum IS NOT NULL OR item_exempt.billpkgnum IS NOT NULL)";
- push @select, "($taxable) AS taxable_amount";
- push @peritem, 'taxable_amount';
- push @peritem_desc, 'Taxable';
-
- if ( $cgi->param('taxable') ) {
- push @where, "($taxable) > 0";
- } else {
- push @total, 'SUM('.
- 'cust_bill_pkg.setup + cust_bill_pkg.recur '.
- '- COALESCE(item_credit.credit_amount, 0) )';
- push @total_desc, "$money_char%.2f net sales";
- }
+ } elsif ( @tax_where ) {
+ # union of taxable + all exempt_ cases
+ push @where,
+ '(item_tax.taxable_billpkgnum IS NOT NULL OR item_exempt.billpkgnum IS NOT NULL)';