fix A/R report
[freeside.git] / httemplate / search / report_receivables.cgi
index 3696ed4..adbbc85 100755 (executable)
@@ -1,9 +1,9 @@
-<% include( 'elements/cust_main_dayranges.html',
-                 'title'       => 'Accounts Receivable Aging Summary',
+<& elements/cust_main_dayranges.html,
+                 'title'       => emt('Accounts Receivable Aging Summary'),
                  'range_sub'   => \&balance,
                  'payment_links' => 1,
-          )
-%>
+                 'email_checkboxes' => 1,
+&>
 <%init>
 
 die "access denied"
@@ -29,24 +29,12 @@ die "access denied"
 # )
 
 sub balance {
-  my($start, $end, $offset) = @_; #, %opt ?
-  #handle start and end ranges (86400 = 24h * 60m * 60s)
-  my $str2time = str2time_sql;
-  my $closing = str2time_sql_closing;
-
-  # $end == 0 means "+infinity", while $start == 0 really means 0
-  # so we should always include a start condition
-  $start = "( $str2time now() $closing - ". ($start + $offset) * 86400 . ' )';
-  # but only include an end condition if $end != 0
-  $end = $end ? 
-           "( $str2time now() $closing - ". ($end + $offset) * 86400 . ' )' 
-           : '';
-
-  #$opt{'unapplied_date'} = 1;
-
-  FS::cust_main->balance_date_sql( $start, $end, 'unapplied_date'=>1,
-           'cutoff' => "( $str2time now() $closing - ".$offset * 86400 . ')' );
+  my($start, $end, $cutoff) = @_; #, %opt ?
 
+  FS::cust_main->balance_date_sql( $start, $end, 
+        'cutoff' => $cutoff,
+        'unapplied_date'=>1,
+  );
 }
 
 </%once>