<?php include "layouts/menu.php"; ?> 
	 <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_broker.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>
    <!--  page-wrapper -->
         <div class="right_col" role="main">

            <div class="row">
                <div class="col-lg-12">
                    <!-- Form Elements -->
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            Give HPL / Vehicle Number / Customer Name
                        </div>
                        <div class="panel-body">
                            <div class="row">
							 <div class="col-lg-6">
   
   
   <form name="form1" class="form-horizontal" method="post" action="" enctype="multipart/form-data">
   <div class="form-group has-success has-feedback">
    <label for="inputPassword3" class="col-sm-2 control-label">HPL</label>
    <div class="col-sm-4">
      <input type="text" class="form-control" id="inputPassword3" name="hpl" value="" placeholder="Enter your HPL" required>
	  <span class="glyphicon glyphicon-header form-control-feedback"></span>
    </div>
  </div>
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <button type="submit" class="btn btn-primary" name="s2">Search It</button>
    </div>
  </div>
      <div class="alert alert-success">
      <?php
								if(isset($_POST['s2']))
								{
									extract($_POST);
								header("location:0fhpl.php?hpl=$hpl"); }
							?>
	  </div>
</form>
<form name="form2" class="form-horizontal" method="post" action="" enctype="multipart/form-data">
    <div class="form-group has-success has-feedback">
    <label for="inputPassword3" class="col-sm-2 control-label">Vehicle No</label>
    <div class="col-sm-4">
      <input type="text" class="form-control"  id="zxcvbfff" name="vno" value="" placeholder="E.g TN45 S4545"  required>
	   <ul id="qwertyuddd"></ul>
	  <span class="glyphicon glyphicon-plane form-control-feedback"></span>
    </div>
  </div>
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <button type="submit" class="btn btn-success" name="s3">Search It</button>
    </div>
  </div>
      <div class="alert alert-success">
      <?php
								if(isset($_POST['s3']))
								{
									extract($_POST);
									
										header("location:0fvno.php?vno=$vno");
							
								}
							?>
	  </div>
</form>	
<form name="form3" class="form-horizontal" method="post" action="" enctype="multipart/form-data">
    <div class="form-group has-warning has-feedback">
    <label for="inputPassword3" class="col-sm-2 control-label">Name</label>
    <div class="col-sm-4">
      <input type="text" class="form-control"  id="didn" name="name" value="" placeholder="E.g Shanker" onkeyup="autocomp()" required>
	   <ul id="dname"></ul>
	  <span class="glyphicon glyphicon-user form-control-feedback"></span>
    </div>
  </div>
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <button type="submit" class="btn btn-warning" name="s455">Search It</button>
    </div>
  </div>
      <div class="alert alert-success">
      <?php
								if(isset($_POST['s455']))
								{
									extract($_POST);
								
										header("location:0fname.php?name=$name");
									
								}
							?>
	  </div>
</form>				
<form name="form4" class="form-horizontal" method="post" action="" enctype="multipart/form-data">
    <div class="form-group has-error has-feedback">
    <label for="inputPassword3" class="col-sm-2 control-label">Phone Number</label>
    <div class="col-sm-4">
      <input type="text" class="form-control"  id="did" name="pno" value="" placeholder="E.g 9843362020" onkeyup="autocomplet()" required>
	   <ul id="country_list_id"></ul>
	  <span class="glyphicon glyphicon-phone-alt form-control-feedback"></span>
    </div>
  </div>
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <button type="submit" class="btn btn-danger" name="s4">Search It</button>
    </div>
  </div>
      <div class="alert alert-success">
      <?php
								if(isset($_POST['s4']))
								{
									extract($_POST);
																			header("location:0fpno.php?pno=$pno");
									
								}
							?>
	  </div>
