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

$kode	= $_POST['kode'];

$text	= "SELECT * FROM jurppi_tmp WHERE nofak= '$kode'";
$sql 	= mysql_query($text);
$row	= mysql_num_rows($sql);

if ($row>0){
	mysql_query("UPDATE jurppi_tmp SET batal='BATAL' WHERE nofak='$kode'");
	
	$sql = mysql_query("SELECT * FROM jurppi_tmp WHERE batal=''");
	$tbayar=0;
	while($r=mysql_fetch_array($sql)){
		$tbayar=$tbayar+$r[dibayar];
	}
	$data['tbayar']	= $tbayar;
	echo json_encode($data);
}else{	
	$data['tbayar']	= '';	
	echo json_encode($data);	
}
?>