my order.php result
[center]enjoy the meal check your order below
50: CHICKEN MASALA for RS:5000
50: EGG OMLET for RS:2500
50: FISHFRY for RS:4750
50: ICECREAM for RS:4000
total bill amount excluding tax RS 16,250.00
total bill amount including tax RS 16.32 <==problem is here why i get two digit place after excluding 1000 total [/center]
below is my HTML code
[code]
Hotel | ||
food | Quantity | Cost |
Chicken Masala | 100 RS | |
Egg Omlet | 50 RS | |
Fish Fry | 95 RS | |
Ice Cream | 80 RS | |
note: above rates are for per quantity
0.5 service charge included on total amount
[/code]
[php]<?php
//getting food qty via post method
$chickenmasala = $_POST[‘chickenmasala’];
$eggomlet = $_POST[‘eggomlet’];
$fishfry = $_POST[‘fishfry’];
$icecream = $_POST[‘icecream’];
//calculating total quantity
$totalqty=$chickenmasala + $eggomlet + $fishfry + $icecream;
//giving rates each defend method
define(“CHICKENMASALA”, 100);
define(“EGGOMLET”, 50);
define(“FISHFRY”, 95);
define(“ICECREAM”,80);
//Total amount getting by multiplying each quantity
$totalamount=$chickenmasala * CHICKENMASALA + $eggomlet * EGGOMLET + $fishfry * FISHFRY + $icecream * ICECREAM ;
//each order cost for
$chickenprise = $chickenmasala * CHICKENMASALA ;
$eggomletprise = $eggomlet * EGGOMLET ;
$fishfryprise = $fishfry * FISHFRY ;
$icecreamprise = $icecream * ICECREAM ;
//total amount 2 decimal format
$totalamount = number_format($totalamount,2);
//if else if
if($totalqty == 0){
echo “you have not ordered any food”;
}else{
echo"enjoy the meal check your order below
";
if($chickenmasala > 0){
echo $chickenmasala. ": CHICKEN MASALA for RS:$chickenprise
";
}
if($eggomlet > 0){
echo $eggomlet. ": EGG OMLET for RS:$eggomletprise
";
}
if($fishfry > 0){
echo $fishfry. ": FISHFRY for RS:$fishfryprise
";
}
if($icecream > 0){
echo $icecream. ": ICECREAM for RS:$icecreamprise
";
}
echo "total bill amount excluding tax RS $totalamount <br />";
//tax rate
$taxrate[1]=0.5;
$taxrate[2]=100;
$taxrate[3]=$totalamount;
$totalamounttax = $taxrate[1]*$taxrate[3]/$taxrate[2];
$totalamount=$totalamount+$totalamounttax;
echo "total bill amount including tax RS $totalamount ";
}
?>[/php]