<?php ob_start(); session_start(); ?>
<?php
include "layouts/db_connect.php";
session_start('ERP');
		 if(isset($_SESSION['code'])) {
	  $code = $_SESSION['code'];
	  $scode = $_SESSION['code'];
	   $mfin = $_SESSION['mfin'];
		$staff = $_SESSION['name'];
		 $postt = $_SESSION['postt'];
	}
	
$idd = $_GET['idd'];
$sql = mysqli_query($conn, "select * from otherentry where id ='$idd'");
$row2 = mysqli_fetch_array($sql);
$hpl = $row2['hpl'];
$mfin = $row2['mfin'];
$typp = $row2['result'];
if($typp =='Seized') {
	$update=mysqli_query($conn, "update customerdetails set status='Active' where hpl='$hpl' && mfin='$mfin'");	
	$delete2=mysqli_query($conn, "delete from sizzing where mfin='$mfin' && hpl='$hpl'"); 
}
$cdate = date("d-m-Y H:i:s");

$insert=mysqli_query($conn, "insert into cotherentry(postdate,postdate2,agentname,hpl,postamt,result,postamt2,mfin,scode)
values('".$row2['postdate']."','".$row2['postdate2']."','".$row2['agentname']."','".$row2['hpl']."','".$row2['postamt']."','".$row2['result']."','".$row2['postamt2']."','".$row2['mfin']."','".$row2['scode']."')");
						
mysqli_query($conn, "DELETE FROM otherentry where id = '$idd'");

echo "<script>alert('Cancelled successfully');window.location.href='index2.php'</script><br>";

?>


