From: Adrian B. <ad...@sn...> - 2001-03-20 05:47:17
|
"Joe Ussia, Saved Online Inc" wrote: > > When doing the invoicing I noticed that we couldn't pull a report that gives > a > total outstanding A/R, without manually calculating it. > > Is there anyone who has created such a beast for SQL Ledger. What we want is > something that we can request at any > given time to run a aged A/R report (and for that matter if there is one for > A/P also.) > > Main reason: we want to see what is owing us at any given time, from day to > day. Easy, we just did it today, but for a different reason, GST. Here it is, changes to ca.cgi. I have also attached the new file. Very rough but seves the purpose. I someone would like to "pretty it up" feel free to do so. --------------------------------------------------------------------------------------------------- $sortroutine = $form->{sort}; ######## print it all out sorted by date first $total_debit = 0; $total_credit = 0; foreach $item (@transaction) { $debit = ($item->[4] < 0) ? sprintf("%.2f", -$item->[4]) : " "; $credit = ($item->[4] >= 0) ? sprintf("%.2f", $item->[4]) : " "; $total_debit = $total_debit + $debit; $total_credit = $total_credit + $credit; $total += $item->[4]; $balance = sprintf("%.2f", abs($total) ); $DRCR = ($item->[4] >= 0) ? $locale->text('CR') : $locale->text('DR'); $column_data{bydate} = qq|<td>$item->[0]</td>|; $column_data{bysource} = qq|<td>$item->[1]</td>|; $column_data{bycomment} = qq|<td>$item->[3]</td>|; print "<tr>"; map { print $column_data{$_} } split(/ +/, $column_index); print qq| <td align=right>$debit</td> <td align=right>$credit</td> <td align=right>$balance</td> <td>$DRCR</td> </tr>|; } print qq| </table><br> |; print "Total debit "; print qq| $total_debit <br> |; print " Total credit "; print qq| $total_credit |; print qq| </body> </html> |; } ------------------------------------------------------------------------------------------------------- Adrian -- Adrian Blake (MIEEE) Smart Radio Systems Pty Ltd 26b Bombala St, Cooma, NSW 2630, Australia Ph 61-2-64525555 Fax 61-2-64524317 |