[freeside-commits] freeside/httemplate/search report_tax.cgi, 1.60, 1.61 cust_bill_pkg.cgi, 1.24, 1.25

Ivan,,, ivan at wavetail.420.am
Mon Jun 22 03:06:13 PDT 2009


Update of /home/cvs/cvsroot/freeside/httemplate/search
In directory wavetail.420.am:/tmp/cvs-serv23974/httemplate/search

Modified Files:
	report_tax.cgi cust_bill_pkg.cgi 
Log Message:
finish basic implemention of tax exemption by tax name hack, RT#5127

Index: report_tax.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/report_tax.cgi,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- report_tax.cgi	27 May 2009 22:23:44 -0000	1.60
+++ report_tax.cgi	22 Jun 2009 10:06:11 -0000	1.61
@@ -355,9 +355,25 @@
 #    );
 #  }
 
+  #false laziness -ish w/report_tax.cgi
+  my $cust_exempt;
+  if ( $r->taxname ) {
+    my $q_taxname = dbh->quote($r->taxname);
+    $cust_exempt =
+      "( tax = 'Y'
+         OR EXISTS ( SELECT 1 FROM cust_main_exemption
+                       WHERE cust_main_exemption.custnum = cust_main.custnum
+                         AND cust_main_exemption.taxname = $q_taxname
+                   )
+       )
+      ";
+  } else {
+    $cust_exempt = " tax = 'Y' ";
+  }
+
   my $x_cust = scalar_sql($r, \@param,
     "SELECT SUM(cust_bill_pkg.setup+cust_bill_pkg.recur)
-     $fromwhere AND $nottax AND tax = 'Y' "
+     $fromwhere AND $nottax AND $cust_exempt "
   );
 
   $regions{$label}->{'exempt_cust'} += $x_cust;

Index: cust_bill_pkg.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/cust_bill_pkg.cgi,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- cust_bill_pkg.cgi	27 May 2009 22:32:04 -0000	1.24
+++ cust_bill_pkg.cgi	22 Jun 2009 10:06:11 -0000	1.25
@@ -274,7 +274,24 @@
 push @where, 'cust_bill_pkg.pkgnum != 0' if $cgi->param('nottax');
 push @where, 'cust_bill_pkg.pkgnum  = 0' if $cgi->param('istax');
 
-push @where, " tax = 'Y' " if $cgi->param('cust_tax');
+if ( $cgi->param('cust_tax') ) {
+  #false laziness -ish w/report_tax.cgi
+  my $cust_exempt;
+  if ( $cgi->param('taxname') ) {
+    my $q_taxname = dbh->quote($cgi->param('taxname'));
+    $cust_exempt =
+      "( tax = 'Y'
+         OR EXISTS ( SELECT 1 FROM cust_main_exemption
+                       WHERE cust_main_exemption.custnum = cust_main.custnum
+                         AND cust_main_exemption.taxname = $q_taxname )
+       )
+      ";
+  } else {
+    $cust_exempt = " tax = 'Y' ";
+  }
+
+  push @where, $cust_exempt;
+}
 
 my $count_query;
 if ( $cgi->param('pkg_tax') ) {



More information about the freeside-commits mailing list