[freeside-commits] freeside/FS/FS/Report/Table Monthly.pm, 1.15, 1.16

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


Update of /home/cvs/cvsroot/freeside/FS/FS/Report/Table
In directory wavetail.420.am:/tmp/cvs-serv16068/FS/FS/Report/Table

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

Index: Monthly.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Report/Table/Monthly.pm,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- Monthly.pm	30 Aug 2008 21:34:43 -0000	1.15
+++ Monthly.pm	19 Aug 2009 06:15:14 -0000	1.16
@@ -311,11 +311,21 @@
   my( $self, $speriod, $eperiod, $agentnum, %opt ) = @_;
 
   my $where = '';
+  my $comparison = '';
   if ( $opt{'classnum'} =~ /^(\d+)$/ ) {
     if ( $1 == 0 ) {
-      $where = "classnum IS NULL";
+      $comparison = "IS NULL";
     } else {
-      $where = "classnum = $1";
+      $comparison = "= $1";
+    }
+
+    if ( $opt{'use_override'} ) {
+      $where = "(
+        part_pkg.classnum $comparison AND pkgpart_override IS NULL OR
+        override.classnum $comparison AND pkgpart_override IS NOT NULL
+      )";
+    } else {
+      $where = "part_pkg.classnum $comparison";
     }
   }
 
@@ -328,6 +338,7 @@
         LEFT JOIN cust_main USING ( custnum )
         LEFT JOIN cust_pkg USING ( pkgnum )
         LEFT JOIN part_pkg USING ( pkgpart )
+        LEFT JOIN part_pkg AS override ON pkgpart_override = override.pkgpart
       WHERE pkgnum != 0
         AND $where
         AND ". $self->in_time_period_and_agent($speriod, $eperiod, $agentnum)



More information about the freeside-commits mailing list