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

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


$sql	= mysql_query("SELECT * FROM stock WHERE kode_st= '$kode' ORDER BY kode_st");
$r	= mysql_fetch_assoc($sql);
$data['kodest']	= $r[kode_st];
$data['namast']	= $r[nama_st];
$data['satuan']	= $r[satuan];
$data['hgjual']	= $r[hg_jual];
$data['hgbeli']	= $r[hg_beli];
$data['hba']		= $r[hb_akhir];
$data['jmlstok']	= $r[jml_stok];
echo json_encode($data);

$sql1 = mysql_query("SELECT max(hg_jual) FROM faktur_pj WHERE kode_plg='$kodepl' AND kode_st= '$kode' ORDER BY kode_plg,kode_st");
$row = mysql_num_rows($sql1);

if ($row>0){
	$r1 = mysql_fetch_assoc($sql1);
	$data['disc']	= $r[disc];
}
?>