<?php include "layouts/menu.php"; ?> <div class="right_col" role="main">
            <div class="row">
                 <!-- page header -->
                <div class="col-lg-12">
                    <h1 class="page-header  alert alert-info">Customers Paid 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-heading">
                             Details
                        </div>
                        <div class="panel-body">
                            <div class="row">  
   <div class="alert alert-info">Customer Details</div>  
                    <?php
						$qry=mysqli_query($conn, "select * from user where mfin='$mfin'");
						$n=mysqli_num_rows($qry);
						if($n==0)
						{
							echo "Nothing To Display";
						}
						else
					{ 
						?></p>
					 <table id="datatable-buttons" id="datatable-buttons" class="table table-striped table-bordered">
				<thead>
						<tr>
						<th>Loan No</th>
						<th>Receipt No</th>
						<th>Name</th>
						<th>Vehicle No</th>
						<th>Due Date</th>
						<th>Pay Date</th>
						<th>Due Amount</th>
						<th>Principle</th>
						<th>Interest</th>
						<th>Fine</th>
						<th>Pay Amount</th>
						<th>Balance</th>
						<th>Status</th>
						<th>Edit</th>
						<th>Delete</th>	
					</tr></thead>
					<tbody><?php
							for($ri = 5000;$ri>0;$ri--)
  {
$qry=mysqli_query($conn, "select * from user where mfin='$mfin' &&  roll=$ri");
				$n=mysqli_num_rows($qry);
$row=mysqli_fetch_array($qry);
$x = $row['hpl'];
						if($n==0)
						{
							$x++;
						}
						else
					{
?>				<tr>
				
						<td><?php echo $row['hpl'];?></td>
						<td><?php echo $row['roll'];?></td>
						<td><?php echo $row['name']; ?></td>
						<td><?php echo $row['vno'];?></td>
						<td><?php echo $row['duedate'];?></td>
						<td><?php echo $row['paydate'];?></td>
						<td><?php echo $row['dueamount'];?></td>
						<td><?php echo $row['pass'];?></td>
						<td><?php echo $row['rno'];?></td>
						<td><?php echo $row['fine'];?></td>
						<td><?php echo $row['urname'];?></td>
						<td><?php echo $row['bal'];?></td>
						
						<?php $hpl = $row['hpl'];
				$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">Closed</button></td> <?php }  elseif($n55 != 0) { ?>
				<td><button class="btn btn-danger">sizzied</button></td> <?php } else {?>
				<td><button class="btn btn-info">Active</button></td> <?php }?>
									<td><a href="editdue.php?fid=<?php echo $row['fid'];?>&hpl=<?php echo $row['hpl']?>">Edit</a></td>
									

					<td><a href="deletedue.php?fid=<?php echo $row['fid'];?>" onclick="return confirm('Are you sure WANT TO DELETE?');">Delete</a></td>
							</tr>
					<?php
						$x++;}
						$qry=mysqli_query($conn, "select * from net where mfin='$mfin' &&  rrno=$ri");
				$n=mysqli_num_rows($qry);
$row1=mysqli_fetch_array($qry); $x = $row1['hpl'];
$qry5=mysqli_query($conn, "select * from customerdetails where mfin='$mfin' &&  hpl='$x'");
$row5=mysqli_fetch_array($qry5);

						if($n==0)
						{
							$x++;
						}
						else
					{
?>				<tr class="warning">
					<col width="100px">
						<td><?php echo $row1['hpl'];?></td>
						<td><?php echo $row1['rrno'];?></td>
						<td><?php echo $row1['name']; ?></td>
						<td><?php echo $row5['vno']; ?></td>
						<td><?php echo $row1['duedate'];?></td>
						<td><?php echo $row1['paydate'];?></td>
						<td>-</td>
						<td><?php echo $row1['dueamt'];?></td>
						<td><?php echo $row1['amt'];?></td>
						<td><?php echo $row1['fine'];?></td>
						<td><?php echo $row1['tot'];?></td>
						<td>0</td>
						
						<?php $hpl = $row1['hpl'];
				$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">Closed</button></td> <?php }  elseif($n55 != 0) { ?>
				<td><button class="btn btn-danger">sizzied</button></td> <?php } else {?>
				<td><button class="btn btn-info">Active</button></td> <?php }?>
									<td><a href="editdue.php?fid=<?php echo $row['fid'];?>&hpl=<?php echo $row['hpl']?>">Edit</a></td>
									

					<td><a href="deletedue.php?fid=<?php echo $row['fid'];?>" onclick="return confirm('Are you sure WANT TO DELETE?');">Delete</a></td>
					</tr>
					<?php
						$x++;}
						
						}
					}
				
					?> </tbody>
					</table>
					
</div>
</div></div>
</div></div></div> <?php include "layouts/footer.php"; ?></body></html>
