Location: PHPKode > projects > Pet Grooming Management System > pet/sale3.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>PGMS Sale 3</title>
</head>
<body onLoad = "window.print()">
<?php
$amount = $_POST['amount'];
$method = $_POST['method'];
$discount = $_POST['discount'];
/** Cash only **/
require ('header.inc');
echo'<center>';
require ('tax.inc.');
require ('invDesc.inc');
$iid = $_POST['iid'];
$numItems = count($iid);
require ('info.inc');
echo'<table>';
mysql_connect('localhost',$r,$p) or die("Could not connect to Host.");
mysql_select_db($d) or die("Could not select database.");
echo'<tr><th>SKU</th><th align = "left">Item</th><th>Price</th></tr>';
for ($i=0;$i<$numItems;$i++)
{
$query = "select * from items where iid = '$iid[$i]'";
$result = mysql_query($query) or die("Could not run query2.");
$num = mysql_num_rows($result);
 $row = mysql_fetch_array($result);
 $sku = $row['sku'];
 $item = $row['item'];
 $price = $row['price'];
 echo'<tr><td>'.$sku.'</td><td>'.$item.'</td><td style="text-align: right">'.number_format($price,2).'</td></tr>';
 $subTotal = $subTotal + $price;
}
$subTotal = $subTotal - $discount;
$subTax = $subTotal * tax($tax);
$salesTotal = $subTotal + $subTax;
echo'<tr><td colspan = "2" style="color: blue;">Subtotal</td><td style="color: blue; text-align: right">$'.number_format($subTotal,2).'</td></tr>';
if ($discount > 0){echo'<tr><td colspan = "2" >Discount</td><td style=" text-align: right">$'.number_format($discount,2).'</td></tr>';}
echo'<tr><td colspan = "2" style="color: green">Tax</td><td style="color: green; text-align: right">'.number_format($subTax,2).'</td></tr>';
echo'<tr><td colspan = "2" style="color: red">Total</td><td style="color: red; text-align: right">$'.number_format($salesTotal,2).'</td></tr>';
echo'<tr><td colspan = "2">Amount tendered: </td><td align = "right">$'.$amount.'</td></tr>';
$change = $amount - $salesTotal;
echo'<tr><td colspan = "2">Change Due</td><td>$'.number_format($change,2).'</td></tr>';
echo'</table>';
echo'</center>';
require ('footer.inc');
?>
</body>
</html>
Return current item: Pet Grooming Management System