X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Fcust_bill.html;h=4e40fb06dbd0ebb8f8d82efd4b6bdc2fa7caddb4;hb=636dd1f25af52d35efe7a323a5765ff5adeadf83;hp=1e9ee8dcbf0ff0bc62cd8158612c1d3f1b54dd17;hpb=624b2d44625f69d71175c3348cae635d580c890b;p=freeside.git diff --git a/httemplate/search/cust_bill.html b/httemplate/search/cust_bill.html index 1e9ee8dcb..4e40fb06d 100755 --- a/httemplate/search/cust_bill.html +++ b/httemplate/search/cust_bill.html @@ -22,6 +22,13 @@ 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, @@ -122,8 +129,16 @@ if ( $cgi->param('invnum') =~ /^\s*(FS-)?(\d+)\s*$/ ) { $search{'newest_percust'} = 1; $count_query = "SELECT COUNT(DISTINCT cust_bill.custnum), 'N/A', 'N/A'"; } - - my $extra_sql = ' WHERE '. FS::cust_bill->search_sql_where( \%search ); + + my $payby_sql = ''; + $payby_sql = ' AND (' . + join(' OR ', map { "cust_main.payby = '$_'" } $cgi->param('payby') ) . + ')' + if $cgi->param('payby'); + + my $extra_sql = ' WHERE '. + FS::cust_bill->search_sql_where( \%search ). + $payby_sql; unless ( $count_query ) { $count_query = 'SELECT COUNT(*), '. join(', ',