From 469f31f261476205bc9cf2d59335b8c30aa5e016 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Thu, 20 Dec 2012 21:53:02 -0800 Subject: [PATCH] add pkgnum/pkgpart to line item report< RT#18676 --- httemplate/search/cust_bill_pkg.cgi | 47 ++++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/httemplate/search/cust_bill_pkg.cgi b/httemplate/search/cust_bill_pkg.cgi index 5f02588e9..11a5095b4 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, @@ -165,8 +180,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 +194,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 = (); @@ -249,7 +277,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') ) { @@ -644,4 +672,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'); + -- 2.11.0