<?php

include "start.php";


$main_array = array();
$save_array = array();


$query_get="select * from t_".$key_table_prefix."_user_device
	    where dusr_id='".$_REQUEST["u"]."'
	    and dusr_session_id ='".$_REQUEST["s"]."'
		";


$result_get = mysqli_query($dbconn, $query_get) or die("Error".mysqli_error($dbconn));
if($line_get = mysqli_fetch_array($result_get,MYSQLI_ASSOC))
{
	$this_data = array(
		"status" => "YES",
		"message" => "Active"
	     );

	   array_push($main_array, $this_data);
	    
	    
	   
	   $query_insert="insert into t_".$key_table_prefix."_delegate_entry
	   			(
					
				ent_session,
					
				device_id,	
				ent_product_id,	
				ent_date,
				
				ent_warehouse_code_from,
				ent_warehouse_code_to,
				
				ent_type,
				ent_quantity,
				
				
				created_date,
				modified_date
				
				
				)values
				(
					
				'".$_REQUEST["session"]."',
				
				'".$_REQUEST["d"]."',
				'".$_REQUEST["pdt_id"]."',
				'".$_REQUEST["date"]."',
				
				'".$_REQUEST["from"]."',
				'".$_REQUEST["to"]."',
				
				'".$_REQUEST["type"]."',
				'".$_REQUEST["quantity"]."',
				
				'".date("Y-m-d H:i:s")."',
				'".date("Y-m-d H:i:s")."'
				
				);
		    		";


	   $result_insert = mysqli_query($dbconn, $query_insert) or die("Error".mysqli_error($dbconn));
	   
	   



	    
	   $this_data = array(
		   "status" => "YES",
		   "message" => "Active"
		   );

		 array_push($save_array, $this_data);
		  
		  
	    
	    
	    
	    
	    
	    
}
else {

    	$this_data = array(
		  "status" => "NO",
		  "message" => "Invalid Login Information"
   	);

   array_push($main_array, $this_data);
}
 


$content_array["login"] = $main_array;
$content_array["save"] = $save_array;



$json = json_encode($content_array);

echo $json;






?>
