param('days') =~ /^\s*(\d+)\s*$/ ) {
+ $days = $1;
+}
- my $sth = dbh->prepare($sql) or die dbh->errstr;
- $sth->execute or die $sth->errstr;
+#my $where = "where ". owed(0, 0, 'cust'=>1, 'noas'=>1). " > 0";
+my $where = "where ". owed($days, 0, 'cust'=>1, 'noas'=>1). " > 0";
- my $total_sth = dbh->prepare($total_sql) or die dbh->errstr;
- $total_sth->execute or die $total_sth->errstr;
+my $agentnum = '';
+if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
+ $agentnum = $1;
+ $where .= " AND agentnum = '$agentnum' ";
+}
-%>
-<%= header('Accounts Receivable Aging Summary', menubar( 'Main Menu'=>$p, ) ) %>
-<%= table() %>
-
- Customer |
- 0-30 |
- 30-60 |
- 60-90 |
- 90+ |
- Total |
-
-<% while ( my $row = $sth->fetchrow_hashref() ) { %>
-
-
- <%= $row->{'company'} ? $row->{'company'}. ' (' : '' %><%= $row->{'last'}. ', '. $row->{'first'} %><%= $row->{'company'} ? ')' : '' %>
- |
- $<%= sprintf("%.2f", $row->{'owed_0_30'} ) %> |
- $<%= sprintf("%.2f", $row->{'owed_30_60'} ) %> |
- $<%= sprintf("%.2f", $row->{'owed_60_90'} ) %> |
- $<%= sprintf("%.2f", $row->{'owed_90_plus'} ) %> |
- $<%= sprintf("%.2f", $row->{'owed_total'} ) %> |
-
-<% } %>
-<% my $row = $total_sth->fetchrow_hashref(); %>
-
- |
-
-
- Total |
- $<%= sprintf("%.2f", $row->{'owed_0_30'} ) %> |
- $<%= sprintf("%.2f", $row->{'owed_30_60'} ) %> |
- $<%= sprintf("%.2f", $row->{'owed_60_90'} ) %> |
- $<%= sprintf("%.2f", $row->{'owed_90_plus'} ) %> |
- $<%= sprintf("%.2f", $row->{'owed_total'} ) %> |
-
-
-