X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Fcust_bill_pkg.cgi;h=42722b1a73d398aba54f47bf01a63b10ef5f34be;hb=c7286ce9036d71665c2bfed9de93f87309b72d35;hp=34c89e53271fc120ec78de2cabd737e3591a3951;hpb=a69f8a2b55163b5f0eac908918e46a3eb3bd2290;p=freeside.git diff --git a/httemplate/search/cust_bill_pkg.cgi b/httemplate/search/cust_bill_pkg.cgi index 34c89e532..42722b1a7 100644 --- a/httemplate/search/cust_bill_pkg.cgi +++ b/httemplate/search/cust_bill_pkg.cgi @@ -5,6 +5,8 @@ 'count_query' => $count_query, 'count_addl' => \@total_desc, 'header' => [ + @pkgnum_header, + emt('Pkg Def'), emt('Description'), @post_desc_header, @peritem_desc, @@ -15,9 +17,16 @@ FS::UI::Web::cust_header(), ], 'fields' => [ + @pkgnum, sub { $_[0]->pkgnum > 0 - ? $_[0]->get('pkg') # possibly use override.pkg - : $_[0]->get('itemdesc') # but i think this correct + # possibly use override.pkg but i think this correct + ? $_[0]->get('pkgpart') + : '' + }, + sub { $_[0]->pkgnum > 0 + # possibly use override.pkg but i think this correct + ? $_[0]->get('pkg') + : $_[0]->get('itemdesc') }, @post_desc, #strikethrough or "N/A ($amount)" or something these when @@ -30,6 +39,8 @@ \&FS::UI::Web::cust_fields, ], 'sort_fields' => [ + @pkgnum_null, + '', '', @post_desc_null, @peritem, @@ -39,7 +50,8 @@ #'credit_amount', ], 'links' => [ - #'', + @pkgnum_null, + '', '', @post_desc_null, @peritem_null, @@ -52,13 +64,15 @@ ), ], #'align' => 'rlrrrc'.FS::UI::Web::cust_aligns(), - 'align' => 'l'. + 'align' => $pkgnum_align. + 'rl'. $post_desc_align. $peritem_align. 'rcrr'. FS::UI::Web::cust_aligns(), 'color' => [ - #'', + @pkgnum_null, + '', '', @post_desc_null, @peritem_null, @@ -69,7 +83,8 @@ FS::UI::Web::cust_colors(), ], 'style' => [ - #'', + @pkgnum_null, + '', '', @post_desc_null, @peritem_null, @@ -105,6 +120,8 @@ Filtering parameters: - refnum: Filter on customer reference source. +- cust_classnum: Filter on customer class. + - classnum: Filter on package class. - use_override: Apply "classnum" and "taxclass" filtering based on the @@ -165,8 +182,9 @@ Filtering parameters: <%init> -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Financial reports'); +my $curuser = $FS::CurrentUser::CurrentUser; + +die "access denied" unless $curuser->access_right('Financial reports'); my $conf = new FS::Conf; my $money_char = $conf->config('money_char') || '$'; @@ -178,6 +196,18 @@ my @total_desc = ( '%d line items', $money_char.'%.2f total' ); # sprintf string my @peritem = ( 'setup', 'recur' ); my @peritem_desc = ( 'Setup charge', 'Recurring charge' ); +my @pkgnum_header = (); +my @pkgnum = (); +my @pkgnum_null; +my $pkgnum_align = ''; +if ( $curuser->option('show_pkgnum') ) { + push @select, 'cust_bill_pkg.pkgnum'; + push @pkgnum_header, 'Pkg Num'; + push @pkgnum, sub { $_[0]->pkgnum > 0 ? $_[0]->pkgnum : '' }; + push @pkgnum_null, ''; + $pkgnum_align .= 'r'; +} + my @post_desc_header = (); my @post_desc = (); my @post_desc_null = (); @@ -230,6 +260,13 @@ if ( $cgi->param('refnum') =~ /^(\d+)$/ ) { push @where, "cust_main.refnum = $1"; } +# cust_classnum +if ( $cgi->param('cust_classnum') ) { + my @classnums = grep /^\d+$/, $cgi->param('cust_classnum'); + push @where, 'cust_main.classnum IN('.join(',',@classnums).')' + if @classnums; +} + # custnum if ( $cgi->param('custnum') =~ /^(\d+)$/ ) { push @where, "cust_main.custnum = $1"; @@ -249,7 +286,7 @@ if ( $cgi->param('use_override') ) { )"; $part_pkg = 'override'; } -push @select, 'part_pkg.pkg'; # or should this use override? +push @select, 'part_pkg.pkgpart', 'part_pkg.pkg'; # or should this use override? # the non-tax case if ( $cgi->param('nottax') ) { @@ -452,7 +489,7 @@ if ( $cgi->param('nottax') ) { } elsif ( $cgi->param('out') ) { - $join_pkg = ' + $join_pkg .= ' LEFT JOIN cust_bill_pkg_tax_location USING (billpkgnum) '; push @where, 'cust_bill_pkg_tax_location.billpkgnum IS NULL'; @@ -463,7 +500,7 @@ if ( $cgi->param('nottax') ) { } else { # not locationtaxid or 'out'--the normal case - $join_pkg = ' + $join_pkg .= ' LEFT JOIN cust_bill_pkg_tax_location USING (billpkgnum) JOIN cust_main_county USING (taxnum) '; @@ -644,4 +681,5 @@ my $credit_link = [ "${p}search/cust_credit_bill_pkg.html?billpkgnum=", 'billpkg warn "\n\nQUERY:\n".Dumper($query)."\n\nCOUNT_QUERY:\n$count_query\n\n" if $cgi->param('debug'); +