Can't get print alignment correct

this code works correctly except that the print table doesn’t align correctly and the totcharges doesn’t display the decimals. Can someone look at this and advise?

<?php
mysql_connect(localhost,root,"");
mysql_select_db(oodb) or die( "Unable to select database");
$query=" SELECT * FROM oocust WHERE payrec = 'R' AND pd = ' '";
$result=mysql_query($query);
$num=mysql_numrows($result);
echo date("m/d/Y") . "<br />";
echo "<font size=+2><b> Old Orchard Plumbing Invoices Due Report</font></b></b><br />";
echo "<table cellspacing=1 cellpadding=0 border=0>
<tr>
<th colspan=2></th>
<th align=left>order</th>
<th colspan=5></th>
<tr>
<th>Inv#</th>
<th>Customer</th>
<th align=left>date</th>
<th>days late</th>
<th align=right>Charges</th>
<th align=right>tax</th>
<th align=right>Owed</th>
<tr>
<TH colspan=11>=======================================================================</TH>
</tr>";
while($row = mysql_fetch_array($result))
{
// $charges=$row['charges'];
// $tax=$row['tax'];
// $amtdue=$row['amtdue'];
$totcharges = $totcharges + $row['charges'];
$tottax = $tottax + $row['tax'];
$totamtdue = $totamtdue + $row['amtdue'];
echo "<tr>";
echo "<td>" . $row['invnum'] . "</td>";
echo "<td>" . $row['bname'] . "</td>";
echo "<td>" . $row['dateord'] . "</td>";
echo "<td align=right>" . $row['dayslate'] . "</td>";
echo "<td align=right>" . $row['charges'] . "</td>";
echo "<td align=right>" . $row['tax'] . "</td>";
echo "<td align=right>" . $row['amtdue'] . "</td>";
echo "</tr>";
}
echo "</table>";
echo "<table cellspacing=1 cellpadding=0 border=0>
<tr>
<tr>
<TH colspan=11>=======================================================================</TH>
</tr>";
echo "<tr>";
echo "<td>Totals Due</td>";
echo "<td>.</td>";
echo "<td>.</td>";
echo "<td>.</td>";
echo "<td>.</td>";

echo "<td align=right>$totcharges</td>";
echo "<td align=right>$tottax</td>";
echo "<td align=right>$totamtdue</td>";
echo "</tr>";
echo "</table>";
mysql_close();
?>