<?php 
include('../config.php');
$vendor_id = $_GET['q'];

$nor     = "SELECT * FROM `lr_mst` WHERE consignor_name = '".$vendor_id."' AND billing_party = 'CONSIGNOR'";
$nor_res = mysqli_query($conn,$nor);
$nor_row = mysqli_fetch_array($nor_res);

$nee     = "SELECT * FROM `lr_mst` WHERE consignor_name = '".$vendor_id."' AND billing_party = 'CONSIGNEE'";
$nee_res = mysqli_query($conn,$nee);
$nee_row = mysqli_fetch_array($nee_res);

if($nor_row['billing_party'] == 'CONSIGNOR'){  ?>
	<select name="mat_sub_cat" class="form-control" id="mat_sub_cat" onchange="productAutoComplete(this);">
		<option></option>
		<?php 
		$no     = "SELECT * FROM `lr_mst` WHERE consignor_name = '".$vendor_id."' AND billing_party = 'CONSIGNOR'";
		$no_res = mysqli_query($conn,$no);
		while ($no_row = mysqli_fetch_array($no_res)) { ?>
		<option value="<?php echo $no_row['lr_no'];?>"><?php echo $no_row['lr_no'];?></option>
		<?php } ?>
	</select>
<?php }else if($nee_row['billing_party'] == 'CONSIGNEE'){ ?>
	<select name="mat_sub_cat" class="form-control" id="mat_sub_cat" onchange="productAutoComplete(this);">
		<option></option>
		<?php 
		$ne     = "SELECT * FROM `lr_mst` WHERE consignor_name = '".$vendor_id."' AND billing_party = 'CONSIGNEE'";
		$ne_res = mysqli_query($conn,$ne);
		while ($ne_row = mysqli_fetch_array($ne_res)) { ?>
		<option value="<?php echo $ne_row['lr_no'];?>"><?php echo $ne_row['lr_no'];?></option>
		<?php } ?>
	</select>
<?php }else{

}
?>
