<?php include "layouts/menu.php"; ?>
 <script>
	function autocomplet() {
	var min_length = 0; // min caracters to display the autocomplete
	var keyword = $('#did').val();
	if (keyword.length >= min_length) {
		$.ajax({
			url: 'ajax_refresh.php',
			type: 'POST',
			data: {keyword:keyword},
			success:function(data){
				$('#country_list_id').show();
				$('#country_list_id').html(data);
			}
		});
	} else {
		$('#country_list_id').hide();
	}
}
function set_item(item) {
	// change input value
	$('#did').val(item);
	// hide proposition list
	$('#country_list_id').hide();
}
	</script>
	 <script>
	function autocomp() {
	var min_length = 0; // min caracters to display the autocomplete
	var keyword = $('#didn').val();
	if (keyword.length >= min_length) {
		$.ajax({
			url: 'ajax_sname.php',
			type: 'POST',
			data: {keyword:keyword},
			success:function(data){
				$('#dname').show();
				$('#dname').html(data);
			}
		});
	} else {
		$('#dname').hide();
	}
}

// set_item : this function will be executed when we select an item
function set_itemm(item) {
	// change input value
	$('#didn').val(item);
	// hide proposition list
	$('#dname').hide();
}
	</script>
 <script>
	function autocomplett() {
	var min_length = 0; // min caracters to display the autocomplete
	var keyword = $('#zxcvb').val();
	if (keyword.length >= min_length) {
		$.ajax({
			url: 'ajax_refreshq.php',
			type: 'POST',
			data: {keyword:keyword},
			success:function(data){
				$('#qwertyu').show();
				$('#qwertyu').html(data);
			}
		});
	} else {
		$('#qwertyu').hide();
	}
}
// set_item : this function will be executed when we select an item
function set_itemmm(item) {
	// change input value
	$('#zxcvb').val(item);
	// hide proposition list
	$('#qwertyu').hide();
}
	</script>
  <div class="right_col" role="main">
            <div class="row">
                 <!-- page header -->
                <div class="col-lg-12">
				
                    <h1 class="page-header  alert alert-info">Checking Government ID</h1>
                </div>
                <!--end page header -->
            </div>
            <div class="row">
                <div class="col-lg-12">
				<a href="getuserdue.php"><button class="btn btn-primary">View</button></a>&nbsp;&nbsp;
                    <!-- Form Elements -->
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            Give Government ID
                        </div>
                        <div class="panel-body">
                            <div class="row">
   <div class="alert alert-info">Welcome Register Here</div>
  
<form name="form2" class="form-horizontal" method="post" action="" enctype="multipart/form-data">
   <div class="form-group">
    <label for="inputPassword3" class="col-sm-2 control-label">Government ID</label>
    <div class="col-sm-4">
      <input type="text" class="form-control" id="zxcvb" name="gi" value="" placeholder=""  required>
	  <ul id="qwertyu"></ul>
    </div>
  </div>	
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <button type="submit" class="btn btn-success" name="s4">Search It</button>
    </div>
  </div>
      <div class="alert alert-success">
	  <?php
								if(isset($_POST['s4']))
								{
									extract($_POST);
									$qry=mysqli_query($conn, "select * from customerdetails where g1='$gi'");
									$n=mysqli_num_rows($qry);
									$qry2=mysqli_query($conn, "select * from customerdetails where g2='$gi'");
									$n2=mysqli_num_rows($qry2);
									$qry3=mysqli_query($conn, "select * from customerdetails where g3='$gi'");
									$n3=mysqli_num_rows($qry3);
									$row=mysqli_fetch_array($qry);
									$row2=mysqli_fetch_array($qry2);
									$row3=mysqli_fetch_array($qry3);
									 $a1 = 0; $a2 = 0;
									 $hpl = $row['hpl'];
									 $hpl2 = $row2['hpl'];
									 $hpl3 = $row3['hpl'];
									 $qry5=mysqli_query($conn, "select * from sizzing where hpl='$hpl'");
									$n5=mysqli_num_rows($qry5);
									$qry52=mysqli_query($conn, "select * from sizzing where hpl='$hpl2'");
									$n52=mysqli_num_rows($qry52);
									$qry53=mysqli_query($conn, "select * from sizzing where hpl='$hpl3'");
									$n53=mysqli_num_rows($qry53);
									if(($n5 > 0) OR ($n52 > 0) OR ($n53 > 0)) {
										echo "The Customer's Vehicle in that ID Already Sizzed Don't Loan Him"; ?> </br> <?php
									}
									if(($n == 0) && ($n2 == 0) && ($n3 == 0))
									{
										$a1++;
										echo "No Customer In the ID " ; ?> </br> <?php
									
						
									}
									
									else
									{
										echo "Already Exisiting Customer"; ?> </br> <?php
										echo"---";echo $row['hpl'];echo"--";echo $row['name'];  ?> </br> <?php 
										echo"---";echo $row2['hpl'];echo"--";echo $row2['name'];  ?> </br> <?php
										echo"---";echo $row3['hpl'];echo"--";echo $row3['name'];  ?> </br> <?php
										
										
									}	
									
									$qry=mysqli_query($conn, "select * from customerdetails where b1='$gi'");
									$n=mysqli_num_rows($qry);
									$qry2=mysqli_query($conn, "select * from customerdetails where b2='$gi'");
									$n2=mysqli_num_rows($qry2);
									$qry3=mysqli_query($conn, "select * from customerdetails where b3='$gi'");
									$n3=mysqli_num_rows($qry3);
									$row=mysqli_fetch_array($qry);
									$row2=mysqli_fetch_array($qry2);
									$row3=mysqli_fetch_array($qry3);
									
									if(($n == 0) && ($n2 == 0) && ($n3 == 0))
									{
										$a2++;
										echo "No Co-Oblicant In the ID" ; ?> </br> <?php
									
						
									}
									
									else
									{
										echo "Already Exisiting Co-Oblicant"; ?> </br> <?php
										echo"---";echo $row['hpl'];echo"--";echo $row['co'];  ?> </br> <?php
										echo"---";echo $row2['hpl'];echo"--";echo $row2['co'];  ?> </br> <?php
										echo"---";echo $row3['hpl'];echo"--";echo $row3['co'];  ?> </br> <?php
										
										
									}	
									if(($a1>0) & ($a2>0))
									echo "Can Proceed for Entry ";
									}
									else  {
										echo "Don't Take him Already Exist";
									}
								
							?>
							
	  </div>
</form>
</div>
</div></div>
</div></div></div> <?php include "layouts/footer.php"; ?></body></html>
