From 116ae8901c51a8e491de6c69d3e55d65369166d5 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 17 Sep 2009 01:37:36 +0000 Subject: [PATCH] fix sales tax report w/part_pkg overrides, RT#6197 --- httemplate/search/cust_bill_pkg.cgi | 67 +++++++++++++++++++++---------------- 1 file changed, 38 insertions(+), 29 deletions(-) diff --git a/httemplate/search/cust_bill_pkg.cgi b/httemplate/search/cust_bill_pkg.cgi index 62954ea18..52f59de1e 100644 --- a/httemplate/search/cust_bill_pkg.cgi +++ b/httemplate/search/cust_bill_pkg.cgi @@ -119,36 +119,43 @@ if ( $cgi->param('classnum') =~ /^(\d+)$/ ) { } } -my $use_usage = $cgi->param('use_usage'); +if ( $cgi->param('taxclass') + && ! $cgi->param('istax') #no part_pkg.taxclass in this case + #(should we save a taxclass or a link to taxnum + # in cust_bill_pkg or something like + # cust_bill_pkg_tax_location?) + ) +{ + + #override taxclass when use_override is specified? probably + #if ( $use_override ) { + # + # push @where, + # ' ( '. join(' OR ', + # map { + # ' ( part_pkg.taxclass = '. dbh->quote($_). + # ' AND pkgpart_override IS NULL '. + # ' OR '. + # ' override.taxclass = '. dbh->quote($_). + # ' AND pkgpart_override IS NOT NULL '. + # ' ) ' + # } + # $cgi->param('taxclass') + # ). + # ' ) '; + # + #} else { + + push @where, + ' ( '. join(' OR ', + map ' part_pkg.taxclass = '.dbh->quote($_), + $cgi->param('taxclass') + ). + ' ) '; + + #} -push @where, ' ( '. join(' OR ', - map ' taxclass = '.dbh->quote($_), $cgi->param('taxclass') - ). - ' ) ' - if $cgi->param('taxclass') - && ! $cgi->param('istax'); #no part_pkg.taxclass in this case - #(should we save a taxclass or a link to taxnum - # in cust_bill_pkg or something like - # cust_bill_pkg_tax_location?) - -#sub _where { -# my $table = shift; -# my $prefix = @_ ? shift : ''; -# " -# ( cust_main_county.county = $table.${prefix}.county -# OR ( cust_main_county.county IS NULL AND $table.${prefix}.county = '' ) -# OR ( cust_main_county.county = '' AND $table.${prefix}.county IS NULL) -# OR ( cust_main_county.county IS NULL AND $table.${prefix}.county IS NULL) -# ) -# AND ( cust_main_county.state = $table.${prefix}.state -# OR ( cust_main_county.state IS NULL AND $table.${prefix}.state = '' ) -# OR ( cust_main_county.state = '' AND $table.${prefix}.state IS NULL ) -# OR ( cust_main_county.state IS NULL AND $table.${prefix}.state IS NULL ) -# ) -# AND cust_main_county.country = $table.${prefix}.country -# "; -# -#} +} if ( $cgi->param('out') ) { @@ -319,6 +326,8 @@ if ( $cgi->param('cust_tax') ) { push @where, $cust_exempt; } +my $use_usage = $cgi->param('use_usage'); + my $count_query; if ( $cgi->param('pkg_tax') ) { -- 2.11.0