diff options
author | ivan <ivan> | 2005-05-18 16:55:23 +0000 |
---|---|---|
committer | ivan <ivan> | 2005-05-18 16:55:23 +0000 |
commit | 2f3390c76813f42a5456730f58a5fcb69d320bde (patch) | |
tree | fe89a270392ecf8f8f01660b78417b15b8502f00 | |
parent | c24401f157aacd24a98c8f72772ac2855b50df8c (diff) |
add agent-specific A/R aging report, closes: bug#1229
-rwxr-xr-x | httemplate/browse/agent.cgi | 2 | ||||
-rwxr-xr-x | httemplate/search/report_receivables.cgi | 10 |
2 files changed, 12 insertions, 0 deletions
diff --git a/httemplate/browse/agent.cgi b/httemplate/browse/agent.cgi index d8c74d1fe..f118552ee 100755 --- a/httemplate/browse/agent.cgi +++ b/httemplate/browse/agent.cgi @@ -97,6 +97,8 @@ foreach my $agent ( sort { <TD> <A HREF="<%= $p %>search/report_cust_pay.html?agentnum=<%= $agent->agentnum %>">Payments</A> <BR><A HREF="<%= $p %>search/report_cust_credit.html?agentnum=<%= $agent->agentnum %>">Credits</A> + <BR><A HREF="<%= $p %>search/report_receivables.html?agentnum=<%= $agent->agentnum %>">A/R Aging</A> + <!--<BR><A HREF="<%= $p %>search/money_time.cgi?agentnum=<%= $agent->agentnum %>">Sales/Credits/Receipts</A>--> </TD> diff --git a/httemplate/search/report_receivables.cgi b/httemplate/search/report_receivables.cgi index 4c835fb7a..77e1d4a36 100755 --- a/httemplate/search/report_receivables.cgi +++ b/httemplate/search/report_receivables.cgi @@ -91,6 +91,12 @@ where 0 < ) END + my $agentnum = ''; + if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) { + $agentnum = $1; + $where .= " AND agentnum = '$agentnum' "; + } + my $count_sql = "select count(*) from cust_main $where"; my $sql_query = { @@ -100,6 +106,10 @@ END 'extra_sql' => "$where order by coalesce(lower(company), ''), lower(last)", }; + if ( $agentnum ) { + $owed_cols =~ + s/cust_bill\.custnum/cust_bill.custnum AND cust_main.agentnum = '$agentnum'/g; + } my $total_sql = "select $owed_cols"; my $total_sth = dbh->prepare($total_sql) or die dbh->errstr; $total_sth->execute or die $total_sth->errstr; |