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

$sql = mysql_query("SELECT max(kode_dt) as no_akhir FROM dokter ORDER BY kode_dt");
$row = mysql_num_rows($sql);
if ($row>0){
	$data=mysql_fetch_array($sql);	
	$no = $data['no_akhir'];
	$no_akhir = (int) substr($no, 0, 3);
	$no_akhir++;
	$kode = sprintf("%03s",$no_akhir);
	$data['nomor']= $kode;
	echo json_encode($data);
}else{
	$data['nomor']= '001';
	echo json_encode($data);
}
?>