[freeside-commits] freeside/httemplate/search report_tax.cgi, 1.56, 1.57

Ivan,,, ivan at wavetail.420.am
Wed May 27 14:27:36 PDT 2009


Update of /home/cvs/cvsroot/freeside/httemplate/search
In directory wavetail.420.am:/tmp/cvs-serv7145

Modified Files:
	report_tax.cgi 
Log Message:
fix total line links on tax report when using report_group kludge? (possibly not in all corner cases), RT#5446

Index: report_tax.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/report_tax.cgi,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- report_tax.cgi	27 May 2009 17:18:36 -0000	1.56
+++ report_tax.cgi	27 May 2009 21:27:34 -0000	1.57
@@ -275,7 +275,6 @@
 
 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 @@
     $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 @@
 @regions = grep &{$group_test}($_), @regions
   if $group_op;
 
-#ordering
- at 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 @@
   $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
+ at 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,



More information about the freeside-commits mailing list