From 65acf1fd9746f1dd98e061044657c185367f7903 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Mon, 17 Dec 2012 13:44:39 -0800 Subject: [PATCH] add line item report, RT#18676 --- httemplate/search/cust_bill_pkg.cgi | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/httemplate/search/cust_bill_pkg.cgi b/httemplate/search/cust_bill_pkg.cgi index ed3444027..0c5fbd211 100644 --- a/httemplate/search/cust_bill_pkg.cgi +++ b/httemplate/search/cust_bill_pkg.cgi @@ -205,27 +205,27 @@ if ( $cgi->param('custnum') =~ /^(\d+)$/ ) { push @where, "cust_main.custnum = $1"; } +# then we want the package and its definition +$join_pkg = +' LEFT JOIN cust_pkg USING (pkgnum) + LEFT JOIN part_pkg USING (pkgpart)'; + +my $part_pkg = 'part_pkg'; +if ( $cgi->param('use_override') ) { + # still need the real part_pkg for tax applicability, + # so alias this one + $join_pkg .= " LEFT JOIN part_pkg AS override ON ( + COALESCE(cust_bill_pkg.pkgpart_override, cust_pkg.pkgpart, 0) = part_pkg.pkgpart + )"; + $part_pkg = 'override'; +} +push @select, 'part_pkg.pkg'; # or should this use override? + # the non-tax case if ( $cgi->param('nottax') ) { push @where, 'cust_bill_pkg.pkgnum > 0'; - # then we want the package and its definition - $join_pkg = -' LEFT JOIN cust_pkg USING (pkgnum) - LEFT JOIN part_pkg USING (pkgpart)'; - - my $part_pkg = 'part_pkg'; - if ( $cgi->param('use_override') ) { - # still need the real part_pkg for tax applicability, - # so alias this one - $join_pkg .= " LEFT JOIN part_pkg AS override ON ( - COALESCE(cust_bill_pkg.pkgpart_override, cust_pkg.pkgpart, 0) = part_pkg.pkgpart - )"; - $part_pkg = 'override'; - } - push @select, 'part_pkg.pkg'; # or should this use override? - my @tax_where; # will go into a subquery my @exempt_where; # will also go into a subquery -- 2.11.0