<?php
include('../sys/phpcore.inc');


$req_outlet = $_POST['outlet'];

$pm = array();
$sqldetail = "select * from invlog WHERE outlet_id = '$req_outlet' AND log_reftype = 'INVT' AND log_status = 0";
$dcond = $conn->query($sqldetail) or die($sqldetail);
while($rs = $dcond->fetch_assoc()){
			
	$pm[]  = array(
					"refautoid" => $rs['log_refautoid'] ,
					"transno" => $rs['log_refno'] ,
					"transdate" => $rs['log_refdate'] ,
					"itt_autoid" => $rs['itt_autoid'] ,
					"itt_desc" => $rs['itt_desc'] ,
					"pm_autoid" => $rs['pm_autoid'] ,
					"pm_name" => $rs['pm_name'],
					"price" => $rs['log_price'],
					"inqty" => $rs['log_inqty'],
					"outqty" => $rs['log_outqty'],
					"outlet" => $rs['outlet_id']
	);

}

echo json_encode($pm);

$sql_update = "update invlog SET log_status = 1 WHERE outlet_id = '$req_outlet' AND log_reftype = 'INVT' AND log_status = 0";
$conn->query($sql_update);
?>

