









<?php




include('db_con.php');




 if (isset($_SESSION['user_id'])) {




   




    $branch_id = $_SESSION['branch_id'];




   




}else{




  header('Location: login');




  die();




}









 if(isset($_POST['inv_no']))




	{




		




		$query = "




		SELECT inv_no FROM sale WHERE branch_id = '".$branch_id."' and inv_type = 'Credit' and inv_no = :inv_no




		";




		$statement = $connect->prepare($query);




		$statement->execute(




			array(




				':inv_no'	=>	$_POST["inv_no"]




			)




		);




		$result = $statement->fetchAll();




		foreach($result as $row)




		{




			




			$output['old_inv_no'] = $row['inv_no'];




			




			




			




			




			




		}














		









		echo json_encode($output);




	}
























	




	




?>