Re: Need help
| From: | Strogg | Date: | Fri, 09 Apr 2004 15:38:55 +0000 |
| Subject: | Re: Need help | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-183002@lists.php.net to get a copy of this message | ||
This the script that is falling over.....
It calculates everything correct until the amount reaches £1,000, and then
it falls over and reads only the 1 before the comma, and then outputs the
price to be paid as £1.18 (£1 + the taxrate (0.175 rounded up))
<?
echo "<p>Order Processed at ";
echo date("H:i, jS F");
echo "<br>";
echo "<p>You ordered:";
echo "<br>";
echo $tyreqty." Tyres<br>";
echo $oilqty." Bottles of Oil<br>";
echo $sparkqty." Spark Plugs";
$totalqty = 0;
$totalamount = 0.00;
define("TYREPRICE", 100);
define("OILPRICE", 10);
define("SPARKPRICE", 5);
$totalqty = $tyreqty + $oilqty + $sparkqty;
$totalamount = $tyreqty * TYREPRICE
+ $oilqty * OILPRICE
+ $sparkqty * SPARKPRICE;
$totalamount = number_format($totalamount, 2);
echo "<br>\n";
echo "Items Ordered: ".$totalqty."<br>\n";
echo "Subtotal: £".$totalamount."<br>\n";
$taxrate = 0.175; //local tax rate in UK is 17.5%
$totalamount = $totalamount * (1 + $taxrate);
$totalamount = number_format($totalamount, 2);
echo "Total Including Tax: £".$totalamount."<br>\n";
?>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.655 / Virus Database: 420 - Release Date: 08/04/2004