<?php
  include('session.php');
?>
		    <?php
include"config.php";
$product_name=$_POST['product_name'];
$product_price=$_POST['product_price'];
$purchase_price=$_POST['purchase_price'];
$cart_size=$_POST['cart_size'];
$product_id=$_POST['product_id'];
$commision=($product_price-$purchase_price)*$cart_size;
$cashier_name="juma";
$product_amount=$product_price * $cart_size;
//$sql="INSERT INTO `cart`(`cart_id`, `product_name`,`product_price`,`cart_size`,`product_amount`,`cashier_name`) VALUES ('','$product_name','$product_price','$product_amount','$cart_size','$product_amount','$cashier_name')";
$sql="INSERT INTO `cart`(`cart_id`, `product_name`, `product_id`, `product_price`, `cart_size`, `product_amount`, `cashier_name`,`commision`) VALUES ('','$product_name','$product_id','$product_price','$cart_size','$product_amount','$cashier_name','$commision')";
$sql_update="update product set product_size=product_size-$cart_size where product_id=$product_id";
$result=mysqli_query($conn,$sql);
$result1=mysqli_query($conn,$sql_update);
if($result=true)
{
	header("location:pos.php");
}
mysqli_close($conn);
?>