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 /httemplate/search/cust_bill_pkg.cgi | |
parent | a8a4c0572d5b0335e06cdb3fd75226db956c007f (diff) |
option to count subpackages outside packages in sales report #5588
Diffstat (limited to 'httemplate/search/cust_bill_pkg.cgi')
-rw-r--r-- | httemplate/search/cust_bill_pkg.cgi | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/httemplate/search/cust_bill_pkg.cgi b/httemplate/search/cust_bill_pkg.cgi index 4a31611cd..8654585b4 100644 --- a/httemplate/search/cust_bill_pkg.cgi +++ b/httemplate/search/cust_bill_pkg.cgi @@ -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 @@ if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) { # 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 @@ my $join_pkg; 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'); |