From afedae91da04b21f86e3dc97fa83e3391969a993 Mon Sep 17 00:00:00 2001 From: mark Date: Sat, 28 Aug 2010 00:18:28 +0000 Subject: [PATCH] Filter invoice report by payby, RT#9263 --- httemplate/search/cust_bill.html | 12 ++++++++++-- httemplate/search/report_cust_bill.html | 7 +++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/httemplate/search/cust_bill.html b/httemplate/search/cust_bill.html index 1e9ee8dcb..cf6ce4999 100755 --- a/httemplate/search/cust_bill.html +++ b/httemplate/search/cust_bill.html @@ -122,8 +122,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(', ', diff --git a/httemplate/search/report_cust_bill.html b/httemplate/search/report_cust_bill.html index 00d566a62..b1a252e6c 100644 --- a/httemplate/search/report_cust_bill.html +++ b/httemplate/search/report_cust_bill.html @@ -25,6 +25,13 @@ field => 'owed', ) %> + <% include( '/elements/tr-select-payby.html', + label => 'Payment method:', + payby_type => 'cust', + multiple => 1, + all_selected => 1, + ) + %> -- 2.11.0