From: ivan Date: Wed, 27 May 2009 21:27:34 +0000 (+0000) Subject: fix total line links on tax report when using report_group kludge? (possibly not... X-Git-Tag: root_of_svc_elec_features~1172 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=ad723cf8d003a2ef4b19adfa5f46ff78b2423cc7 fix total line links on tax report when using report_group kludge? (possibly not in all corner cases), RT#5446 --- diff --git a/httemplate/search/report_tax.cgi b/httemplate/search/report_tax.cgi index 1d4d8d5ff..d17adb9aa 100755 --- a/httemplate/search/report_tax.cgi +++ b/httemplate/search/report_tax.cgi @@ -275,7 +275,6 @@ if ( $conf->exists('tax-pkg_address') ) { my $out = 'Out of taxable region(s)'; my %regions = (); -my %taxclasses = (); foreach my $r ( qsearch({ 'table' => 'cust_main_county', 'extra_sql' => $gotcust, @@ -301,7 +300,7 @@ foreach my $r ( qsearch({ 'table' => 'cust_main_county', $regions{$label}->{'url_param'} .= ';taxclass='. uri_escape($r->taxclass); #no, always# if $cgi->param('show_taxclasses'); - $taxclasses{$r->taxclass} = 1; + $regions{$label}->{'taxclass'} = $r->taxclass; } else { @@ -529,20 +528,10 @@ my @regions = keys %regions; @regions = grep &{$group_test}($_), @regions if $group_op; -#ordering -@regions = - map $regions{$_}, - sort { ( ($a eq $out) cmp ($b eq $out) ) || ($b cmp $a) } - @regions; - -my @base_regions = - map $base_regions{$_}, - sort { ( ($a eq $out) cmp ($b eq $out) ) || ($b cmp $a) } - keys %base_regions; - -#totals +#calculate totals my( $total, $tot_taxable, $tot_owed ) = ( 0, 0, 0 ); my( $exempt_cust, $exempt_pkg, $exempt_monthly ) = ( 0, 0, 0 ); +my %taxclasses = (); foreach (@regions) { $total += $regions{$_}->{'total'}; $tot_taxable += $regions{$_}->{'taxable'}; @@ -550,15 +539,28 @@ foreach (@regions) { $exempt_cust += $regions{$_}->{'exempt_cust'}; $exempt_pkg += $regions{$_}->{'exempt_pkg'}; $exempt_monthly += $regions{$_}->{'exempt_monthly'}; + $taxclasses{$regions{$_}->{'taxclass'}} = 1 + if $regions{$_}->{'taxclass'}; } my $total_url_param = ''; - if ( $group_op ) { $total_url_param = 'report_group='.uri_escape("$group_op $group_value").';'. - join(';', 'taxclass = '.dbh->quote($_), keys %taxclasses ); + join(';', 'taxclass='.dbh->quote($_), keys %taxclasses ); } +#ordering +@regions = + map $regions{$_}, + sort { ( ($a eq $out) cmp ($b eq $out) ) || ($b cmp $a) } + @regions; + +my @base_regions = + map $base_regions{$_}, + sort { ( ($a eq $out) cmp ($b eq $out) ) || ($b cmp $a) } + keys %base_regions; + +#add total line push @regions, { 'label' => 'Total', 'url_param' => $total_url_param,