I have a photo store that I purchased and have been making some changes. The software did not come with adding sales tax to the shopping cart. So I am building it. Here is what I get:
The total cost from the cart is $15.00
Sub Total: $15.00
Tax: (5.5%) $0.83 (This is the correct tax charge which is .825 it rounds up ok)
Shipping Free: $0.00
Total: $15.82 (This is not correct it doesn't round the tax up to .83)
My Code: (With comments)
<?
$total = $total + $price; [COLOR=Black]// ---- $total = $15.00[/COLOR]
$tax = $total * .055; [COLOR=Black]//------ Tax is .825[/COLOR]
}
?>
<? if($cart_rows > 0){ ?>
<tr>
<td align="right">
<table>
<?php
if($shipping){
echo "<tr><td><span><b>Sub Total: </td><td><font color=\"#ff0000\">" . $currency->sign . dollar2($total) . "</font></b></span></td></tr>";
//---This discplays the correct tax amount while rounding up
echo "<tr><td><span><b>Tax: (5.5%)</td><td> <font color=\"#ff0000\">" . $currency->sign . dollar2($tax) . "</font></b></span></td></tr>";
echo "<tr><td><span><b>Shipping: </td><td> <font color=\"#ff0000\">" . $currency->sign . dollar2($shipping) . "</font></b></span></td></tr>";
[COLOR=Black]//---This is where it computes the tax but doesn't round up.[/COLOR]
$total+= $tax;
$total+= $shipping;
} else {
echo "<tr><td><span><b>Sub Total: </td><td><font color=\"#ff0000\">" . $currency->sign . dollar2($total) . "</font></b></span></td></tr>";
//---This discplays the correct tax amount while rounding up echo "<tr><td><span><b>Tax: (5.5%)</td><td> <font color=\"#ff0000\">" . $currency->sign . dollar2($tax) . "</font></b></span></td></tr>";
echo "<tr><td><span><b>Shipping Free: </td><td> <font color=\"#ff0000\">" . $currency->sign . dollar2($shipping) . "</font></b></span></td></tr>";
[COLOR=Black]//---This is where it computes the tax but doesn't round up.[/COLOR]
$total+= $tax;
$total+= $shipping;
}
?>[/COLOR]
Please help...
Thanks in advance....