From: ivan Date: Thu, 21 Jul 2011 23:33:12 +0000 (+0000) Subject: fix tax reports for taxclass+non-taxclass cases, RT#13160 X-Git-Tag: freeside_2_1_3~61 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=d1fa41850bf301ffd452a2649e147b928936ad97 fix tax reports for taxclass+non-taxclass cases, RT#13160 --- diff --git a/httemplate/search/cust_bill_pkg.cgi b/httemplate/search/cust_bill_pkg.cgi index 9918cf1a3..58856f387 100644 --- a/httemplate/search/cust_bill_pkg.cgi +++ b/httemplate/search/cust_bill_pkg.cgi @@ -75,6 +75,7 @@ \&FS::UI::Web::cust_fields, ], 'sort_fields' => [ + '', 'setup', #broken in $unearned case i guess ( $unearned ? ('', '') : () ), ( $use_usage eq 'recurring' ? 'recur - usage' : @@ -204,12 +205,9 @@ if ( $cgi->param('taxclass') # #} else { - push @where, - ' ( '. join(' OR ', - map ' part_pkg.taxclass = '.dbh->quote($_), - $cgi->param('taxclass') - ). - ' ) '; + push @where, ' part_pkg.taxclass IN ( '. + join(', ', map dbh->quote($_), $cgi->param('taxclass') ). + ' ) '; #} @@ -315,6 +313,7 @@ if ( $cgi->param('out') ) { die "unknown base region for empty taxclass" unless $cust_main_county; my $same_sql = $cust_main_county->sql_taxclass_sameregion; + $same_sql =~ s/taxclass/part_pkg.taxclass/g; push @where, $same_sql if $same_sql; } diff --git a/httemplate/search/report_tax.cgi b/httemplate/search/report_tax.cgi index 93e5b51c9..0cd652d83 100755 --- a/httemplate/search/report_tax.cgi +++ b/httemplate/search/report_tax.cgi @@ -366,12 +366,13 @@ foreach my $r ( qsearch({ 'table' => 'cust_main_county', } else { - $regions{$label}->{'url_param'} .= ';taxclassNULL=1' - if $cgi->param('show_taxclasses'); - my $same_sql = $r->sql_taxclass_sameregion; $mywhere .= " AND $same_sql" if $same_sql; + $regions{$label}->{'url_param'} .= ';taxclassNULL=1' + if $cgi->param('show_taxclasses') + || $same_sql; + } my $fromwhere = "$from_join_cust_pkg $mywhere"; # AND payby != 'COMP' ";