<?php include "layouts/menu.php"; ?> 
		<?php $day=$_REQUEST['day'];?>
  <!--  page-wrapper -->
         <div class="right_col" role="main">
            <div class="row">
                 <!-- page header -->
                <div class="col-lg-12">
                    <h1 class="page-header">Pending Monthly Interest</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">
                            Pending List For Monthly Interest / Book Binding
                        </div>
                        <div class="panel-body">
                            <div class="row">
                   
<div id="mydiv">
<input type="button" value="Print" onclick="PrintElem('#mydiv')"  style="margin:20px;">
<div class="table-responsive">
  <table class="table table-bordered table-hover"><thead>
  <tr class="info">
						<th>Name</th>
						<th></th>
						<th>Loan No</th>
						<th>Reg Date</th>
						<th>Phone</th>
						<th>HP Amount</th>
						<th>Interest/Month </th>
						<th>Till Days </th>
						<th>payed Days</th>
						<th>Pending Days</th>
						
				</tr> </thead>
					
					<?php 
$x=1; 
while($x<=2000)
  {
  $qry2 = "SELECT * FROM customer 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['hpamount'];
	   $pp = $row['interest'];
	   $qry=mysqli_query($conn, "select * from user2 where mfin='$mfin' &&  hpl=$x");
						$n=mysqli_num_rows($qry);
	   while($row=mysqli_fetch_array($qry))
						{
						$ss = $row['paymnt'];
						}

	   $row = str_replace('/', '-', $ss);
  $d1 = strtotime($row);
$d2 = strtotime("today");
$min_date = min($d1, $d2);
$max_date = max($d1, $d2);
$i = 0;
while (($min_date = strtotime("+1 DAY", $min_date)) <= $max_date) {
    $i++;
}
	   $row5 = str_replace('/', '-', $t);
  $d15 = strtotime($row5);
$d25 = strtotime($ss);
$min_date = min($d15, $d25);
$max_date = max($d15, $d25);
$j = 0;
while (($min_date = strtotime("+1 DAY", $min_date)) <= $max_date) {
    $j++;
}}
$e = $i - $j;;
		?>
	<?php	if($e>=$day)
	{?>
  <tbody>
		<tr>
					
	                    <td><?php echo $r;?></td>
						<td></td>
						<td><?php echo $x;?></td>
						<td><?php echo $t;?></td>
						<td><?php echo $tr;?></td>
						<td><?php echo $u;?></td>
						<td><?php echo $pp;?></td>
						<td><?php echo $i;?></td>
						<td><?php echo $j;?></td>
						<td><?php echo $e;?></td>
				</tr></tbody>

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