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

$text	= "SELECT max(noakun) as no_akhir FROM akun_bp WHERE nobb='$kode' ORDER BY noakun";
$sql 	= mysql_query($text);
$data= mysql_fetch_array($sql);
$no 	= $data['no_akhir'];

if($no==''){
	$data['nomor']= $kode.'0001';
	echo json_encode($data);
}else{	
	$no_akhir = (int) substr($no, 5, 4);
	$no_akhir++;
	$noakun = $kode.sprintf("%04s",$no_akhir);
	$data['nomor']= $noakun;
	echo json_encode($data);
}
?>