<%init>
die "access denied"
- unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
+ unless $FS::CurrentUser::CurrentUser->access_right('Receivables report')
+ or $FS::CurrentUser::CurrentUser->access_right('Financial reports');
my @ranges = (
[ 0, 30 ],
push @where, "agentnum = $agentnum";
}
+#status (false laziness w/cust_main::search_sql
+
+#prospect active inactive suspended cancelled
+if ( grep { $cgi->param('status') eq $_ } FS::cust_main->statuses() ) {
+ my $method = $cgi->param('status'). '_sql';
+ #push @where, $class->$method();
+ push @where, FS::cust_main->$method();
+}
+
#here is the agent virtualization
push @where, $FS::CurrentUser::CurrentUser->agentnums_sql;
my $sql_query = {
'table' => 'cust_main',
'hashref' => {},
- 'select' => "*, $owed_cols, $packages_cols",
+ 'select' => join(',',
+ #'cust_main.*',
+ 'custnum',
+ $owed_cols,
+ $packages_cols,
+ FS::UI::Web::cust_sql_fields(),
+ ),
'extra_sql' => $where,
'order_by' => "order by coalesce(lower(company), ''), lower(last)",
};
$start = $start ? "( $str2time now() $closing - ".($start * 86400). ' )' : '';
$end = $end ? "( $str2time now() $closing - ".($end * 86400). ' )' : '';
- #$opt{'unapplied_date'} = 1;
+ $opt{'unapplied_date'} = 1;
( $opt{sum} ? 'SUM( ' : '' ).
FS::cust_main->balance_date_sql( $start, $end, %opt ).