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

$kode = $_POST['kode'];
$sql  	= mysql_query("SELECT max(no_urut) as no_akhir FROM faktur_pj WHERE kode_pj='$kode' ORDER BY kode_pj");
$row  	= mysql_num_rows($sql);

if ($row>0){
	$r=mysql_fetch_array($sql);	
	$nomor = $r['no_akhir']+1;
	$data['nourut']= $nomor;
	echo json_encode($data);
}else{
	$data['nourut']= '1';
	echo json_encode($data);
}
?>