projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
7c17ae7
)
hopefully fix tax report for taxclass & named tax edge cases
author
ivan
<ivan>
Mon, 25 Oct 2004 22:48:02 +0000
(22:48 +0000)
committer
ivan
<ivan>
Mon, 25 Oct 2004 22:48:02 +0000
(22:48 +0000)
httemplate/search/report_tax.cgi
patch
|
blob
|
history
diff --git
a/httemplate/search/report_tax.cgi
b/httemplate/search/report_tax.cgi
index
8b1c095
..
bb37621
100755
(executable)
--- a/
httemplate/search/report_tax.cgi
+++ b/
httemplate/search/report_tax.cgi
@@
-40,19
+40,29
@@
foreach my $r (
$label = $r->county." county, $label" if $r->county;
}
$label = $r->county." county, $label" if $r->county;
}
- my $
fromwhere
= "
- FROM cust_bill_pkg
- JOIN
cust_bill USING ( invnum )
- JOIN cust_main USING ( custnum )
- LEFT OUTER JOIN cust_pkg USING ( pkgnum )
- LEFT OUTER JOIN part_pkg USING ( pkgpart )
+ my $
join_pkg
= "
+ JOIN cust_pkg USING ( pkgnum )
+ JOIN
part_pkg USING ( pkgpart )
+ ";
+
+ my $where = "
WHERE _date >= $beginning AND _date <= $ending
AND ( county = ? OR ? = '' )
AND ( state = ? OR ? = '' )
AND ( country = ? )
AND payby != 'COMP'
";
WHERE _date >= $beginning AND _date <= $ending
AND ( county = ? OR ? = '' )
AND ( state = ? OR ? = '' )
AND ( country = ? )
AND payby != 'COMP'
";
- my @param = qw( county county state state country ); # taxclass);
+
+ my $taxwhere = my $fromwhere = "
+ FROM cust_bill_pkg
+ JOIN cust_bill USING ( invnum )
+ JOIN cust_main USING ( custnum )
+ ";
+
+ $fromwhere .= $join_pkg. $where;
+ $taxwhere .= $where;
+
+ my @taxparam = my @param = qw( county county state state country );
my $num_others =
scalar_sql( $r, [qw( country state state county county taxname taxname )],
my $num_others =
scalar_sql( $r, [qw( country state state county county taxname taxname )],
@@
-111,8
+121,8
@@
foreach my $r (
#match itemdesc if necessary!
my $named_tax = $r->taxname ? 'AND itemdesc = '. dbh->quote($r->taxname) : '';
#match itemdesc if necessary!
my $named_tax = $r->taxname ? 'AND itemdesc = '. dbh->quote($r->taxname) : '';
- my $x = scalar_sql($r, \@param,
- "SELECT SUM(cust_bill_pkg.setup+cust_bill_pkg.recur) $
from
where ".
+ my $x = scalar_sql($r, \@
tax
param,
+ "SELECT SUM(cust_bill_pkg.setup+cust_bill_pkg.recur) $
tax
where ".
"AND pkgnum = 0 $named_tax",
);
$tax += $x;
"AND pkgnum = 0 $named_tax",
);
$tax += $x;