<?php
	//Connects to your Database
	include "../db_connection/db_connection.php";
	include "../config/config.php";		
	$page_id	=	base64_decode(base64_decode(base64_decode($_GET['page_id']))); //THIS IS PAGE ID  
	                  
if($page_id==1) 
{ 		
		//$hdes_name	=	$_POST['hdes_name'];
		$lob		=	$_POST['lob']; 
		$lob		= 	str_replace("/", "-", $lob);
		$lop = 1;		
		foreach($_POST['category'] as $cat_id)
		{
			$cam_wt = $_POST['cam_wt'][$cat_id];
					
			$INSRT_d	= "INSERT INTO cam_finishing(`design_det_id`,`cam_weight` , `finishing_date`,`to_rtv_load`, `post_dt`) VALUES('$cat_id','$cam_wt','$lob','no','$cur_time')";		
			$QURY_d		= mysqli_query($connect,$INSRT_d);		
			
			//THI IS FOR UPDATING THE DESIGN STATUS
			$UPDATE = "UPDATE design_det SET design_status = 'In CAM Receiving',update_dt = '$cur_time' WHERE design_det_id = '$cat_id'";
			$QRY    = mysqli_query($connect,$UPDATE); 
			
			//THI IS FOR UPDATING THE CAM LOADING STATUS
			$UPDATE_cd = "UPDATE cam_loading SET cam_status = 'yes',update_dt = '$cur_time' WHERE design_det_id = '$cat_id'";
			$QRY_cd    = mysqli_query($connect,$UPDATE_cd); 	
			
			$lop++;
		}
		
?>
		<script type="text/javascript">
            //alert("Data inserted successfully");
            //history.back();
            window.location='../cam_finishing_list.php';
        </script>
<?php
}
?>
	
