<?php 
session_start();
$id=$_SESSION['id'];
//$branch=2;	

include('../dist/includes/dbcon.php');

	$cid = $_POST['cid'];
	$cat = $_POST['cat'];
	$name = $_POST['prod_name'];
	$qty = $_POST['qty'];
	$thick = 0;
	$varko="";
	$da=1;
	$query33=mysqli_query($con,"select * from product where prod_id='$name'")or die(mysqli_error());
	$row33=mysqli_fetch_array($query33);
	
	if($cat == 1){
		$query2=mysqli_query($con,"select * from product where prod_id='$name'")or die(mysqli_error());
		$row2=mysqli_fetch_array($query2);
		$mythick=$row2['prod_price'];	
	}
	if($cat == 2){
	$query22=mysqli_query($con,"select * from product where prod_id='$name'")or die(mysqli_error());
		$row22=mysqli_fetch_array($query22);
		$mythick=$row22['prod_price1']?? null;	
	}
	if($cat == 3){
	$query23=mysqli_query($con,"select * from product where prod_id='$name'")or die(mysqli_error());
		$row23=mysqli_fetch_array($query23);
		$mythick=$row23['prod_price2'];	
	}
	$tara=$mythick * $da;
	$prod_desc=$row33['prod_desc'];
	$supplier_id=$row33['supplier_id'];
	$prod_color=$row33['prod_color'];
	$branch=$row33['branch_id'];
		$query55=mysqli_query($con,"select * from supplier where supplier_id='$supplier_id'")or die(mysqli_error());
		$row55=mysqli_fetch_array($query55);
		$radio=$row55['supplier_name'];
	mysqli_query($con,"INSERT INTO temp_trans(prod_id,cust_id,qty,price,branch_id,hh,ww,variation,color,thick,status) VALUES('$name','$cid','$qty','$tara','$branch','$da','$tara','$prod_desc','$varko','$radio','$prod_color')")or die(mysqli_error($con));
		
		echo "<script>document.location='hardwarecash_transaction.php?cid=$cid&cat=$cat'</script>";  		
	
?>