[freeside-commits] freeside/httemplate/search cust_bill.html, 1.33, 1.34 report_cust_bill.html, 1.10, 1.11

Ivan,,, ivan at wavetail.420.am
Sun Nov 15 19:55:20 PST 2009


Update of /home/cvs/cvsroot/freeside/httemplate/search
In directory wavetail.420.am:/tmp/cvs-serv1551/httemplate/search

Modified Files:
	cust_bill.html report_cust_bill.html 
Log Message:
add ability to search on ranges of charged, owed to adv. invoice report, RT#6407

Index: report_cust_bill.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/report_cust_bill.html,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- report_cust_bill.html	10 Dec 2008 21:43:43 -0000	1.10
+++ report_cust_bill.html	16 Nov 2009 03:55:18 -0000	1.11
@@ -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>

Index: cust_bill.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/cust_bill.html,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- cust_bill.html	25 Oct 2009 00:29:27 -0000	1.33
+++ cust_bill.html	16 Nov 2009 03:55:18 -0000	1.34
@@ -85,24 +85,16 @@
 } 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;
@@ -111,9 +103,9 @@
     $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' );
@@ -188,7 +180,12 @@
            $_, #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_ ) ). 
 



More information about the freeside-commits mailing list