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

$kode	= $_POST[kode];
$text	= "SELECT kode_pb,tanggal,nomor_fk,kode_sup,nama_sup,sum(jumlah) as total,sum(potongan) as jpotong,sum(bayar) as jbayar,sum(kurang) as jkurang FROM faktur_pb WHERE kode_pb= '$kode' GROUP BY kode_pb";
$sql 	= mysql_query($text);
$row	= mysql_num_rows($sql);
if ($row>0){
while ($r=mysql_fetch_array($sql)){
	$data['tgl']	= $r[tanggal];
	$data['nomorfk']= $r[nomor_fk];
	$data['kodesup']= $r[kode_sup];
	$data['namasup']= $r[nama_sup];
	$data['total']	= $r[total];
	$data['potong']	= $r[jpotong];
	$data['bayar']	= $r[jbayar];
	$data['kurang'] = $r[jkurang];
	echo json_encode($data);
}
}else{
	$data['tgl']	= '';
	$data['nomorfk']= '';
	$data['kodesup']= '';
	$data['namasup']= '';
	$data['total']	= '';
	$data['potong']	= '';
	$data['bayar']	= '';
	$data['kurang'] = '';
	echo json_encode($data);
}
?>