<?php
session_start();
include './connection.php';


$caseid=$_POST["id"];
$ptype=$_POST["proceed"];
$pdate=$_POST["pdate"];

$pdate=date("d/m/Y",strtotime($pdate));

$rdate=$_POST["rdate"];
$rdate=date("d/m/Y",strtotime($rdate));
if($caseid==="")
{
	exit();
}

	$query="INSERT INTO `tbl_restored`(`case_id`, `court_id`, `rdate`) VALUES ('".$caseid."','".$_SESSION["court_id"]."','".$rdate."') ";

	$up="UPDATE `caseinfo` SET  `status`='1' WHERE ID=".$caseid." AND currentcourtid='".$_SESSION["court_id"]."'";
	$up1="UPDATE tbl_disposals SET  status='0' WHERE case_id='".$caseid."' AND court_id='".$_SESSION["court_id"]."'";

	$q="INSERT INTO `caseproceedings`(  `caseid`, `proceeding`, `proceedingdate`, `pcourtid`, `status`) VALUES ('".$caseid."','".$ptype."', '".$pdate."','".$_SESSION["court_id"]."','0')";
	if($conn->query($up)&$conn->query($q)&$conn->query($up1) &$conn->query($query))
	{ 

		 
			echo '<script>alert("Case has been added to Proceedings List."); window.location.assign("./allrecord.php");  </script>';
		 
	}
	else
		{
			 echo '<script>alert("Case Can not Added to Proceedings."); window.location.assign("./allrecord.php");  </script>';
		}
 
?>