diff options
author | jeff <jeff> | 2009-08-19 06:15:14 +0000 |
---|---|---|
committer | jeff <jeff> | 2009-08-19 06:15:14 +0000 |
commit | 2e1d2a91264e8441bc31583be7352ae1b3c31bb8 (patch) | |
tree | 8dfcda6735d56064e96dcf8822f1dcb729a8b030 /FS | |
parent | a8a4c0572d5b0335e06cdb3fd75226db956c007f (diff) |
option to count subpackages outside packages in sales report #5588
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/Report/Table/Monthly.pm | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/FS/FS/Report/Table/Monthly.pm b/FS/FS/Report/Table/Monthly.pm index d75f0be79..d015f9116 100644 --- a/FS/FS/Report/Table/Monthly.pm +++ b/FS/FS/Report/Table/Monthly.pm @@ -311,11 +311,21 @@ sub cust_bill_pkg { 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 @@ sub cust_bill_pkg { 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) |