<?php
include "../../inc/inc.koneksi.php";
$kode	= $_POST['kode'];
$exp	= explode(".",$kode);
$kodepj= $exp[0];
$kodest= $exp[1];

$text	= "SELECT * FROM faktur_pj WHERE kode_pj='$kodepj' AND kode_st= '$kodest' ORDER BY kode_pj AND kode_st";
$sql 	= mysql_query($text);
$row	= mysql_num_rows($sql);
if ($row>0){
while ($r=mysql_fetch_array($sql)){
	$data['jenisst']= $r[jenis_st];
	$data['kodest']	= $r[kode_st];
	$data['namast']	= $r[nama_st];
	$data['tsatuan']= $r[satuan];
	$data['jmlkirim']= $r[jml_unit];
	$data['hgjual']	= $r[hg_jual]-$r[potongan];
	$data['hgbeli'] = $r[hpp]/$r[jml_unit];
	echo json_encode($data);
}
}else{
	$data['jenisst']= '';
	$data['kodest']	= '';
	$data['namast']	= '';
	$data['tsatuan']= '';
	$data['jmlkirim']= '';
	$data['hgjual']	= '';
	$data['hgbeli']	= '';
	echo json_encode($data);
}
?>