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

$kode	= $_POST[kode];

$text	= "SELECT kode_pj,tanggal,kode_plg,nama_plg,jt_tempo,tanggal_jt,kode_sl,nama_sl,sum(jumlah) as total,sum(bayar) as tbayar,sum(kurang) as tkurang,sum(hpp) as thpp,user FROM faktur_pj WHERE kode_pj= '$kode' GROUP BY kode_pj";
$sql 	= mysql_query($text);
$row	= mysql_num_rows($sql);

$r=mysql_fetch_assoc($sql);
$tgl		= $r[tanggal];
$kodeplg	= $r[kode_plg];
$namaplg	= $r[nama_plg];
$jttempo  	= $r[jt_tempo];
$tanggaljt	= $r[tanggal_jt];
$total		= $r[total];
$tbayar		= $r[tbayar];
$tkurang 	= $r[tkurang];
$thpp		= $r[thpp];
$user    	= $r[user];

$data['tgl']		= $tgl;
$data['kodeplg']	= $kodeplg;
$data['namaplg']	= $namaplg;
$data['jttempo']	= $jttempo;
$data['tanggaljt']	= $tanggaljt;
$data['total']		= $total;	
$data['tbayar']		= $tbayar;	
$data['tkurang']	= $tkurang;
$data['thpp']		= $thpp;
$data['user']		= $user;
echo json_encode($data);
?>