X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Fcust_bill.html;h=017e8298fbfd4bf9eebe878dc80918719ebac90d;hb=e1675f79af01255e7bfa0e1ce8d55b25369ee047;hp=bd302c64f3ed81f7be0a5a0eb4582b4109f9a48d;hpb=c8be0008fa9f9d351c7b0276fbd2a22debe042d2;p=freeside.git diff --git a/httemplate/search/cust_bill.html b/httemplate/search/cust_bill.html index bd302c64f..017e8298f 100755 --- a/httemplate/search/cust_bill.html +++ b/httemplate/search/cust_bill.html @@ -1,61 +1,82 @@ <& elements/search.html, - 'title' => emt('Invoice Search Results'), - 'html_init' => $html_init, - 'menubar' => $menubar, - 'name' => 'invoices', - 'query' => $sql_query, - 'count_query' => $count_query, - 'count_addl' => $count_addl, - 'redirect' => $link, - 'header' => [ emt('Invoice #'), - emt('Balance'), - emt('Net Amount'), - emt('Gross Amount'), - emt('Date'), - FS::UI::Web::cust_header(), - ], - 'fields' => [ - 'display_invnum', - sub { sprintf($money_char.'%.2f', shift->get('owed') ) }, - sub { sprintf($money_char.'%.2f', shift->get('net') ) }, - sub { sprintf($money_char.'%.2f', shift->charged ) }, - sub { time2str('%b %d %Y', shift->_date ) }, - \&FS::UI::Web::cust_fields, - ], - 'sort_fields' => [ - 'COALESCE( agent_invid, invnum )', - FS::cust_bill->owed_sql, - FS::cust_bill->net_sql, - 'charged', - '_date', - ], - 'align' => 'rrrrl'.FS::UI::Web::cust_aligns(), - 'links' => [ - $link, - $link, - $link, - $link, - $link, - ( map { $_ ne 'Cust. Status' ? $clink : '' } - FS::UI::Web::cust_header() - ), - ], - 'color' => [ - '', - '', - '', - '', - '', - FS::UI::Web::cust_colors(), - ], - 'style' => [ - '', - '', - '', - '', - '', - FS::UI::Web::cust_styles(), - ], + 'title' => emt('Invoice Search Results'), + 'html_init' => $html_init, + 'menubar' => $menubar, + 'name' => 'invoices', + 'query' => $sql_query, + 'count_query' => $count_query, + 'count_addl' => $count_addl, + 'redirect' => $link, + 'header' => [ emt('Invoice #'), + emt($invoiced ? 'Charged' : 'Gross Amount'), + emt('Discount'), + emt('Credits'), + emt('Net Amount'), + emt('Balance'), + emt('Date'), + FS::UI::Web::cust_header(), + ], + 'fields' => [ + 'display_invnum', + $invoiced ? 'charged' : 'gross', + 'discounted', + 'credited', + 'net', + 'owed', + sub { time2str('%b %d %Y', shift->_date ) }, + \&FS::UI::Web::cust_fields, + ], + 'sort_fields' => [ + 'COALESCE( agent_invid, invnum )', + $invoiced ? 'charged' : 'gross', + 'discounted', + 'credited', + 'net', + 'owed', + '_date', + ], + 'format' => [ + '', + $money_char.'%.2f', + $money_char.'%.2f', + $money_char.'%.2f', + $money_char.'%.2f', + $money_char.'%.2f', + '', + ], + 'align' => 'rrrrrrl'.FS::UI::Web::cust_aligns(), + 'links' => [ + $link, + $link, + $link, + $link, + $link, + $link, + $link, + ( map { $_ ne 'Cust. Status' ? $clink : '' } + FS::UI::Web::cust_header() + ), + ], + 'color' => [ + '', + '', + '', + '', + '', + '', + '', + FS::UI::Web::cust_colors(), + ], + 'style' => [ + '', + '', + '', + '', + '', + '', + '', + FS::UI::Web::cust_styles(), + ], &> <%init> @@ -66,6 +87,9 @@ my( $count_query, $sql_query ); my $count_addl = ''; my %search = (); +# show invoiced amount (charged) instead of gross sales +my $invoiced = $cgi->param('invoiced') ? 1 : 0; + if ( $cgi->param('invnum') =~ /^\s*(FS-)?(\d+)\s*$/ ) { my $join_cust_main = FS::UI::Web::join_cust_main('cust_bill'); @@ -111,7 +135,7 @@ if ( $cgi->param('invnum') =~ /^\s*(FS-)?(\d+)\s*$/ ) { #scalars for (qw( agentnum custnum cust_status refnum invnum_min invnum_max - open net newest_percust + open net newest_percust invoiced )) { @@ -119,7 +143,7 @@ if ( $cgi->param('invnum') =~ /^\s*(FS-)?(\d+)\s*$/ ) { } #arrays - for my $param (qw( cust_classnum payby )) { + for my $param (qw( cust_classnum )) { $search{$param} = [ $cgi->param($param) ] if grep { $_ eq $param } $cgi->param; }