RT#7266: continue fixing aging reports
[freeside.git] / httemplate / search / unapplied_cust_pay.html
index 8d064d1..161c650 100755 (executable)
@@ -13,15 +13,18 @@ die "access denied"
 <%once>
 
 sub unapplied_payments {
-  my($start, $end, %opt) = @_;
+  my($start, $end, $offset) = @_;
 
   #handle start and end ranges (86400 = 24h * 60m * 60s)
   my $str2time = str2time_sql;
   my $closing = str2time_sql_closing;
-  $start = $start ? "( $str2time now() $closing - ".($start * 86400). ' )' : '';
-  $end   = $end   ? "( $str2time now() $closing - ".($end   * 86400). ' )' : '';
+  $start = "( $str2time now() $closing - ".($start + $offset) * 86400 . ' )';
+  $end = $end ? 
+           "( $str2time now() $closing - ".($end   + $offset) * 86400 . ' )'
+           : '';
 
-  FS::cust_main->unapplied_payments_date_sql( $start, $end );
+  FS::cust_main->unapplied_payments_date_sql( $start, $end, 
+          'cutoff' => "( $str2time now() $closing - ".$offset * 86400 . ')'  );
 
 }