X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Fcust_tax_exempt_pkg.cgi;h=41b7b91928963d90b08048a699dd39c8c572daeb;hb=dde41fbab51d693dda80977a724ee722059d92f7;hp=40b9ed78fdc978045746f27015e0bf73b8aa0228;hpb=54a357b171aa44f9399b4c146acd2afd3b686075;p=freeside.git

diff --git a/httemplate/search/cust_tax_exempt_pkg.cgi b/httemplate/search/cust_tax_exempt_pkg.cgi
index 40b9ed78f..41b7b9192 100644
--- a/httemplate/search/cust_tax_exempt_pkg.cgi
+++ b/httemplate/search/cust_tax_exempt_pkg.cgi
@@ -118,6 +118,12 @@ if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
   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?
 
@@ -157,6 +163,10 @@ if ( $cgi->param('out') ) {
 
 }
 
+# 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)".