X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Fcust_bill.html;h=4e40fb06dbd0ebb8f8d82efd4b6bdc2fa7caddb4;hb=e92fa2f0535551a4e4cd92d10ccbcf930a5e5e62;hp=6db6006cb66c47529ecf822847bb2ded88897a18;hpb=cf49d3c860a2000cfc23a0e0db472a7d6fc58935;p=freeside.git diff --git a/httemplate/search/cust_bill.html b/httemplate/search/cust_bill.html index 6db6006cb..4e40fb06d 100755 --- a/httemplate/search/cust_bill.html +++ b/httemplate/search/cust_bill.html @@ -22,7 +22,14 @@ sub { time2str('%b %d %Y', shift->_date ) }, \&FS::UI::Web::cust_fields, ], - 'align' => 'rrrr'.FS::UI::Web::cust_aligns(), + '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, @@ -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(', ',