freeside/httemplate/search report_tax.cgi,1.5.4.3,1.5.4.4

ivan ivan at pouncequick.420.am
Fri Jun 11 07:57:35 PDT 2004


Update of /home/cvs/cvsroot/freeside/httemplate/search
In directory pouncequick:/tmp/cvs-serv7040

Modified Files:
      Tag: FREESIDE_1_4_BRANCH
	report_tax.cgi 
Log Message:
fix to find all customer scorrectly

Index: report_tax.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/report_tax.cgi,v
retrieving revision 1.5.4.3
retrieving revision 1.5.4.4
diff -u -d -r1.5.4.3 -r1.5.4.4
--- report_tax.cgi	11 Jun 2004 14:25:36 -0000	1.5.4.3
+++ report_tax.cgi	11 Jun 2004 14:57:33 -0000	1.5.4.4
@@ -34,7 +34,9 @@
       JOIN cust_bill USING ( invnum ) 
       JOIN cust_main USING ( custnum )
     WHERE _date >= $beginning AND _date <= $ending
-      AND county = ? AND state = ? AND country = ?
+      AND ( county  = ? OR ( ? = '' AND county  IS NULL ) )
+      AND ( state   = ? OR ( ? = '' AND state   IS NULL ) )
+      AND ( country = ? OR ( ? = '' AND country IS NULL ) )
   ";
   my $nottax = 'pkgnum != 0';
 
@@ -81,7 +83,7 @@
 
 #ordering
 my @regions = map $regions{$_},
-              sort { ( ($b eq $out) cmp ($a eq $out) ) || ($a cmp $b) }
+              sort { ( ($a eq $out) cmp ($b eq $out) ) || ($b cmp $a) }
               keys %regions;
 
 push @regions, {
@@ -100,7 +102,7 @@
 sub scalar_sql {
   my( $r, $sql ) = @_;
   my $sth = dbh->prepare($sql) or die dbh->errstr;
-  $sth->execute( map $r->$_(), qw( county state country ) )
+  $sth->execute( map $r->$_(), map { $_, $_ } qw( county state country ) )
     or die "Unexpected error executing statement $sql: ". $sth->errstr;
   $sth->fetchrow_arrayref->[0] || 0;
 }
@@ -124,11 +126,11 @@
   <% foreach my $region ( @regions ) { %>
     <TR>
       <TD><%= $region->{'label'} %></TD>
-      <TD ALIGN="right">$<%= $region->{'total'} %></TD>
-      <TD ALIGN="right">$<%= $region->{'exempt'} %></TD>
-      <TD ALIGN="right">$<%= $region->{'taxable'} %></TD>
+      <TD ALIGN="right">$<%= sprintf('%.2f', $region->{'total'} ) %></TD>
+      <TD ALIGN="right">$<%= sprintf('%.2f', $region->{'exempt'} ) %></TD>
+      <TD ALIGN="right">$<%= sprintf('%.2f', $region->{'taxable'} ) %></TD>
       <TD ALIGN="right"><%= $region->{'rate'} %></TD>
-      <TD ALIGN="right">$<%= $region->{'tax'} %></TD>
+      <TD ALIGN="right">$<%= sprintf('%.2f', $region->{'tax'} ) %></TD>
     </TR>
   <% } %>
 




More information about the freeside-commits mailing list