fix alignment on receivables report
[freeside.git] / httemplate / search / report_receivables.cgi
index af8e076..6e58938 100755 (executable)
@@ -61,7 +61,7 @@
                                     '',
                                   ],
                  #'align'       => 'rlccrrrrr',
-                 'align'       => $align,
+                 'align'       => FS::UI::Web::cust_aligns(). 'rrrrr',
                  #'size'        => [ '', '', '-1', '-1', '', '', '', '',  '', ],
                  #'style'       => [ '', '',  'b',  'b', '', '', '', '', 'b', ],
                  'size'        => [ ( map '', FS::UI::Web::cust_header() ),
 
              )
 %>
-<%init>
-
-die "access denied"
-  unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
+<%once>
 
 sub owed {
   my($start, $end, %opt) = @_;
@@ -140,6 +137,12 @@ END
 
 }
 
+</%once>
+<%init>
+
+die "access denied"
+  unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
+
 my @ranges = (
   [  0, 30 ],
   [ 30, 60 ],
@@ -165,7 +168,13 @@ my $packages_cols = <<END;
      ( $select_count_pkgs AND $cancelled_sql ) AS cancelled_pkgs
 END
 
-my $where = "where ". owed(0, 0, 'cust'=>1, 'noas'=>1). " > 0";
+my $days = 0;
+if ( $cgi->param('days') =~ /^\s*(\d+)\s*$/ ) {
+  $days = $1;
+}
+
+#my $where = "where ". owed(0, 0, 'cust'=>1, 'noas'=>1). " > 0";
+my $where = "where ". owed($days, 0, 'cust'=>1, 'noas'=>1). " > 0";
 
 my $agentnum = '';
 if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
@@ -195,11 +204,6 @@ my $row = $total_sth->fetchrow_hashref();
 my $conf = new FS::Conf;
 my $money_char = $conf->config('money_char') || '$';
 
-#my $align = join('', map { /#/ ? 'r' : 'l' } FS::UI::Web::cust_header() ).
-#           'crrrrr';
-my $align = FS::UI::Web::cust_aligns().
-           'rrrrr';
-
 my $clink = [ "${p}view/cust_main.cgi?", 'custnum' ];
 
 my $status_statuscol = sub {