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

$kode= $_POST['kode'];

$sql= mysql_query("SELECT kode_gr,nama_st,barcode,satuan,hg_jual,hg_resep,hg_param,hg_beli,sum(jml_stok+jml_stokb) as jstok,kode_sp,nama_sp,kode_sp1,nama_sp1,min_stokb FROM stock WHERE kode_st='$kode' GROUP BY kode_st");
$r  = mysql_fetch_assoc($sql);
$data['kodegr']	= $r['kode_gr'];	
$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['jmlstok']= $r['jstok'];
$data['kodesp'] = $r['kode_sp'];
$data['namasp'] = $r['nama_sp'];
$data['kodesp1']= $r['kode_sp1'];
$data['namasp1']= $r['nama_sp1'];
$data['minstok']= $r['min_stokb'];
echo json_encode($data);
?>