<?php
include "../../inc/inc.koneksi.php";
$kode	= $_POST['kode'];

$sql 	= mysql_query("SELECT * FROM faktur_pj WHERE kode_pj= '$kode'");
$row	= mysql_num_rows($sql);

if ($row>0){
	$total=0;	
	$tothpp=0;
	while ($r=mysql_fetch_array($sql)){		
		$total=$total+$r[jumlah];
		$tothpp=$tothpp+$r[hpp];
	}	
	$data['total']= $total;
	$data['tothpp']= $tothpp;
	echo json_encode($data);
}else{	
	$data['total']= 0;
	$data['tothpp']= 0;
	echo json_encode($data);
}
?>