summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorjeff <jeff>2009-08-19 06:15:14 +0000
committerjeff <jeff>2009-08-19 06:15:14 +0000
commit2e1d2a91264e8441bc31583be7352ae1b3c31bb8 (patch)
tree8dfcda6735d56064e96dcf8822f1dcb729a8b030 /httemplate
parenta8a4c0572d5b0335e06cdb3fd75226db956c007f (diff)
option to count subpackages outside packages in sales report #5588
Diffstat (limited to 'httemplate')
-rw-r--r--httemplate/graph/cust_bill_pkg.cgi11
-rw-r--r--httemplate/graph/report_cust_bill_pkg.html5
-rw-r--r--httemplate/search/cust_bill_pkg.cgi23
3 files changed, 31 insertions, 8 deletions
diff --git a/httemplate/graph/cust_bill_pkg.cgi b/httemplate/graph/cust_bill_pkg.cgi
index b655f1f01..021189abb 100644
--- a/httemplate/graph/cust_bill_pkg.cgi
+++ b/httemplate/graph/cust_bill_pkg.cgi
@@ -68,6 +68,9 @@ if ( $cgi->param('classnum') =~ /^(\d*)$/ ) {
}
#eslaf
+my $use_override = 0;
+$use_override = 1 if ( $cgi->param('use_override') );
+
my $hue = 0;
#my $hue_increment = 170;
#my $hue_increment = 145;
@@ -104,11 +107,13 @@ foreach my $agent ( $sel_agent || qsearch('agent', { 'disabled' => '' } ) ) {
my $row_classnum = ref($pkg_class) ? $pkg_class->classnum : 0;
my $row_agentnum = $agent->agentnum;
- push @params, [ 'classnum' => $row_classnum,
- 'agentnum' => $row_agentnum,
+ push @params, [ 'classnum' => $row_classnum,
+ 'agentnum' => $row_agentnum,
+ 'use_override' => $use_override,
];
- push @links, "$link;agentnum=$row_agentnum;classnum=$row_classnum;";
+ push @links, "$link;agentnum=$row_agentnum;classnum=$row_classnum;".
+ "use_override=$use_override;";
@recur_colors = ($col_scheme->colors)[0,4,8,1,5,9]
unless @recur_colors;
diff --git a/httemplate/graph/report_cust_bill_pkg.html b/httemplate/graph/report_cust_bill_pkg.html
index 5193bf4a3..073f86773 100644
--- a/httemplate/graph/report_cust_bill_pkg.html
+++ b/httemplate/graph/report_cust_bill_pkg.html
@@ -25,6 +25,11 @@
</TR>
-->
+<TR>
+ <TD ALIGN="right"><INPUT TYPE="checkbox" NAME="use_override" VALUE="1"></TD>
+ <TD>Separate sub-packages from parents</TD>
+</TR>
+
</TABLE>
<BR><INPUT TYPE="submit" VALUE="Display">
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');