X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Funapplied_cust_pay.html;h=73361c00b15000d9be6072ecdfe14e96e642c242;hb=7b125e587a4d1ee0aca692e23ea7897f671855ae;hp=35abd6bbc5220d48d375f1a1cf7e82e0c52779ca;hpb=0cc20c3d66e50d640422c2d587d97ddf7768493b;p=freeside.git diff --git a/httemplate/search/unapplied_cust_pay.html b/httemplate/search/unapplied_cust_pay.html index 35abd6bbc..73361c00b 100755 --- a/httemplate/search/unapplied_cust_pay.html +++ b/httemplate/search/unapplied_cust_pay.html @@ -2,7 +2,8 @@ #'title' => 'Prepaid Balance Aging Summary', #??? 'title' => 'Unapplied Payments Aging Summary', 'range_sub' => \&unapplied_payments, - ); + ) +%> <%init> die "access denied" @@ -11,35 +12,18 @@ die "access denied" <%once> -#Example: -# -# my $balance = balance( -# $start, $end, -# 'no_as' => 1, #set to true when using in a WHERE clause (supress AS clause) -# #or 0 / omit when using in a SELECT clause as a column -# # ("AS balance_$start_$end") -# 'sum' => 1, #set to true to get a SUM() of the values, for totals -# -# #obsolete? options for totals (passed to cust_main::balance_date_sql) -# 'total' => 1, #set to true to remove all customer comparison clauses -# 'join' => $join, #JOIN clause -# 'where' => \@where, #WHERE clause hashref (elements "AND"ed together) -# ) - -#sub balance { 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 = "( $str2time now() $closing - ".($start + $offset) * 86400 . ' )'; + $end = $end ? + "( $str2time now() $closing - ".($end + $offset) * 86400 . ' )' + : ''; -#XXX fill-in -# #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). ' )' : ''; -# -# #$opt{'unapplied_date'} = 1; -# -# FS::cust_main->balance_date_sql( $start, $end, %opt ). + FS::cust_main->unapplied_payments_date_sql( $start, $end ); }