From dc1769764725866793b46bb5dca7b6d3578302e0 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 16 Nov 2009 03:55:27 +0000 Subject: add ability to search on ranges of charged, owed to adv. invoice report, RT#6407 --- httemplate/search/cust_bill.html | 33 +++++++++++++++------------------ httemplate/search/report_cust_bill.html | 15 +++++++++++++++ 2 files changed, 30 insertions(+), 18 deletions(-) (limited to 'httemplate/search') diff --git a/httemplate/search/cust_bill.html b/httemplate/search/cust_bill.html index 6f440db7e..4ca3e2f78 100755 --- a/httemplate/search/cust_bill.html +++ b/httemplate/search/cust_bill.html @@ -83,24 +83,16 @@ if ( $cgi->param('invnum') =~ /^\s*(FS-)?(\d+)\s*$/ ) { } else { #some false laziness w/cust_bill::re_X - my @where; my $orderby = 'ORDER BY cust_bill._date'; - if ( $cgi->param('beginning') - && $cgi->param('beginning') =~ /^([ 0-9\-\/]{0,10})$/ ) { - $search{'begin'} = str2time($1); - } - if ( $cgi->param('ending') - && $cgi->param('ending') =~ /^([ 0-9\-\/]{0,10})$/ ) { - $search{'end'} = str2time($1) + 86399; + if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) { + $search{'agentnum'} = $1; } - if ( $cgi->param('begin') =~ /^(\d+)$/ ) { - $search{'begin'} = $1; - } - if ( $cgi->param('end') =~ /^(\d+)$/ ) { - $search{'end'} = $1; - } + # begin/end/beginning/ending + my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi, ''); + $search{'_date'} = [ $beginning, $ending ] + unless $beginning == 0 && $ending == 4294967295; if ( $cgi->param('invnum_min') =~ /^\s*(\d+)\s*$/ ) { $search{'invnum_min'} = $1; @@ -109,9 +101,9 @@ if ( $cgi->param('invnum') =~ /^\s*(FS-)?(\d+)\s*$/ ) { $search{'invnum_max'} = $1; } - if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) { - $search{'agentnum'} = $1; - } + #amounts + $search{$_} = [ FS::UI::Web::parse_lt_gt($cgi, $_) ] + foreach qw( charged owed ); $search{'open'} = 1 if $cgi->param('open'); $search{'net'} = 1 if $cgi->param('net' ); @@ -186,7 +178,12 @@ my $html_init = join("\n", map { $_, #key ), qq!
!, - ( map qq!!, keys %search ), + ( map { my $f = $_; + my @values = ref($search{$f}) ? @{ $search{$f} } : $search{$f}; + map qq!!, @values; + } + keys %search + ), qq!
! } qw( print_ email_ fax_ ftp_ spool_ ) ). diff --git a/httemplate/search/report_cust_bill.html b/httemplate/search/report_cust_bill.html index 96cf49263..00d566a62 100644 --- a/httemplate/search/report_cust_bill.html +++ b/httemplate/search/report_cust_bill.html @@ -11,7 +11,21 @@ 'disable_empty' => 0, ) %> + <% include( '/elements/tr-input-beginning_ending.html' ) %> + + <% include( '/elements/tr-input-lessthan_greaterthan.html', + label => 'Charged', + field => 'charged', + ) + %> + + <% include( '/elements/tr-input-lessthan_greaterthan.html', + label => 'Owed', + field => 'owed', + ) + %> + Show only open invoices @@ -20,6 +34,7 @@ Show only the single most recent invoice per-customer +
-- cgit v1.2.1