-<% include( 'elements/search.html',
+<& elements/search.html,
'title' => 'Tax exemptions',
'name' => 'tax exemptions',
'query' => $query,
'',
FS::UI::Web::cust_styles(),
],
- )
-%>
+&>
<%once>
my $join_cust = "
- JOIN cust_bill USING ( invnum )
- LEFT JOIN cust_main USING ( custnum )
-";
+ JOIN cust_bill USING ( invnum )" .
+ FS::UI::Web::join_cust_main('cust_bill', 'cust_pkg');
my $join_pkg = "
LEFT JOIN cust_pkg USING ( pkgnum )
my $join = "
JOIN cust_bill_pkg USING ( billpkgnum )
- $join_cust
$join_pkg
+ $join_cust
";
</%once>
push @where, "cust_main.custnum = $1";
}
+if ( $cgi->param('classnum') eq '0' ) {
+ push @where, "part_pkg.classnum IS NULL";
+} elsif ( $cgi->param('classnum') =~ /^(\d+)$/ ) {
+ push @where, "part_pkg.classnum = $1";
+}
+
if ( $cgi->param('out') ) {
# wtf? how would you ever get exemptions on a non-taxable package location?
}
+# no reason ever to show the negative exemptions created by credits.
+# they'll just confuse people.
+push @where, "creditbillpkgnum IS NULL";
+
my $where = scalar(@where) ? 'WHERE '.join(' AND ', @where) : '';
my $count_query = "SELECT COUNT(*), SUM(amount)".