<?php
session_start();

	if(!isset($_SESSION['linkarisecrm']))
	{
		header('Location: index.php');
		return;
	}
	$cmpmid=$_SESSION['linkarisecmpmid'];
	$umid=$_SESSION['linkariseumid'];
	
	date_default_timezone_set("Asia/Singapore");
	$mdate= date('Y-m-d H:i:s');
	$mdate1= date('Y-m-d');
	
	include("connect.php");
	
	$jobworkmid=(int)mysqli_real_escape_string($conn,$_GET['id']);
	
	
	
	
					 $eve3 = "update res_jobwork_master set jobworkstatus='Received',receivedby=$umid,receivedon='$mdate' where tocompanymid='$cmpmid' and jobworkmid=".$jobworkmid;
					if ($conn->query($eve3) === TRUE)
					{
						 $eve4 = "update res_jobwork_detail set trolleyreceived=1 where jobworkmid=".$jobworkmid;
						 $re1 = mysqli_query($conn, $eve4);
					}
					
					
					$_SESSION['msg'] = "Jobwork Status Changed";
					

	
	header("Location: jobworkreceivedetail.php?id=$jobworkmid");
?>