</form>	
<form name="form45577" class="form-horizontal" method="post" action="" enctype="multipart/form-data">
    <div class="form-group has-error has-feedback">
    <label for="inputPassword3" class="col-sm-2 control-label">Area</label>
    <div class="col-sm-4">
      <select type="text" class="form-control"  id="areaf" name="area" value="" placeholder="" required>
	  <option>Select</option>
	  <?php $sql33 = mysqli_query($conn, "select * from msarea order by name asc");
	  while($row33 = mysqli_fetch_array($sql33)) { ?>
	   <option><?php echo $row33['name']; ?></option>
	  <?php } ?> </select>
	  <span class="glyphicon glyphicon-phone-alt form-control-feedback"></span>
    </div>
  </div>
   <div class="form-group has-error has-feedback">
    <label for="inputPassword3" class="col-sm-2 control-label">Vehicle Name</label>
    <div class="col-sm-4">
      <select type="text" class="form-control"  id="vname" name="vname" value="" placeholder="" required>
	  <option>Select</option>
	  <?php $sql33 = mysqli_query($conn, "select * from mveh order by name asc");
	  while($row33 = mysqli_fetch_array($sql33)) { ?>
	   <option><?php echo $row33['name']; ?></option>
	  <?php } ?> </select>
	  <span class="glyphicon glyphicon-phone-alt form-control-feedback"></span>
    </div>
  </div>
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <button type="submit" class="btn btn-danger" name="s45566">Search It</button>
    </div>
  </div>
      <div class="alert alert-success">
      <?php
								if(isset($_POST['s45566']))
								{
									extract($_POST);
								
										header("location:0fvname.php?area=$area&vname=$vname");
								}
							?>
	  </div>
</form>		
</div>
<div class="col-lg-6">

 

<form name="form466" class="form-horizontal" method="post" action="" enctype="multipart/form-data">
    <div class="form-group has-error has-feedback">
    <label for="inputPassword3" class="col-sm-2 control-label">Area</label>
    <div class="col-sm-4">
      <input type="text" class="form-control"  id="area" name="area" value="" placeholder="" onkeyup="autocomplet()" required>
	   <ul id="country_list_id"></ul>
	  <span class="glyphicon glyphicon-phone-alt form-control-feedback"></span>
    </div>
  </div>
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <button type="submit" class="btn btn-danger" name="s400">Search It</button>
    </div>
  </div>
      <div class="alert alert-success">
      <?php
								if(isset($_POST['s400']))
								{
									extract($_POST);
								
										header("location:0farea.php?area=$area");
								}
							?>
	  </div>
</form>	

 
   


<form name="form423" class="form-horizontal" method="post" action="" enctype="multipart/form-data">
    <div class="form-group has-error has-feedback">
    <label for="inputPassword3" class="col-sm-2 control-label">Govt ID</label>
    <div class="col-sm-4">
      <input type="text" class="form-control"  id="gid" name="gid" value="" placeholder=""  required>
	  <span class="glyphicon glyphicon-phone-alt form-control-feedback"></span>
    </div>
  </div>
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <button type="submit" class="btn btn-danger" name="s40023">Search It</button>
    </div>
  </div>
      <div class="alert alert-success">
      <?php
								if(isset($_POST['s40023']))
								{
									extract($_POST);
								
										header("location:0fgid.php?gid=$gid");
								}
							?>
	  </div>
</form>	

<form name="form42311" class="form-horizontal" method="post" action="" enctype="multipart/form-data">
    <div class="form-group has-error has-feedback">
    <label for="inputPassword3" class="col-sm-2 control-label">Coobligant</label>
    <div class="col-sm-4">
      <input type="text" class="form-control"  id="coo" name="coo" value="" placeholder=""  required>
	  <span class="glyphicon glyphicon-phone-alt form-control-feedback"></span>
    </div>
  </div>
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <button type="submit" class="btn btn-danger" name="s4002311">Search It</button>
    </div>
  </div>
      <div class="alert alert-success">
      <?php
								if(isset($_POST['s4002311']))
								{
									extract($_POST);
								
										header("location:0fcoo.php?coo=$gid");
								}
							?>
	  </div>
