X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=httemplate%2Fsearch%2Freport_receivables.cgi;h=3696ed40d25bf9df4de55ab28a8106bb8a957e96;hb=7b125e587a4d1ee0aca692e23ea7897f671855ae;hp=fdd3779a983e2d0f521da586d0a31af4767a82cb;hpb=b717ff208f1593bc7d2021f17fbb63006e66e6ef;p=freeside.git diff --git a/httemplate/search/report_receivables.cgi b/httemplate/search/report_receivables.cgi index fdd3779a9..3696ed40d 100755 --- a/httemplate/search/report_receivables.cgi +++ b/httemplate/search/report_receivables.cgi @@ -1,19 +1,52 @@ - -<% +<% include( 'elements/cust_main_dayranges.html', + 'title' => 'Accounts Receivable Aging Summary', + 'range_sub' => \&balance, + 'payment_links' => 1, + ) +%> +<%init> -my $user = getotaker; +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Receivables report') + or $FS::CurrentUser::CurrentUser->access_right('Financial reports'); -print header('Current Receivables Report Results'); +%init> +<%once> -open (REPORT, "freeside-receivables-report -v $user |"); +#Example: +# +# my $balance = balance( +# $start, $end, $offset, +# '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) +# ) -print '
'; -while('; +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; -print ') { - print $_; -} -print '