[freeside-commits] freeside/httemplate/search report_tax.cgi, 1.54, 1.55

Ivan,,, ivan at wavetail.420.am
Mon May 25 19:48:46 PDT 2009


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

Modified Files:
	report_tax.cgi 
Log Message:
and also fix "tax invoiced" portion of total line when using config option for some basic tax grouping by name, RT#5446

Index: report_tax.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/report_tax.cgi,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- report_tax.cgi	26 May 2009 02:03:32 -0000	1.54
+++ report_tax.cgi	26 May 2009 02:48:44 -0000	1.55
@@ -460,6 +460,25 @@
   scalar_sql($r, \@taxparam, $sql );
 };
 
+#tax-report_groups filtering
+my($group_op, $group_value) = ( '', '' );
+if ( $cgi->param('report_group') =~ /^(=|!=) (.*)$/ ) {
+  ( $group_op, $group_value ) = ( $1, $2 );
+}
+my $group_test = sub {
+  my $label = shift;
+  return 1 unless $group_op; #in case we get called inadvertantly
+  if ( $label eq $out ) { #don't display "out of taxable region" in this case
+    0;
+  } elsif ( $group_op eq '=' ) {
+    $label =~ /^$group_value/;
+  } elsif ( $group_op eq '!=' ) {
+    $label !~ /^$group_value/;
+  } else {
+    die "guru meditation #00de: group_op $group_op\n";
+  }
+};
+
 my $tot_tax = 0;
 #foreach my $label ( keys %regions ) {
 foreach my $r ( qsearch(\%qsearch) ) {
@@ -467,6 +486,9 @@
   #warn join('-', map { $r->$_() } qw( country state county taxname ) )."\n";
 
   my $label = getlabel($r);
+  if ( $group_op ) {
+    next unless &{$group_test}($label);
+  }
 
   #my $fromwhere = $join_pkg. $where. " AND payby != 'COMP' ";
   #my @param = @base_param; 
@@ -503,21 +525,8 @@
 my @regions = keys %regions;
 
 #tax-report_groups filtering
-my($group_op, $group_value) = ( '', '' );
-if ( $cgi->param('report_group') =~ /^(=|!=) (.*)$/ ) {
-  ( $group_op, $group_value ) = ( $1, $2 );
-  @regions = grep {
-    if ( $_ eq $out ) { #don't display "out of taxable region" in this case
-      0;
-    } elsif ( $group_op eq '=' ) {
-      $_ =~ /^$group_value \(/;
-    } elsif ( $group_op eq '!=' ) {
-      $_ !~ /^$group_value \(/;
-    } else {
-      die "guru meditation #00de: group_op $group_op\n";
-    }
-  } @regions;
-}
+ at regions = grep &{$group_test}($_), @regions
+  if $group_op;
 
 #now calculate totals
 my( $total, $tot_taxable, $tot_owed ) = ( 0, 0, 0 );



More information about the freeside-commits mailing list