[freeside-commits] freeside/httemplate/search cust_bill_pkg.cgi, 1.25, 1.26

Jeff Finucane,420,, jeff at wavetail.420.am
Tue Aug 18 23:15:16 PDT 2009


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

Modified Files:
	cust_bill_pkg.cgi 
Log Message:
option to count subpackages outside packages in sales report #5588

Index: cust_bill_pkg.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/cust_bill_pkg.cgi,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- cust_bill_pkg.cgi	22 Jun 2009 10:06:11 -0000	1.25
+++ cust_bill_pkg.cgi	19 Aug 2009 06:15:14 -0000	1.26
@@ -16,8 +16,8 @@
                  'fields'      => [
                    'billpkgnum',
                    sub { $_[0]->pkgnum > 0
-                           ? $_[0]->get('pkg')
-                           : $_[0]->get('itemdesc')
+                           ? $_[0]->get('pkg')      # possibly use override.pkg
+                           : $_[0]->get('itemdesc') # but i think this correct
                        },
                    #strikethrough or "N/A ($amount)" or something these when
                    # they're not applicable to pkg_tax search
@@ -87,11 +87,22 @@
 # not specified: all classes
 # 0: empty class
 # N: classnum
+my $use_override = $cgi->param('use_override');
 if ( $cgi->param('classnum') =~ /^(\d+)$/ ) {
+  my $comparison = '';
   if ( $1 == 0 ) {
-    push @where, "classnum IS NULL";
+    $comparison = "IS NULL";
   } else {
-    push @where, "classnum = $1";
+    $comparison = "= $1";
+  }
+
+  if ( $use_override ) {
+    push @where, "(
+      part_pkg.classnum $comparison AND pkgpart_override IS NULL OR
+      override.classnum $comparison AND pkgpart_override IS NOT NULL
+    )";
+  } else {
+    push @where, "part_pkg.classnum $comparison";
   }
 }
 
@@ -372,7 +383,9 @@
 if ( $cgi->param('nottax') ) {
 
   $join_pkg =  ' LEFT JOIN cust_pkg USING ( pkgnum )
-                 LEFT JOIN part_pkg USING ( pkgpart ) ';
+                 LEFT JOIN part_pkg USING ( pkgpart )
+                 LEFT JOIN part_pkg AS override
+                   ON pkgpart_override = override.pkgpart ';
   $join_pkg .= ' LEFT JOIN cust_location USING ( locationnum ) '
     if $conf->exists('tax-pkg_address');
 



More information about the freeside-commits mailing list