From e6493433aaa9cbf7675afb623c39af28b933f61a Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 6 Nov 2009 00:25:22 +0000 Subject: [PATCH] add "payment expiration before" to customer report, RT#6447 --- FS/FS/cust_main.pm | 21 +++++++++++++++++++ httemplate/search/cust_main.html | 2 +- httemplate/search/report_cust_main.html | 37 ++++++++++++++++++++++++++++++--- 3 files changed, 56 insertions(+), 4 deletions(-) diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 3080a1e6b..640877c4d 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -8148,6 +8148,10 @@ listref of start date, end date listref +=item paydate_year + +=item paydate_month + =item current_balance listref (list returned by FS::UI::Web::parse_lt_gt($cgi, 'current_balance')) @@ -8234,6 +8238,23 @@ sub search_sql { push @where, '( '. join(' OR ', map "cust_main.payby = '$_'", @payby). ' )'; } + ### + # paydate_year / paydate_month + ### + + if ( $params->{'paydate_year'} =~ /^(\d{4})$/ ) { + my $year = $1; + $params->{'paydate_month'} =~ /^(\d\d?)$/ + or die "paydate_year without paydate_month?"; + my $month = $1; + + push @where, + 'paydate IS NOT NULL', + "paydate != ''", + "CAST(paydate AS timestamp) < CAST('$year-$month-01' AS timestamp )" +; + } + ## # amounts ## diff --git a/httemplate/search/cust_main.html b/httemplate/search/cust_main.html index f098fd3a6..eddb08d18 100755 --- a/httemplate/search/cust_main.html +++ b/httemplate/search/cust_main.html @@ -45,7 +45,7 @@ my %search_hash = (); #scalars my @scalars = qw ( agentnum status cancelled_pkgs cust_fields flattened_pkgs custbatch - no_censustract + no_censustract paydate_year paydate_month ); for my $param ( @scalars ) { diff --git a/httemplate/search/report_cust_main.html b/httemplate/search/report_cust_main.html index f139d4bb5..a8583ea67 100755 --- a/httemplate/search/report_cust_main.html +++ b/httemplate/search/report_cust_main.html @@ -39,11 +39,42 @@ % } <% include( '/elements/tr-select-payby.html', - 'payby_type' => 'cust', - 'multiple' => 1, - 'curr_value' => { map { $_ => 1 } FS::payby->cust_payby }, + 'payby_type' => 'cust', + 'multiple' => 1, + 'all_selected' => 1, ) %> + + + Payment expiration before + + + / + + + + + <% include( '/elements/tr-input-lessthan_greaterthan.html', label => 'Current balance', -- 2.11.0