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

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

if($gudang=='Gudang')
    $sql= mysql_query("SELECT * FROM stock WHERE kode_st= '$kode' AND kode_cab='01'");
else
    $sql= mysql_query("SELECT * FROM stock WHERE kode_st= '$kode' AND kode_cab='$gudang'");

$r	= mysql_fetch_assoc($sql);
$data['namast']	= $r['nama_st'];
$data['satuan']	= $r['satuan'];
$data['hgbeli']	= $r['hg_beli'];

if($gudang=='Gudang')
    $data['jmlstok']= $r['jml_stokb'];
else
	$data['jmlstok']= $r['jml_stok'];

echo json_encode($data);
?>