X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Freport_receivables.cgi;h=06aea193aa9ad1aeeae49d34e740a769b588daa4;hb=5ea49c83c4a5b71a1e7baf2b6a75fe50816fdce5;hp=6b96ba7a533878ee3a17bcf2681c5f0eee6e2150;hpb=cefb9727ed4cdfacf3b967485d58b25fbea98c6b;p=freeside.git diff --git a/httemplate/search/report_receivables.cgi b/httemplate/search/report_receivables.cgi index 6b96ba7a5..06aea193a 100755 --- a/httemplate/search/report_receivables.cgi +++ b/httemplate/search/report_receivables.cgi @@ -1,28 +1,187 @@ -<% +<% include( 'elements/search.html', + 'title' => 'Accounts Receivable Aging Summary', + 'name' => 'customers', + 'query' => $sql_query, + 'count_query' => $count_sql, + 'header' => [ + FS::UI::Web::cust_header(), + '0-30', + '30-60', + '60-90', + '90+', + 'Total', + ], + 'footer' => [ + 'Total', + ( map '', + ( 1 .. + scalar(FS::UI::Web::cust_header()-1) + ) + ), + sprintf( $money_char.'%.2f', + $row->{'balance_0_30'} ), + sprintf( $money_char.'%.2f', + $row->{'balance_30_60'} ), + sprintf( $money_char.'%.2f', + $row->{'balance_60_90'} ), + sprintf( $money_char.'%.2f', + $row->{'balance_90_0'} ), + sprintf( ''. $money_char.'%.2f'. '', + $row->{'balance_0_0'} ), + ], + 'fields' => [ + \&FS::UI::Web::cust_fields, + format_balance('0_30'), + format_balance('30_60'), + format_balance('60_90'), + format_balance('90_0'), + format_balance('0_0'), + ], + 'links' => [ + ( map { $_ ne 'Cust. Status' ? $clink : '' } + FS::UI::Web::cust_header() + ), + '', + '', + '', + '', + '', + ], + #'align' => 'rlccrrrrr', + 'align' => FS::UI::Web::cust_aligns(). 'rrrrr', + #'size' => [ '', '', '-1', '-1', '', '', '', '', '', ], + #'style' => [ '', '', 'b', 'b', '', '', '', '', 'b', ], + 'size' => [ ( map '', FS::UI::Web::cust_header() ), + #'-1', '', '', '', '', '', ], + '', '', '', '', '', ], + 'style' => [ FS::UI::Web::cust_styles(), + #'b', '', '', '', '', 'b', ], + '', '', '', '', 'b', ], + 'color' => [ + FS::UI::Web::cust_colors(), + '', + '', + '', + '', + '', + ], -use strict; -use vars qw( $cgi $user ); -use CGI; -use CGI::Carp qw( fatalsToBrowser ); -use FS::UID qw( cgisuidsetup getotaker ); + ) +%> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Financial reports'); + +my @ranges = ( + [ 0, 30 ], + [ 30, 60 ], + [ 60, 90 ], + [ 90, 0 ], + [ 0, 0 ], +); + +my $owed_cols = join(',', map balance( @$_ ), @ranges ); -$cgi = new CGI; -&cgisuidsetup($cgi); +my $select_count_pkgs = FS::cust_main->select_count_pkgs_sql; -$user = getotaker; +my $active_sql = FS::cust_pkg->active_sql; +my $inactive_sql = FS::cust_pkg->inactive_sql; +my $suspended_sql = FS::cust_pkg->suspended_sql; +my $cancelled_sql = FS::cust_pkg->cancelled_sql; -print $cgi->header( '-expires' => '-2m' ), - header('Current Receivables Report Results'); +my $packages_cols = <param('all_customers') ) { + + my $days = 0; + if ( $cgi->param('days') =~ /^\s*(\d+)\s*$/ ) { + $days = $1; + } + + push @where, balance($days, 0, 'no_as'=>1). " > 0"; -print ''; -while() { - print $_; } -print ''; -print '
'; -while() { - print $_; } -print '