summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorivan <ivan>2004-06-11 14:57:33 +0000
committerivan <ivan>2004-06-11 14:57:33 +0000
commitc267c8720955c9af057343ba81c3f97e37568479 (patch)
tree396b47eca7b751be7fe0eb188f97ae0bf4913b0c /httemplate
parent1fe8df8a5f82fd8d9ec016c9ade222a8eb632ce2 (diff)
fix to find all customer scorrectly
Diffstat (limited to 'httemplate')
-rwxr-xr-xhttemplate/search/report_tax.cgi16
1 files changed, 9 insertions, 7 deletions
diff --git a/httemplate/search/report_tax.cgi b/httemplate/search/report_tax.cgi
index 2e7bbcf9a..8184a4f1a 100755
--- a/httemplate/search/report_tax.cgi
+++ b/httemplate/search/report_tax.cgi
@@ -34,7 +34,9 @@ foreach my $r ( qsearch('cust_main_county', {}) ) {
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 @@ foreach my $r ( qsearch('cust_main_county', {}) ) {
#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 @@ push @regions, {
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 @@ sub scalar_sql {
<% 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>
<% } %>