<?php 
	include("../config.php");
	$invoice_no  = $_POST['invoice_no'];
	$module = $_POST['module'];
	$branch = $_POST['branch_id'];

	$select = "SELECT * FROM `document_mst` WHERE branch = '".$branch."' AND module = '".$module."' AND `company_id` = '".$_SESSION['company_id']."' ORDER BY id asc";
	$result = mysqli_query($conn,$select);
	
	$status = false;
	while ($row = mysqli_fetch_array($result)) {
		if( $invoice_no >= $row['start_sr_no'] && $invoice_no <= $row['end_sr_no']) {
			$status = true;
			break;
		}
	}

	if( $status == 'true' ) {
		$data = array('status' => 1);
	} else {
		$data = array('status' => 0);
	}

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