X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Fcust_bill.html;h=62f5f7afaa641787ca8c542fef320ae9908a32d2;hb=47e1a8203e1fa6695c93bcb48fe6eaf1214c7fa3;hp=bd302c64f3ed81f7be0a5a0eb4582b4109f9a48d;hpb=c647059d0f8490b89e10a7a4ba8e3f7e1c42994b;p=freeside.git diff --git a/httemplate/search/cust_bill.html b/httemplate/search/cust_bill.html index bd302c64f..62f5f7afa 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'); @@ -107,11 +131,12 @@ if ( $cgi->param('invnum') =~ /^\s*(FS-)?(\d+)\s*$/ ) { ($search{'days'}, my $field) = ($2, $3); $field = "_date" if $field eq 'date'; $search{'order_by'} = "cust_bill.$field"; + $search{'invoiced'} = 1; # preserve old behavior under 3.x } #scalars for (qw( agentnum custnum cust_status refnum invnum_min invnum_max - open net newest_percust + open net newest_percust invoiced )) {