
<?php
//product_name
//product_price
//cart_size
//product_amount
//cashier_name

include"config.php";
$sql="select * from cart where cashier_name='juma'";
$result=mysqli_query($conn,$sql);

$sql_z="select * from z_cache";
$result_z=mysqli_query($conn,$sql_z);
$row_z=mysqli_fetch_assoc($result_z);
$tim=time();
$dat=date("dmy");
$r=rand();
while($row=mysqli_fetch_assoc($result))
{
	$product_name=$row['product_name'];
	$product_id=$row['hidden'];
	$product_size=$row['cart_size'];
	$product_price=$row['product_price'];
	$product_bult_price=$row['product_price']* $product_size;
	$bei=$row['product_price'];
	$commision=$row['commision'];
	$customer_name=$_POST['customer_name'];
	$customer_tin=$_POST['customer_tin'];
	$customer_address=$_POST['customer_address'];
	$customer_tel=$_POST['customer_tel'];
	$machine_sn=$_POST['machine_sn'];
	$business_type=$_POST['business_type'];
	$payment_type=$_POST['payment_type'];
	$customer=
	
	$z_no=$row_z['z_no'];
	$receipt_no="$dat"."$z_no"."$r";
echo"$bei <br>";
$sql_t=" INSERT INTO sell (`sell_id`, `receipt_no`, `product_id`, `product_name`, `commision`, `product_size`, `product_bult_price`, `z_no`, `sell_date`, `customer_name`, `customer_tin`, `customer_address`, `customer_tel`, `machine_sn`, `business_type`, `payment_type`)
VALUES ('','1','2','$product_name','$commision','$product_size','$product_bult_price','$z_no','$sell_date','$customer_name','$customer_tin','$customer_address','$customer_tel','$machine_sn','$business_type','$payment_type')";	
$result_t=mysqli_query($conn,$sql_t);
$sql_del="delete from cart";
$result_t=mysqli_query($conn,$sql_del);
if($sql=true)
{
header("location:pos.php");
}
else
{
	echo"n";
}
}
//INSERT INTO `sell`(`sell_id`, `receipt_no`, `product_name`, `product_price`, `product_size`, `product_bult_price`, `z_no`, `sell_date`) VALUES 
//('$bei','$bei','$bei','$bei','$bei','$bei','$bei','$bei')
mysqli_close($conn);
?>
			  



