<?php 
include '../Admin_config/connection.php';

if (isset($_POST["query"])) 
{

	$sql= "SELECT MAX(`rc_number`) AS `max_rc` FROM `sc_receipt` WHERE `rc_type`='NO-GST'";
	$result=mysqli_query($conn,$sql);
	$row = mysqli_fetch_assoc($result);
	$temp = explode('/', $row['max_rc']);
	$getId = end($temp);
	$incId = $getId + 1;

	if ($incId < 100000) {
		$newId = "RC-NOGST/00000".$incId;
	}else{
		$newId = "RC-NOGST/".$incId;
	}

	echo ($newId);
}

?>