summaryrefslogtreecommitdiff
path: root/httemplate/search
diff options
context:
space:
mode:
authorivan <ivan>2009-11-16 03:55:27 +0000
committerivan <ivan>2009-11-16 03:55:27 +0000
commitdc1769764725866793b46bb5dca7b6d3578302e0 (patch)
tree48733186fd9a66350c965a0890e2d9f46c280916 /httemplate/search
parentde347c7577a31301fffae333ec3ce8f4e2864600 (diff)
add ability to search on ranges of charged, owed to adv. invoice report, RT#6407
Diffstat (limited to 'httemplate/search')
-rwxr-xr-xhttemplate/search/cust_bill.html33
-rw-r--r--httemplate/search/report_cust_bill.html15
2 files changed, 30 insertions, 18 deletions
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!<FORM NAME="${_}form">!,
- ( map qq!<INPUT TYPE="hidden" NAME="$_" VALUE="$search{$_}">!, keys %search ),
+ ( map { my $f = $_;
+ my @values = ref($search{$f}) ? @{ $search{$f} } : $search{$f};
+ map qq!<INPUT TYPE="hidden" NAME="$f" VALUE="$_">!, @values;
+ }
+ keys %search
+ ),
qq!</FORM>!
} 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',
+ )
+ %>
+
<TR>
<TD ALIGN="right"><INPUT TYPE="checkbox" NAME="open" VALUE="1" CHECKED></TD>
<TD>Show only open invoices</TD>
@@ -20,6 +34,7 @@
<TD ALIGN="right"><INPUT TYPE="checkbox" NAME="newest_percust" VALUE="1"></TD>
<TD>Show only the single most recent invoice per-customer</TD>
</TR>
+
</TABLE>
<BR>