<?php
include "../../inc/inc.koneksi.php";

$kode	= $_POST['kode'];
$gudang = $_POST['gudang'];

$text	= "SELECT *	FROM stock WHERE kode_st= '$kode' GROUP BY kode_st ";
$sql 	= mysql_query($text);
$row	= mysql_num_rows($sql);

if ($row>0){
while ($r=mysql_fetch_assoc($sql)){
	$data['namast'] = $r[nama_st];
	if($gudang=='1')
		$jmlstok=$r_data[jml_gd1];
	else if($gudang=='2')
		$jmlstok=$r_data[jml_gd2];
	else
		$jmlstok=$r_data[jml_gd3];	
	$data['tsatuan'] = $r[satuan];
	echo json_encode($data);
}
}else{
	$data['namast'] = '';
	$data['jmlstok'] = '';
	$data['tsatuan'] = '';
	echo json_encode($data);
}
?>
