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

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

$sql 	= mysql_query("SELECT * FROM stock WHERE kode_st= '$kode' AND kode_cab='$kodecab'");
$r		= mysql_fetch_assoc($sql);
$kodest	= $r['kode_st'];
$kodegr	= substr($kodest,0,3);
	
$data['kodest']	= $r['kode_st'];
$data['namast']	= $r['nama_st'];
$data['barcode']= $r['barcode'];
$data['satuan']	= $r['satuan'];
$data['hgjual']	= $r['hg_jual'];
$data['hgresep']= $r['hg_resep'];
$data['hgparam']= $r['hg_param'];
$data['hgbeli']	= $r['hg_beli'];
$data['kodesp']	= $r['kode_sp'];
$data['jmlstok']= $r['jml_stok'];
$data['kodegr']	= $kodegr;
echo json_encode($data);
?>