<?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
 	//cat_name,d_no,hdes_name,imgInp
	$ot=1;
$ot = isset($_POST['ot']) ? $_POST['ot'] : '1';
if($page_id==1) //this is for basic details add page
{
		//$PATH_photo	= "../design_images/";
		$PATH_photo2	= "../../design_images/";

		$cat_name	=	$_POST['cat_name'];
		//$sub_name	=	base64_decode(base64_decode(base64_decode(base64_decode($_POST['sub_cat_name'])))); 
		$d_no		=	$_POST['d_no'];
		$hdes_name	=	$_POST['hdes_name'];
		$ddate		=	$_POST['ddate'];
		$hdate		=	$_POST['hnd_date'];
		$cad_cat	=	$_POST['cad_cat'];
		$appr_wght	=	$_POST['appr_wght'];
		$ot 		=	$_POST['ot'];
		$ddate = str_replace("/", "-", $ddate);
		$hdate = str_replace("/", "-", $hdate);

	$SLCT = "SELECT * FROM design_det ORDER BY design_det_id ASC";
	//echo $SLCT;
	$QURY = mysqli_query($connect,$SLCT);
	if(mysqli_num_rows($QURY)> 0)
	{
		$SLCT_sk = "SELECT  MAX(design_det_id) as max_ids FROM design_det ORDER BY design_det_id ASC";
		$QURY_sk = mysqli_query($connect,$SLCT_sk);
		$FTCH_sk = mysqli_fetch_object($QURY_sk);
		$max_id = $FTCH_sk->max_ids + 1;

		$photo = substr($_FILES["imgInp"]["name"], strrpos($_FILES["imgInp"]["name"], '.') + 1);
		$photo = strtolower($photo);
		$pho_ext= "D.".$max_id.".".$photo;
	}
	else
	{
		$photo = substr($_FILES["imgInp"]["name"], strrpos($_FILES["imgInp"]["name"], '.') + 1);
		$photo = strtolower($photo);
		$pho_ext="D.1.".$photo;
		$max_id = 1;
	}

	if(is_uploaded_file($_FILES['imgInp']['tmp_name']))
	{
	$ext = strtolower($_FILES['imgInp']['type']);
	switch(strtolower($_FILES['imgInp']['type']))
	{
		case 'image/jpeg':
		  $image = imagecreatefromjpeg($_FILES['imgInp']['tmp_name']);
			break;
		case 'image/png':
		  $image = imagecreatefrompng($_FILES['imgInp']['tmp_name']);
			break;
		case 'image/gif':
		  $image = imagecreatefromgif($_FILES['imgInp']['tmp_name']);
			break;
		case 'image/bmp':
		  $image = imagecreatefromgif($_FILES['imgInp']['tmp_name']);
		default:
			//exit('Unsupported type: '.$_FILES[imgInp]['type'][$j]);
	}

	$old_width  = imagesx($image);
	$old_height = imagesy($image);
	// Target dimensions
	$size_width=array(60,200,600);
	$size_hieght=array(60,200,600);
	$prod_size=array('S','M','L');

	for($l=0;$l<3;$l++)
	{
		$max_width = $size_width[$l];
		$max_height = $size_hieght[$l];

		// Get current dimensions

		// Calculate the scaling we need to do to fit the image inside our frame
		$scale = min($max_width/$old_width, $max_height/$old_height);

		// Get the new dimensions
		$new_width  = ceil($scale*$old_width);
		$new_height = ceil($scale*$old_height);
		// Create new empty image
		$new = imagecreatetruecolor($new_width, $new_height);
		// Resize old image into new
		imagecolortransparent($new, imagecolorallocatealpha($new, 0, 0, 0, 127));
		imagealphablending($new, false);
		imagesavealpha($new, true);
		imagecopyresampled($new, $image,0, 0, 0, 0,$new_width, $new_height, $old_width, $old_height);

		// Catch the imagedata
		ob_start();
		//echo $ext;

			switch ($ext)
			{
				case 'image/gif':
					//imagegif($im, $fileName);
//imagegif($new,"$PATH_photo/$prod_size[$l].D.$max_id.gif", 90);
					imagegif($new,"$PATH_photo2/$prod_size[$l].D.$max_id.gif", 90);
					break;
				case 'image/jpg':
				case 'image/jpeg':
					//imagejpeg($im, $fileName, $quality);
//imagejpeg($new,"$PATH_photo/$prod_size[$l].D.$max_id.jpg", 90);
//imagejpeg($new,"$PATH_photo/$prod_size[$l].D.$max_id.jpeg", 90);
					imagejpeg($new,"$PATH_photo2/$prod_size[$l].D.$max_id.jpg", 90);
					imagejpeg($new,"$PATH_photo2/$prod_size[$l].D.$max_id.jpeg", 90);
					break;
				case 'image/png':
					//imagepng($im, $fileName);
					//imagepng($new,"$PATH_photo/$prod_size[$l].D.$max_id.png", 8);
					imagepng($new,"$PATH_photo2/$prod_size[$l].D.$max_id.png", 8);
					break;
				case 'image/bmp':
					//imagewbmp($im, $fileName);
//imagewbmp($new,"$PATH_photo/$prod_size[$l].D.$max_id.bmp", 90);
					imagewbmp($new,"$PATH_photo2/$prod_size[$l].D.$max_id.bmp", 90);
					break;
				default:
					break;
			}

		}

	}

		$INSRT = "INSERT INTO design_det(`master_cad_cat_id`, `master_cat_id`,  `emp_det_id`, `design_no`, `approximate_weight` ,`design_date`, `hand_design_date`, `imag_ext`, `post_dt`,`operation_type`) VALUES('$cad_cat', '$cat_name','$hdes_name','$d_no','$appr_wght','$ddate','$hdate','$pho_ext','$cur_time','$ot')";
		  $QURY = mysqli_query($connect,$INSRT);
		  $design_det_id = mysqli_insert_id($connect);
		  for($i=0;$i<count($_POST['sub_cat_name']);$i++){
			 $sub_name1 =	base64_decode(base64_decode(base64_decode(base64_decode($_POST['sub_cat_name'][$i])))); 
			 $INSRT1 = "INSERT INTO design_sub_cat(`design_det_id`,  `master_sub_cat_id`) VALUES('$design_det_id', '$sub_name1')";
			  $QURY1 = mysqli_query($connect,$INSRT1);
		  }
		  
		  for($j=0;$j<count($_POST['sel_party']);$j++){
			 $party_name =	base64_decode(base64_decode(base64_decode(base64_decode($_POST['sel_party'][$j])))); 
			 $INSRT2 = "INSERT INTO design_membership(`design_det_id`,  `party_id`) VALUES('$design_det_id', '$party_name')";
			 $QURY2 = mysqli_query($connect,$INSRT2);
		  }

		//$QURY = mysqli_query($connect,$INSRT);
		?>
		<script type="text/javascript">
            //alert("Data inserted successfully");
            //history.back();
           window.location='../design_add.php';
        </script>
<?php
}
else if($page_id==2) //this is for basic details list page	
{
	$design_id	= base64_decode(base64_decode(base64_decode($_GET['design_id'])));

	if($_GET['statu_s']=="active")
	{
		$UPDATE = "UPDATE design_det SET statu_s = 'inactive',update_dt = '$cur_time' WHERE design_det_id = '$design_id'";
		$QRY    = mysqli_query($connect,$UPDATE); 
	}
	else if($_GET['statu_s']=="inactive")
	{
		$UPDATE = "UPDATE design_det SET statu_s = 'active',update_dt = '$cur_time' WHERE design_det_id = '$design_id'";
		$QRY    = mysqli_query($connect,$UPDATE); 
	}
	?>
  			<script type="text/javascript">
    		//alert("Data inserted successfully");
    		//history.back();
   			window.location='../design_list1.php';
  			</script>
   <?php
}
else if($page_id==3) //this is for updating the design weight	
{
	$design_id	= base64_decode(base64_decode(base64_decode($_POST['design_id'])));
	//echo $design_id;
	$remark	=	$_POST['remark'];
	//echo $remark;
	if(isset($_POST['des_update']))
	{
		$SLCT = "SELECT * FROM design_det WHERE design_det_id='$design_id' AND up_status ='no'";
		$QURY = mysqli_query($connect,$SLCT);
		$FTCH = mysqli_fetch_object($QURY);

		$cur_date1 = explode('-',$cur_date);
	    $load_dat = $cur_date1[2].'-'.$cur_date1[1].'-'.$cur_date1[0];

		if($_POST['des_update']=="cad")
		{
			$no_of_tms = $FTCH->no_of_tm_alt + 1;

			$INSRT1		= "INSERT INTO design_det(`master_cat_id`, `emp_det_id`, `design_no`, `imag_ext`, `design_status`, `old_des_det_id`,`no_of_tm_alt`, `post_dt`) VALUES
			('$FTCH->master_cat_id','$FTCH->emp_det_id','$FTCH->design_no','$FTCH->imag_ext','In CAD Loading','$design_id','$no_of_tms','$cur_time')";	
			//echo	$INSRT1.'<br/>';
			$QURY1		= mysqli_query($connect,$INSRT1);

			$SLCT_des = "SELECT MAX(design_det_id) AS det_id FROM design_det";
			$QURY_des  = mysqli_query($connect,$SLCT_des );
			$FTCH_des  = mysqli_fetch_object($QURY_des );

			$INSRT2		= "INSERT INTO cad_loading(`design_det_id`, `loading_date`, `post_dt`) VALUES ('$FTCH_des->det_id','$load_dat','$cur_time')";
			$QURY2 = mysqli_query($connect,$INSRT2);

			$UPDATE = "UPDATE design_det SET design_status='Master Removed', up_status ='yes',no_of_tm_alt='$no_of_tms', update_dt = '$cur_time' WHERE design_det_id = '$design_id'";
			//echo	$UPDATE.'<br/>';
			$QRY = mysqli_query($connect,$UPDATE);
		}
		else if($_POST['des_update']=="wax")
		{
			//THIS IS FOR UPDATING THE TABLES WHICH ARE CONTAINING THE 
			$SLCT = "SELECT * FROM design_det WHERE design_det_id='$design_id' AND up_status ='no'";
			$QURY = mysqli_query($connect,$SLCT);
			$FTCH = mysqli_fetch_object($QURY);

			if($FTCH->design_status == 'In Master Finishing')
			{
				$UPDATE1 = "UPDATE wax_finishing SET `wax_remarks`='$remark',up_status ='yes', update_dt = '$cur_time' WHERE design_det_id='$design_id'";
				//echo	$UPDATE1.'<br/>';
				$QRY1 = mysqli_query($connect,$UPDATE1);

				$UPDATE2 = "UPDATE casting_finishing SET cas_remarks='$remark',up_status ='yes', update_dt = '$cur_time' WHERE design_det_id='$design_id'";
				//echo	$UPDATE2.'<br/>';
				$QRY2 = mysqli_query($connect,$UPDATE2);

				$UPDATE3 = "UPDATE sol_finishing_des SET `sol_fin_remark`='$remark',up_status ='yes', update_dt = '$cur_time' WHERE design_det_id='$design_id'";
				//echo	$UPDATE3.'<br/>';	
				$QRY3 = mysqli_query($connect,$UPDATE3);

				$UPDATE4 = "UPDATE buf_finishing_des SET `buf_fin_remark`='$remark',up_status ='yes', update_dt = '$cur_time' WHERE design_det_id='$design_id'";
				//echo	$UPDATE4.'<br/>';	
				$QRY4 = mysqli_query($connect,$UPDATE4);

				$UPDATE5 = "UPDATE mas_finishing SET `mas_fin_remark`='$remark',up_status ='yes', update_dt = '$cur_time' WHERE design_det_id='$design_id'";
				//echo	$UPDATE5.'<br/>';
				$QRY4 = mysqli_query($connect,$UPDATE5);
			}
			else if($FTCH->design_status == 'In Buffing Finishing')
			{
				$UPDATE1 = "UPDATE wax_finishing SET `wax_remarks`='$remark',up_status ='yes', update_dt = '$cur_time' WHERE design_det_id='$design_id'";
				//echo	$UPDATE1.'<br/>';
				$QRY1 = mysqli_query($connect,$UPDATE1);

				$UPDATE2 = "UPDATE casting_finishing SET cas_remarks='$remark',up_status ='yes', update_dt = '$cur_time' WHERE design_det_id='$design_id'";
				//echo	$UPDATE2.'<br/>';	
				$QRY2 = mysqli_query($connect,$UPDATE2);

				$UPDATE3 = "UPDATE sol_finishing_des SET `sol_fin_remark`='$remark',up_status ='yes', update_dt = '$cur_time' WHERE design_det_id='$design_id'";
				//echo	$UPDATE3.'<br/>';
				$QRY3 = mysqli_query($connect,$UPDATE3);

				$UPDATE4 = "UPDATE buf_finishing_des SET `buf_fin_remark`='$remark',up_status ='yes', update_dt = '$cur_time' WHERE design_det_id='$design_id'";
				//echo	$UPDATE4.'<br/>';
				$QRY4 = mysqli_query($connect,$UPDATE4);

			}
			else if($FTCH->design_status == 'In Soldering Finishing')
			{
				$UPDATE1 = "UPDATE wax_finishing SET `wax_remarks`='$remark',up_status ='yes', update_dt = '$cur_time' WHERE design_det_id='$design_id'";
				//echo	$UPDATE1.'<br/>';	
				$QRY1 = mysqli_query($connect,$UPDATE1);		

				$UPDATE2 = "UPDATE casting_finishing SET cas_remarks='$remark',up_status ='yes', update_dt = '$cur_time' WHERE design_det_id='$design_id'";
				//echo	$UPDATE2.'<br/>';
				$QRY2 = mysqli_query($connect,$UPDATE2);		

				$UPDATE3 = "UPDATE sol_finishing_des SET `sol_fin_remark`='$remark',up_status ='yes', update_dt = '$cur_time' WHERE design_det_id='$design_id'";
				//echo	$UPDATE3.'<br/>';
				$QRY3 = mysqli_query($connect,$UPDATE3);
			}
			else if($FTCH->design_status == 'In Casting Finishing')
			{
				$UPDATE1 = "UPDATE wax_finishing SET `wax_remarks`='$remark',up_status ='yes', update_dt = '$cur_time' WHERE design_det_id='$design_id'";
				//echo	$UPDATE1.'<br/>';
				$QRY1 = mysqli_query($connect,$UPDATE1);		

				$UPDATE2 = "UPDATE casting_finishing SET cas_remarks='$remark',up_status ='yes', update_dt = '$cur_time' WHERE design_det_id='$design_id'";
				//echo	$UPDATE2.'<br/>';
				$QRY2 = mysqli_query($connect,$UPDATE2);		

			}
			else if($FTCH->design_status == 'In WAX Finishing')
			{
				$UPDATE1 = "UPDATE wax_finishing SET `wax_remarks`='$remark',up_status ='yes', update_dt = '$cur_time' WHERE design_det_id='$design_id'";
				//echo	$UPDATE1.'<br/>';
				$QRY1 = mysqli_query($connect,$UPDATE1);
			}

			$SLCTr = "SELECT * FROM rtv_finishing_des WHERE design_det_id='$design_id' AND up_status ='no'";
			$QURYr = mysqli_query($connect,$SLCTr);
			$FTCHr = mysqli_fetch_object($QURYr);

			$no_of_tms = $FTCH->no_of_tm_alt + 1;

			$INSRT_d = "INSERT INTO rtv_finishing_des(`rtv_finishing_id`, `design_det_id`,`new_entry_alt`,`no_of_tm_alt`, `post_dt`) VALUES('$FTCHr->rtv_finishing_id','$FTCH->design_det_id','yes','$no_of_tms','$cur_time')";
			//echo $INSRT_d;
			$QURY_d = mysqli_query($connect,$INSRT_d);

			$UPDATE1 = "UPDATE design_det SET design_status='In RTV Finishing', update_dt = '$cur_time' WHERE design_det_id = '$design_id' AND up_status ='no'";
			//echo $UPDATE1 .'<br/>';
			$QRY1 = mysqli_query($connect,$UPDATE1);

			$UPDATE = "UPDATE rtv_finishing_des SET `rtv-fin_remark`='$remark',up_status ='yes',no_of_tm_alt='$no_of_tms', update_dt = '$cur_time' WHERE rtv_finishing_des_id = '$FTCHr->rtv_finishing_des_id'";
			//echo $UPDATE;
			$QRY    = mysqli_query($connect,$UPDATE);
		}
	}
	else
	{
		if(isset($_POST['wet_up']))
		{
			$wet_up = $_POST['wet_up'];

			$UPDATE = "UPDATE mas_finishing SET `mas_fin_remark`='$remark',mas_weight = '$wet_up',update_dt = '$cur_time' WHERE design_det_id = '$design_id'";
			$QRY    = mysqli_query($connect,$UPDATE); 
		}

		if(isset($_POST['sub_cat_name']))
		{
			$cat_id = base64_decode(base64_decode(base64_decode(base64_decode($_POST['sub_cat_name']))));

			$UPDATE = "UPDATE design_det SET `master_sub_category_id`='$cat_id' ,update_dt = '$cur_time' WHERE design_det_id = '$design_id'";
			$QRY    = mysqli_query($connect,$UPDATE); 
		}
		if(isset($_POST['cad_cat']) && $_POST['cad_cat']!='')
		{
			$SLCT = "SELECT * FROM design_det WHERE design_det_id='$design_id'";
			$QURY = mysqli_query($connect,$SLCT);
			$FTCH = mysqli_fetch_object($QURY);

			$cad_cat = $_POST['cad_cat'];

			if($FTCH->master_cad_cat_id!=$cad_cat)
			{
				$INSRT_d = "INSERT INTO des_cad_cat_log(`design_det_id`, `master_cad_cat_id`, `post_dt`) VALUES('$FTCH->design_det_id','$FTCH->master_cad_cat_id','$cur_time')";
				$QURY_d		= mysqli_query($connect,$INSRT_d);

				$UPDATE = "UPDATE design_det SET `master_cad_cat_id`='$cad_cat' WHERE design_det_id = '$design_id'";
				$QRY    = mysqli_query($connect,$UPDATE); 
			}
		}
	}
	?>
  			<script type="text/javascript">
				window.location='../design_list2.php';
   				<?php /*?>window.location='../design_view.php?design_id=<?php echo $_POST['design_id'] ?>';<?php */?>
  			</script>
   <?php
}
if($page_id==4) //this is for basic details cat add page
{
		$page_cat_id = $_POST['page_cat_id'];
		$ot=$_POST['ot'];
		if($page_cat_id==1)
		{
			//$PATH_photo	= "../mas_fin_images/";
			$PATH_photo2	= "../../mas_fin_images/";
		}
		else
		{
			//$PATH_photo	= "../cad_fin_images/";
			$PATH_photo2	= "../../cad_fin_images/";
		}

	$design_no = $_POST['design_no'];

	$SLCT="SELECT * FROM design_det WHERE design_det_id='$design_no'";
	//echo $SLCT;
	$QURY = mysqli_query($connect,$SLCT);
	$FTCH = mysqli_fetch_object($QURY);

	if($page_cat_id==1)
	{
		$photo = substr($_FILES["imgInp"]["name"], strrpos($_FILES["imgInp"]["name"], '.') + 1);
		$photo = strtolower($photo);
		$pho_ext="MF.".$design_no.".".$photo;
	}
	else
	{
		$photo = substr($_FILES["imgInp"]["name"], strrpos($_FILES["imgInp"]["name"], '.') + 1);
		$photo = strtolower($photo);
		$pho_ext="CF.".$design_no.".".$photo;
	}

	if(is_uploaded_file($_FILES['imgInp']['tmp_name']))
	{
		$ext = strtolower($_FILES['imgInp']['type']);
		switch(strtolower($_FILES['imgInp']['type']))
		{
			case 'image/jpeg':
				$image = imagecreatefromjpeg($_FILES['imgInp']['tmp_name']);
				break;
			case 'image/png':
				$image = imagecreatefrompng($_FILES['imgInp']['tmp_name']);
				break;
			case 'image/gif':
				$image = imagecreatefromgif($_FILES['imgInp']['tmp_name']);
				break;
			case 'image/bmp':
				$image = imagecreatefromgif($_FILES['imgInp']['tmp_name']);
			default:
				//exit('Unsupported type: '.$_FILES[imgInp]['type'][$j]);
		}
		$old_width  = imagesx($image);
		$old_height = imagesy($image);
		// Target dimensions
		$size_width=array(60,200,600);
		$size_hieght=array(60,200,600);
		$prod_size=array('S','M','L');

		for($l=0;$l<3;$l++)
		{
			$max_width = $size_width[$l];
			$max_height = $size_hieght[$l];

			// Get current dimensions

			// Calculate the scaling we need to do to fit the image inside our frame
		   $scale = min($max_width/$old_width, $max_height/$old_height);

			// Get the new dimensions
			$new_width  = ceil($scale*$old_width);
			$new_height = ceil($scale*$old_height);
			// Create new empty image
			$new = imagecreatetruecolor($new_width, $new_height);
			// Resize old image into new
			imagecolortransparent($new, imagecolorallocatealpha($new, 0, 0, 0, 127));
			imagealphablending($new, false);
			imagesavealpha($new, true);
			imagecopyresampled($new, $image,0, 0, 0, 0,$new_width, $new_height, $old_width, $old_height);

			// Catch the imagedata
			ob_start();
			//echo $ext;
			if($page_cat_id==1)
			{
				switch ($ext)
				{
					case 'image/gif':
						//imagegif($im, $fileName);
//imagegif($new,"$PATH_photo/$prod_size[$l].MF.$design_no.gif", 90);
						imagegif($new,"$PATH_photo2/$prod_size[$l].MF.$design_no.gif", 90);
						break;
					case 'image/jpg':
					case 'image/jpeg':
						//imagejpeg($im, $fileName, $quality);
//imagejpeg($new,"$PATH_photo/$prod_size[$l].MF.$design_no.jpg", 90);
//imagejpeg($new,"$PATH_photo/$prod_size[$l].MF.$design_no.jpeg", 90);
						imagejpeg($new,"$PATH_photo2/$prod_size[$l].MF.$design_no.jpg", 90);
						imagejpeg($new,"$PATH_photo2/$prod_size[$l].MF.$design_no.jpeg", 90);
						break;
					case 'image/png':
						//imagepng($im, $fileName);
//imagepng($new,"$PATH_photo/$prod_size[$l].MF.$design_no.png", 8);
						imagepng($new,"$PATH_photo2/$prod_size[$l].MF.$design_no.png", 8);
						break;
					case 'image/bmp':
						//imagewbmp($im, $fileName);
//imagewbmp($new,"$PATH_photo/$prod_size[$l].MF.$design_no.bmp", 90);
						imagewbmp($new,"$PATH_photo2/$prod_size[$l].MF.$design_no.bmp", 90);
						break;
					default:
						break;
				}
			}
			else
			{
				switch ($ext)
				{
					case 'image/gif':
						//imagegif($im, $fileName);
//imagegif($new,"$PATH_photo/$prod_size[$l].CF.$design_no.gif", 90);
						imagegif($new,"$PATH_photo2/$prod_size[$l].CF.$design_no.gif", 90);
						break;
					case 'image/jpg':
					case 'image/jpeg':
						//imagejpeg($im, $fileName, $quality);
//imagejpeg($new,"$PATH_photo/$prod_size[$l].CF.$design_no.jpg", 90);
//imagejpeg($new,"$PATH_photo/$prod_size[$l].CF.$design_no.jpeg", 90);
						imagejpeg($new,"$PATH_photo2/$prod_size[$l].CF.$design_no.jpg", 90);
						imagejpeg($new,"$PATH_photo2/$prod_size[$l].CF.$design_no.jpeg", 90);
						break;
					case 'image/png':
						//imagepng($im, $fileName);
//imagepng($new,"$PATH_photo/$prod_size[$l].CF.$design_no.png", 8);
						imagepng($new,"$PATH_photo2/$prod_size[$l].CF.$design_no.png", 8);
						break;
					case 'image/bmp':
						//imagewbmp($im, $fileName);
//imagewbmp($new,"$PATH_photo/$prod_size[$l].CF.$design_no.bmp", 90);
						imagewbmp($new,"$PATH_photo2/$prod_size[$l].CF.$design_no.bmp", 90);
						break;
					default:
						break;
				}
			}
		}
	}

	if($page_cat_id==1)
	{
		$UPDATE = "UPDATE design_det SET mas_fin_ext ='$pho_ext', update_dt = '$cur_time' WHERE design_det_id = '$design_no' and operation_type='$ot'";
		$QRY = mysqli_query($connect,$UPDATE);		
	}
	else
	{
		$UPDATE = "UPDATE design_det SET cad_fin_ext ='$pho_ext', update_dt = '$cur_time' WHERE design_det_id = '$design_no' and operation_type='$ot'";
		$QRY = mysqli_query($connect,$UPDATE);
	}
?>
	<script type="text/javascript">
        //alert("Data inserted successfully");
        //history.back();
        window.location ='../design_list.php?ot=<?php echo $ot;?>';
    </script>
<?php
}
?>