</form>	

 <form name="form155" class="form-horizontal" method="post" action="" enctype="multipart/form-data">

 <div class="form-group has-success has-feedback">
    <label for="inputPassword3" class="col-sm-2 control-label">Start Date</label>
    <div class="col-sm-4">
      <input type="date" class="form-control" id="inputPassword3" name="fdate" placeholder="dd-mm-yyyy" data-inputmask="'mask': '99-99-9999'" required>
	  <span class="glyphicon glyphicon-chevron-left form-control-feedback"></span>
    </div>
  </div>
   <div class="form-group has-success has-feedback">
    <label for="inputPassword3" class="col-sm-2 control-label">End Date</label>
    <div class="col-sm-4">
      <input type="date" class="form-control" id="inputPassword3" name="tdate" value="" placeholder="dd-mm-yyyy" data-inputmask="'mask': '99-99-9999'" required>
	  <span class="glyphicon glyphicon-chevron-right form-control-feedback"></span>
    </div>
  </div>
  <div class="form-group has-success has-feedback">
    <label for="inputPassword3" class="col-sm-2 control-label">Broker</label>
    <div class="col-sm-4">
      <input type="text" class="form-control" id="zxcvb" name="bname" value="" placeholder="" onkeyup="autocomplett()">
	    <ul id="qwertyu"></ul>
	  <span class="glyphicon glyphicon-chevron-right form-control-feedback"></span>
    </div>
  </div>
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <button type="submit" class="btn btn-primary" name="s288">Search It</button>
    </div>
  </div>
      <div>
      <?php
								if(isset($_POST['s288']))
								{
								extract($_POST); ?>
								
								<div class="table-responsive">
  <table id="datatable-buttons" id="datatable-buttons" class="table table-striped table-bordered">
					<thead>
						<tr><th>S.No</th>
						<th>Hpl</th>
						<th>Name</th>
						<th>Model</th>
						<th>Int</th>
						<th>User Image</th>
						<th>Vehicle No</th>
						<th>Make</th>
						<th>Status</th>
						<th>Broker</th>
						<th>Phone No</th>
						<th>H.P Amount</th>
						<th>H.P Date</th>
							<th>Prin</th>
							<th>Interest</th><th>Dues</th>
							<th>Due Amount</th>
								<th>Created By</th>
					</tr></thead><tbody> <?php $gg = 0; $fff = 0; $qw = NULL;
					if($bname==$qw){
	$qry=mysqli_query($conn, "select * from customerdetails where mfin='$mfin' && hpdate5 between '$fdate' and '$tdate' order by hpl asc");
					}
else{
	$qry=mysqli_query($conn, "select * from customerdetails where mfin='$mfin' && bname='$bname' && hpdate5 between '$fdate' and '$tdate' order by hpl asc");
					}
					$n=mysqli_num_rows($qry);
						?></p>
					
					<?php 
					while($row=mysqli_fetch_array($qry))
						{ $gg++; $fff++;
							$mfin2 = $row['mfin'];
							$paydate = $row['hpdate']; 
					?>
					
				<tr>
				<td><?php echo $fff;?></td>
						<td><?php echo $row['hpl'];?></td>
						<td><?php echo $row['name']; ?></td>	
						<td><?php echo $row['model'];?></td>
						<td><?php $ffft = $row['inter']; $drd = $ffft * 12; echo round($drd,2); ?></td>
					<?php $dddd = $row['uimg']; if($dddd!= NULL) { ?>	<td><img src="user/<?php echo $row['uimg'];?>" width="40" height="40"/></td> <?php } else { ?>
					<td><img src="111.png" width="40" height="40"/></td> <?php } ?>
						<td><?php echo $row['vno'];?></td>
							<td><?php echo $row['vname'];?></td>
								
						<?php $hpl = $row['hpl'];
						$n10 = $row['duemnt']; //$n11 = 0;
						//$qry125=mysqli_query($conn, "select sum(paymnt) from user where mfin='$mfin2' &&  hpl=$hpl");
						//$row44 = mysqli_fetch_array($qry125);
						//$n11 = $row44[0];
				//$qry12=mysqli_query($conn, "select * from net where mfin='$mfin2' &&  hpl=$hpl");
				//$n5=mysqli_num_rows($qry12); 
					//$qry122=mysqli_query($conn, "select * from sizzing where mfin='$mfin2' &&  hpl=$hpl");
				//$n55=mysqli_num_rows($qry122); 
				$sts = $row['status'];
	if($sts == 'Closed') {
						?>
				<td><button class="btn btn-block"><b>Closed</b></button></td> <?php }
				elseif($sts == 'Sized') { ?>
				
				<td><button class="btn btn-danger"><b>Sizzied</b></button></td> <?php }
elseif($sts == 'Reloan') { ?>
				
				<td><button class="btn btn-info"><b>Reloan</b></button></td> <?php }
				else {?>
				<td><button class="btn btn-success"><b>Active</b></button></td> <?php }?>
	
					<td><?php echo $row['bname'];?></td>
						<td><?php echo $row['pno'];?></td>
						<td><?php echo $row['hpamount'];?></td><td><?php echo $row['hpdate'];?></td>
						<td><?php echo $row['dueamt'];?></td>
						<td><?php echo $row['interest'];?></td><td><?php echo $row['duemnt'];?></td>
						<td><?php echo $row['total'];?></td>
						<td><?php echo $row['scode'];?></td>
						
					</tr>
					<?php
						}
				
			?></tbody>	</table>
			<b><h4><center><?php echo "Totally ".$gg." Documents"; ?></center></b></h4>	
									
						<?php 		}
							?>
	  </div>
</form>
</div>

</div></div>
</div></div></div></div></div></div> <?php include "layouts/footer.php"; ?></body></html>
