<?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">Pending List</h1>
                </div>
                <!--end page header -->
            </div>
            <div class="row">
                <div class="col-lg-12">
                    <!-- Form Elements -->
					 <!-- Form Elements -->
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            Vehicle Loan
                        </div>
                        <div class="panel-body">
                            <div class="row">
                   
<div id="mydiv">
<input type="button" value="Print" onclick="PrintElem('#mydiv')"  style="margin:20px;">
<a href="pendcat.php"><button class="btn btn-primary">Catogory Wise</button></a>&nbsp;&nbsp;&nbsp;
<div class="table-responsive">
<center><a href="pen.php">Add Columns</a></center>
  <table class="table table-bordered table-hover"><thead>
  <tr class="info"><th>Hpl</th>
						<th>Name</th>
					<th>Image</th>
						<th>Reg Date</th>
						<th>Phone</th>
						<th>Due Amount</th>
						<th>L.D.Date</th>
						<th>Total due </th>
						<th>Till due </th>
						<th>payed Due</th>
						<th>Pending Due</th>
						<th>Pending amnt</th>
						<th>Rdate</th>
						<th>Add Response</th>
					</tr> </thead>
					<?php $hpl=$_REQUEST['hpl'];?>
					<?php 
$qry29 = "SELECT * FROM customerdetails where mfin='$mfin' &&  hpl='$hpl'";
  $result9 = mysqli_query($conn, $qry29);
while($rowt = mysqli_fetch_array($result9))
  { $x = $rowt['hpl'];
  $qry2 = "SELECT * FROM customerdetails where mfin='$mfin' &&  hpl='$x'";
  $result = mysqli_query($conn, $qry2);
	if (mysqli_num_rows($result) >= 1) 
				{ 
	  $rs = mysqli_query($conn, $qry2);
	  // Loop the recordset $rs
	// Each row will be made into an array ($row) using mysqli_fetch_array
	while($row = mysqli_fetch_array($rs)) {

	   // Write the value of the column FirstName (which is now in the array $row)
	   $r = $row['name'];
	   $t = $row['hpdate'];
	   $tr = $row['pno'];
	   $u = $row['total'];
	   $pp = $row['duemnt'];
 $yt = $row['uimg'];
	   $row = str_replace('/', '-', $row['hpdate']);
  $d1 = strtotime($row);
$d2 = strtotime("today");
$min_date = min($d1, $d2);
$max_date = max($d1, $d2);
$i = 0; $ldd = 0;
while (($min_date = strtotime("+1 MONTH", $min_date)) <= $max_date) {
    $i++;
}}
$sql1 = "select sum(paymnt) from user where mfin='$mfin' &&  hpl='$x'";
$qt = mysqli_query($conn, $sql1);
$row1 = mysqli_fetch_array($qt);
if($i>$pp)
{$i=$pp;}
$n=$row1[0];
$e = $i - $n;
$f = $u * $e;
$qry1=mysqli_query($conn, "select * from response where mfin='$mfin' &&  hpl='$x'");
				$row1=mysqli_fetch_array($qry1);
				$nl=mysqli_num_rows($qry1);
						if($nl==0)
						{ $gh = 0;}
						else
						{ $gh = $row1['rdate']; }
						$qryt=mysqli_query($conn, "select * from user where mfin='$mfin' &&  hpl='$x'");
						while($rowe=mysqli_fetch_array($qryt))
						{
						$ldd = $rowe['paydate'];
						}

		$qry8=mysqli_query($conn, "select * from net where mfin='$mfin' &&  hpl='$x'");
				$row8=mysqli_fetch_array($qry8);
				$n8=mysqli_num_rows($qry8);
		if($n<$pp && $n8==0){?>
		
		
   <tbody>
		<tr>
					<td><a href="register.php?hpl=<?php echo $x; ?>"><font color="brown"><?php echo $x;?></font></a></td>
	                    <td><a href="register.php?hpl=<?php echo $x; ?>"><strong><?php echo $r;?></strong></a></td>
						<td><img src="user/<?php echo $yt;?>" width="70" height="60"/></td>
						<td><a href="register.php?hpl=<?php echo $x; ?>"><font color="brown"><?php echo $t;?></font></a></td>
						<td><a href="register.php?hpl=<?php echo $x; ?>"><font color="brown"><?php echo $tr;?></font></a></td>
						<td><a href="register.php?hpl=<?php echo $x; ?>"><font color="brown"><?php echo $u;?></font></a></td>
						<td><a href="register.php?hpl=<?php echo $x; ?>"><font color="brown"><?php echo $ldd;?></font></a></td>
						<td><a href="register.php?hpl=<?php echo $x; ?>"><font color="brown"><?php echo $pp;?></font></a></td>
						<td><a href="register.php?hpl=<?php echo $x; ?>"><font color="brown"><?php echo $i;?></font></a></td>
						<td><a href="register.php?hpl=<?php echo $x; ?>"><font color="brown"><?php echo $n;?></font></a></td>
						<td><a href="register.php?hpl=<?php echo $x; ?>"><font color="brown"><?php echo $e;?></font></a></td>
						<td><a href="register.php?hpl=<?php echo $x; ?>"><font color="brown"><?php echo $f;?></font></a></td>
						<td><a href="register.php?hpl=<?php echo $x; ?>"><font color="brown"><?php echo $gh;?></font></a></td>
						<td><a href="response.php?hpl=<?php echo $x;?>" target="_blank">Add Date</a></td>
						</tr></tbody>

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