<?php 
session_start();
include('../includes/dbcon.php');

$str=" ";

$data = array();

$edate=date("Y-m-d");
$userid=$_SESSION['hrm_id'];

if (isset($_POST['item_id'])) {
 	$item_id = trim($_POST['item_id']);
 	$loc_id = trim($_POST['loc_id']);
 	$inv_id_sr= trim($_POST['inv_id_sr']);

 	

	        	$sqlsp=mysqli_query($con,"SELECT view_item_master.*,item_stocks.loc_qoh,inv_detail.qty AS inv,inv_detail.sales_price AS sp,inv_detail.item_dis AS dis
	        	 FROM view_item_master
LEFT JOIN item_stocks ON view_item_master.item_id=item_stocks.item_id 
AND item_stocks.loc_id=$loc_id 
LEFT JOIN `inv_detail` ON view_item_master.item_id=inv_detail.item_id 
AND inv_detail.inv_id='$inv_id_sr'
WHERE view_item_master.item_id=$item_id  ")or die(mysqli_error($con));
	        	$count=mysqli_num_rows($sqlsp);	
	        	if ($count>0) {
	        		while($rowsp=mysqli_fetch_array($sqlsp)){			
					 $data[]=$rowsp;				
				   }	

				    echo json_encode($data);
	        	}//	if ($count>0) {
exit();
	        
	        


} ///// if (isset($_POST['item_id'])) {

?>