[freeside-commits] freeside/httemplate/search cust_bill_pkg.cgi, 1.39, 1.40 report_newtax.cgi, 1.3, 1.4

Ivan,,, ivan at wavetail.420.am
Wed Feb 9 17:04:00 PST 2011


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

Modified Files:
	cust_bill_pkg.cgi report_newtax.cgi 
Log Message:
fix cch tax report for more than one cust_bill_pkg_tax_rate_location per line item, RT#11483

Index: cust_bill_pkg.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/cust_bill_pkg.cgi,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -w -d -r1.39 -r1.40
--- cust_bill_pkg.cgi	12 Nov 2010 19:57:25 -0000	1.39
+++ cust_bill_pkg.cgi	10 Feb 2011 01:03:58 -0000	1.40
@@ -463,7 +463,8 @@
 
 } else {
 
-  $count_query = "SELECT COUNT(*), ";
+  #$count_query = "SELECT COUNT(*), ";
+  $count_query = "SELECT COUNT(DISTINCT billpkgnum), ";
 
   if ( $use_usage eq 'recurring' ) {
     $count_query .= "SUM(setup + recur - usage)";
@@ -472,8 +473,13 @@
   } elsif ( $unearned ) {
     $count_query .= "SUM(cust_bill_pkg.recur)";
   } else {
+    if ( scalar( grep( /locationtaxid/, $cgi->param ) ) ||
+              $cgi->param('iscredit') eq 'rate') {
+      $count_query .= "SUM( COALESCE(amount, cust_bill_pkg.setup + cust_bill_pkg.recur))";
+    } else {
     $count_query .= "SUM(cust_bill_pkg.setup + cust_bill_pkg.recur)";
   }
+  }
 
   if ( $unearned ) {
 

Index: report_newtax.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/report_newtax.cgi,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -d -r1.3 -r1.4
--- report_newtax.cgi	26 Oct 2009 07:12:12 -0000	1.3
+++ report_newtax.cgi	10 Feb 2011 01:03:58 -0000	1.4
@@ -123,7 +123,7 @@
     my $taxwhere = "FROM cust_bill_pkg $addl_from $where AND payby != 'COMP' ".
       "AND ". join( ' AND ', map { "( $_ = ? OR ? = '' AND $_ IS NULL)" } @taxparam );
 
-    my $sql = "SELECT SUM(cust_bill_pkg.setup+cust_bill_pkg.recur) ".
+    my $sql = "SELECT SUM(COALESCE(amount, cust_bill_pkg.setup+cust_bill_pkg.recur)) ".
               " $taxwhere AND cust_bill_pkg.pkgnum = 0";
 
     my $x = scalar_sql($t, [ map { $_, $_ } @params ], $sql );



More information about the freeside-commits mailing list