<?php
include "../../inc/inc.koneksi.php";
$kode	= $_POST['kode'];
$text	= "SELECT * FROM customer WHERE kode_pl= '$kode' ORDER BY kode_pl";
$sql 	= mysql_query($text);
$row	= mysql_num_rows($sql);
if ($row>0){
	while ($r=mysql_fetch_array($sql)){
		$data['namapl']= $r[nama];		
	}
	$sql = mysql_query("SELECT kode_pl,sum(jumlah) as tjumlah FROM piutang WHERE kode_pl= '$kode' ORDER BY kode_pl");
	$r=mysql_fetch_assoc($sql);
	$data['sisautg']= $r[tjumlah];
	echo json_encode($data);

}else{
	$data['namapl']= '';
	$data['sisautg']= '';
	echo json_encode($data);
}
?>