5 include('includes/session.inc');
6 $title=_('Currency Debtor Balances');
7 include('includes/header.inc');
9 echo '<FONT SIZE=4><B>' . _('Debtors Balances By Currency Totals') . '</B></FONT>';
11 $sql = 'SELECT SUM(ovamount+ovgst+ovdiscount+ovfreight-alloc) AS currencybalance,
13 SUM((ovamount+ovgst+ovdiscount+ovfreight-alloc)/rate) AS localbalance
14 FROM debtortrans INNER JOIN debtorsmaster
15 ON debtortrans.debtorno=debtorsmaster.debtorno
16 WHERE (ovamount+ovgst+ovdiscount+ovfreight-alloc)<>0 GROUP BY currcode';
18 $result = DB_query($sql,$db);
25 while ($myrow=DB_fetch_array($result)){
27 echo '<TR><TD><FONT SIZE=4>' . _('Total Debtor Balances in') . ' </FONT></TD>
28 <TD><FONT SIZE=4>' . $myrow['currcode'] . '</FONT></TD>
29 <TD ALIGN=RIGHT><FONT SIZE=4>' . number_format($myrow['currencybalance'],2) . '</FONT></TD>
30 <TD><FONT SIZE=4> in ' . $_SESSION['CompanyRecord']['currencydefault'] . '</FONT></TD>
31 <TD ALIGN=RIGHT><FONT SIZE=4>' . number_format($myrow['localbalance'],2) . '</FONT></TD></TR>';
32 $LocalTotal +
= $myrow['localbalance'];
35 echo '<TR><TD COLSPAN=4><FONT SIZE=4>' . _('Total Balances in local currency') . ':</FONT></TD>
36 <TD ALIGN=RIGHT><FONT SIZE=4>' . number_format($LocalTotal,2) . '</FONT></TD></TR>';
40 include('includes/footer.inc');