<?php
include('db_con.php');
 if(isset($_POST['gst']))
	{
		
		$query = "
		SELECT * FROM opt WHERE op_name = :gst
		";
		$statement = $connect->prepare($query);
		$statement->execute(
			array(
				':gst'	=>	'gst'
			)
		);
		$result = $statement->fetchAll();
		foreach($result as $row)
		{
			
			$output['gst_value'] = $row['op_value'];
			
			
			
		}
		$query = "
		SELECT max(inv_no) FROM sale WHERE gst = :gst
		";
		$statement = $connect->prepare($query);
		$statement->execute(
			array(
				':gst'	=>	'ON'
			)
		);
		$inv_no = $statement->fetchColumn();
		
		$inv_no++;
		$output['inv_no'] = $inv_no;
		
		echo json_encode($output);
	}
	
	
?>