<?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>
	<?php $fdate=$_REQUEST['fdate'];?>
  <?php $tdate=$_REQUEST['tdate'];?>
  <!--  page-wrapper -->
           <div class="right_col" role="main">
            <div class="row">
                 <!-- page header -->
                <div class="col-lg-12">
                    <h1 class="page-header  alert alert-info">Customers Of Vehicle Loan</h1>
                </div>
                <!--end page header -->
            </div>
			
            <div class="row">
                <div class="col-lg-12">
                    <!-- Form Elements -->
                    <div class="panel panel-default">
                        <div class="panel-body">
                            <div class="row">
   <table id="datatable-buttons" id="datatable-buttons" class="table table-striped table-bordered">
					<thead>
						<tr>
						<th>Loan No</th>
						<th>Name</th>
						<th>User Image</th>
						<th>Vehicle No</th>
						<th>Status</th>
						<th>-</th>
						<th>Phone No</th>
						<th>H.P Amount</th>
						<th>H.P Date</th>
						
					</tr></thead>
					<tbody>
     <?php
		while (strtotime($fdate) <= strtotime($tdate)) 
								{
									   $paydate = $fdate; 
$qry=mysqli_query($conn, "select * from customerdetails where mfin='$mfin' && hpdate='$paydate'");
				$n=mysqli_num_rows($qry);
				while($row=mysqli_fetch_array($qry))
  { 
$x = $row['hpl'];
						if($n==0)
						{
							$x++;
						}
						else
					{
?>				<tr>
				
						<td><?php echo $row['hpl'];?></td>
						<td><?php echo $row['name']; ?></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>
						<?php $hpl = $row['hpl'];
						$n10 = $row['duemnt']; $n11 = 0;
						$qry125=mysqli_query($conn, "select sum(paymnt) from user where mfin='$mfin' &&  hpl=$hpl");
						$row44 = mysqli_fetch_array($qry125);
						$n11 = $row44[0];
				$qry12=mysqli_query($conn, "select * from net where mfin='$mfin' &&  hpl=$hpl");
				$n5=mysqli_num_rows($qry12); 
					$qry122=mysqli_query($conn, "select * from sizzing where mfin='$mfin' &&  hpl=$hpl");
				$n55=mysqli_num_rows($qry122); 
	if($n5 != 0) {
						?>
				<td><button class="btn btn-block"><b>Closed</b></button></td> <?php }
elseif($n10 == $n11) { ?>
				
				<td><button class="btn btn-block"><b>Closed</b></button></td> <?php }
				elseif($n55 != 0) { ?>
				
				<td><button class="btn btn-danger"><b>Sizzied</b></button></td> <?php } else {?>
				<td><button class="btn btn-success"><b>Active</b></button></td> <?php }?>
			<td>
<a href="register55.php?hpl=<?php echo $row['hpl'];?>&name=<?php echo $row['name'];?>"><i class="fa fa-print fa-2x" aria-hidden="true"></i></a>
			<a href="editled.php?hpl=<?php echo $row['hpl'];?>&mfin=<?php echo $row['mfin'];?>"><i class="fa fa-edit fa-2x" aria-hidden="true"></i></a>
	<a href="udelete.php?hpl=<?php echo $row['hpl'];?>&name=<?php echo $row['name'];?>"><i class="fa fa-feed fa-2x" aria-hidden="true"></i></a>
		<?php $ff = $row['lat']; if($ff>0) { ?>	<a href="https://www.google.com/maps/?q=<?php echo $row['lat'];?>,<?php echo $row['lang'];?>" target="_blank"><i class="fa fa-map-marker fa-2x" aria-hidden="true"></i></a> <?php } ?>
	</td>
				
				
						<td><?php echo $row['pno'];?></td>
						<td><?php echo $row['hpamount'];?></td><td><?php echo $row['hpdate'];?></td>
						
					</tr>
					<?php
						$x++; } } $fdate = date ("d-m-Y", strtotime("+1 day", strtotime($fdate))); }
				
					?></tbody>
					</table>
					
</div>
</div></div>
</div></div></div> <?php include "layouts/footer.php"; ?>
  </body>
</html>

