<?php 
	include("../config.php");
	$bill_no   = $_POST['bill_no'];
	
	$select ="SELECT invoice_no FROM billing WHERE invoice_no = '".$bill_no."' AND branch_id = '".$_SESSION['branch_id']."' AND company_id = '".$_SESSION['company_id']."'
	UNION ALL
	SELECT invoice_no FROM opening_balance WHERE invoice_no = '".$bill_no."' AND branch_id = '".$_SESSION['branch_id']."' AND company_id = '".$_SESSION['company_id']."'
	UNION ALL
	SELECT bill_no FROM general_sales WHERE bill_no = '".$bill_no."' AND branch_id = '".$_SESSION['branch_id']."' AND company_id = '".$_SESSION['company_id']."'
	
	";

	
	$result  = mysqli_query($conn,$select);
	
	if(mysqli_num_rows($result) > 0) {
		$data = array('status' => 1);
	} else {
		$data = array('status' => 0);
	}

	echo json_encode($data);
	die();
?>