<?php  
error_reporting(E_ERROR | E_PARSE);
	include("../connect.php");
	$par1=$_GET['mobile'];
	$par2=$_GET['password'];
	$par3=$_GET['pref_id'];
	$par4=$_GET['hotelid'];
	$par5=$_GET['trolleyId'];
	$par6=$_GET['trolleyBarcode'];
	$par7=$_GET['tweight'];


	$response = array();
	$posts = array();
	
	
	date_default_timezone_set("Asia/Singapore");
	$mdate= date('Y/m/d H:i:s');
	$myObj2 = new stdClass();
    $eve1 = "SELECT usermid FROM res_user_master where  userloginid='$par1' and usersecurepasword='$par2' and userstatus='Active' and userdesignation='User' limit 0,1";
	$re1 = mysqli_query($conn,$eve1);
																	
	if(mysqli_num_rows($re1) > 0)
	{
		while($rt = mysqli_fetch_assoc($re1))
			{
					$umid=$rt['usermid'];
				
			}
		
		//$result="1";
		 $query1 = "select * from res_trolley_master where trolleymid=$par5";
		$stmt1=mysqli_query($conn,$query1);
		
		$tareweight="";
		
			while($rt1 = mysqli_fetch_assoc($stmt1))
			{
				$tareweight=$rt1['trolleytareweight'];
				
			}
			 $eve17 = "SELECT * FROM res_jobwork_detail where  trolleymid=$par5 and orderdrandomid='$par3' ";
			$re17 = mysqli_query($conn,$eve17);
																			
			if(mysqli_num_rows($re17) == 0)
			{
				$netweight=$par7-$tareweight;
				 $evenewpass = "insert into res_jobwork_detail (trolleymid,trolleyqrcode,trolleytareweight,trolleygrossweight,trolleynetweight,orderdrandomid,addedbyID,tocompanyID) values ($par5,'$par6','$tareweight','$par7','$netweight','$par3','$umid','$par4')";
				$renewpass = mysqli_query($conn, $evenewpass);
			}
			
															
		
		$result="1";
		$msg = "Success";
		
		$posts[] = array('result'=> $result,'msg'=> $msg);
		echo stripslashes(json_encode( array('item' => $posts)));

	}
   else
   {
		$result="0";
		$msg="Failure";
		
		$posts[] = array('result'=> $result,'msg'=> $msg);
		echo stripslashes(json_encode( array('item' => $posts)));

   }
	mysqli_close($conn);
?>
