diff options
| author | ivan <ivan> | 2009-05-27 21:27:34 +0000 | 
|---|---|---|
| committer | ivan <ivan> | 2009-05-27 21:27:34 +0000 | 
| commit | ad723cf8d003a2ef4b19adfa5f46ff78b2423cc7 (patch) | |
| tree | c6221303260e3a3ad19433379daa85ff5fb53da6 | |
| parent | 7fd91efd801b6b155d0945e3d628059600c0e227 (diff) | |
fix total line links on tax report when using report_group kludge? (possibly not in all corner cases), RT#5446
| -rwxr-xr-x | httemplate/search/report_tax.cgi | 34 | 
1 files changed, 18 insertions, 16 deletions
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,  | 
