From: Ivan Kohler Date: Mon, 17 Dec 2012 21:44:48 +0000 (-0800) Subject: add line item report, RT#18676 X-Git-Url: http://git.freeside.biz/gitweb/?a=commitdiff_plain;h=0ed24da8397a00b70aa03fe8bc494aad5cbb1d0c;p=freeside.git add line item report, RT#18676 --- diff --git a/httemplate/search/cust_bill_pkg.cgi b/httemplate/search/cust_bill_pkg.cgi index 917ec8940..48c7684f3 100644 --- a/httemplate/search/cust_bill_pkg.cgi +++ b/httemplate/search/cust_bill_pkg.cgi @@ -552,12 +552,23 @@ if ( $cgi->param('pkg_tax') ) { $join_cust = ' JOIN cust_bill USING ( invnum ) LEFT JOIN cust_main USING ( custnum ) '; +# 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'; +#} + if ( $cgi->param('nottax') ) { - $join_pkg .= ' LEFT JOIN cust_pkg USING ( pkgnum ) - LEFT JOIN part_pkg USING ( pkgpart ) - LEFT JOIN part_pkg AS override - ON pkgpart_override = override.pkgpart '; $join_pkg .= ' LEFT JOIN cust_location USING ( locationnum ) ' if $conf->exists('tax-pkg_address');