<?php
include "start.php";


$json_array_item = array();
$json_array_service_activity = array();


$query_data = "select * from t_".$key_table_prefix."_service_item
		 where svi_id = '".$_REQUEST["id"]."'
		 order by svi_id 
		 ";

$result_data = mysqli_query($dbconn, $query_data);
while($line_data = mysqli_fetch_array($result_data,MYSQLI_ASSOC))
{
 
 
	$this_data = array(
		    "id" => $line_data["svi_id"],
		    "serial_no" => $line_data["svi_serial_no"],
		    "code" => $line_data["svi_product_code"],
		    "name" => $line_data["svi_product_name"],
		    
		    "size" => $line_data["svi_product_size"],
		    "color" => $line_data["svi_product_color"],
		    "pattern" => $line_data["svi_product_pattern"],
		    
		    "date_issued" => $line_data["svi_date_issued"],
		    
		    "status" => $line_data["svi_status"],
		    
		    "created_date" => $line_data["created_date"],
		    "modified_date" => $line_data["modified_date"]
		    
		 );
    
	array_push($json_array_item, $this_data);
 
 
}

	


$query_data = "select * from t_".$key_table_prefix."_service_item_activity
		 where sva_item_id = '".$_REQUEST["id"]."'
		 order by sva_id 
		 ";

$result_data = mysqli_query($dbconn, $query_data);
while($line_data = mysqli_fetch_array($result_data,MYSQLI_ASSOC))
{
 
 
	$this_data = array(
		    "id" => $line_data["sva_id"],
		    "date" => $line_data["sva_date"],
		    "person" => $line_data["sva_person"],
		    "remark" => $line_data["sva_remark"],
		    
		    "created_date" => $line_data["created_date"],
		    "modified_date" => $line_data["modified_date"]
		    
		 );
    
	array_push($json_array_service_activity, $this_data);
 
 
}

	
	
	
	

$content_array["service_item"] = $json_array_item;	
$content_array["service_activity"] = $json_array_service_activity;	




$json = json_encode($content_array);
	
echo $json;

?>