<?php include "layouts/menu.php"; ?>
<?php
			session_start();
			
			if($_SESSION['uname']==""&&$_SESSION['pwd']=="")
			{
			
				header("location:index.php");
			}
			

?>
<script type="text/javascript">

    function PrintElem(elem)
    {
        Popup($(elem).html());
    }

    function Popup(data) 
    {
        var mywindow = window.open('', 'my div', 'height=400,width=600');
             /*optional stylesheet*/ //mywindow.document.write('<link rel="stylesheet" href="main.css" type="text/css" />');
               mywindow.document.write(data);
        mywindow.print();
        mywindow.close();

        return true;
    }

</script>
    <head>
	<title>SENTHOOR MURUGAN AUTO FINANCE</title>
	
	<link rel="shortcut icon" type="image/x-icon" href="images/jaff.ico">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
	<!-- Bootstrap -->
    <link href="css/bootstrap.min.css" rel="stylesheet">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
    <![endif]-->
  <link rel="stylesheet" href="style.css" type="text/css" media="screen" />
  <script type="text/javascript">var _siteRoot='index.html',_root='index.html';</script>
  <script type="text/javascript" src="js/jquery.js"></script>
  <script type="text/javascript" src="js/scripts.js"></script>
  </head>
  </style>
  <body style="background-color:#DFF0D8;">
	
  <div class="container">
  <div class="page-header">
  <div class="row">
  <div class="col-xs-2 col-md-1">
   <img src="images/kurunji.jpg" />
   </div>
   <div class="col-xs-1 col-md-6">
  <h1 style="color:#0A0B0D;">SENTHOOR MURUGAN AUTO FINANCE</h1>
  </div>
  </div>

</div>
    <ul class="nav nav-tabs">
    <li ><a href="user.php">Welcome</a></li>
	<li><a href="register1.php">Register</a></li>
	<li><a href="updatede.php">Update</a></li>
	 <li><a href="duemonth1.php">Insert month</a></li>
	<li><a href="search.php">Paydue</a></li>
	 <li><a href="getuserdue.php">View Dues</a></li>
	 <li><a href="all.php">Customer Details</a></li>
   <li> <a href="netamtt.php">Settle Amount</a></li>	  
<li><a href="closedacc.php">Full Settlement</a></li>
<li><a href="doc.php">Documentation Charge</a></li>
   <li><a href="hpl.php">Amount</a></li>	
 <li><a href="tallylogin.php">Tally</a></li>
 <li class="active"><a href="pendinglist.php">Pending List</a></li>
  <li><a href="changepwd.php">Change Password</a></li>
 <li><a href="contactmsg.php">Contact</a></li>
  <li><a href="page3.php">Logout</a></li>
  
</ul>
<div id="mydiv">
  <input type="button" value="Print" onclick="PrintElem('#mydiv')"  style="margin:20px;"><table table class="table" border="0" align="center" cellspacing="0" cellpadding="10" width="100%" style="table-layout: fixed;">
					<col width="100px">
						<tr class="danger" style="color:purple;">
						<th>Name</th>
						<th></th>
						<th>Loan No</th>
						<th>Reg Date</th>
						<th></th>
						<th>Hp Amount</th>
						<th>Last Pay Date </th>
						
						<th>Pending Days</th>
						<th>Pending Amnt</th>
					</tr>
					
					<?php 
$x=1001; 
while($x<=10000)
  {
  $qry=mysqli_query($conn, "select * from user2 where mfin='$mfin' &&  hpl=$x");
						$n=mysqli_num_rows($qry);
						
						if($n==0)
						{
						$qryy=mysqli_query($conn, "select * from customer where mfin='$mfin' &&  hpl=$x");
                          $row2=mysqli_fetch_array($qryy);
							$ss = $row2['hpdate'];
						}
						else
					    {
						while($row=mysqli_fetch_array($qry))
						{
						$sss = $row['paymnt'];
						}
						$ss = date("d-m-Y", strtotime("$sss + " . 1 . " day"));
						}
  $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'];
	   $u = $row['interest'];
	   $pp = $row['hpamount'];

	   $row = str_replace('/', '-', $row['hpdate']);
  $d1 = strtotime($row);
$d2 = strtotime("today");
$min_date = min($d1, $d2);
$max_date = max($d1, $d2);
$i = 0;
while (($min_date = strtotime("+1 MONTH", $min_date)) <= $max_date) {
    $i++;
}}
$diff = abs(strtotime($date2) - strtotime($date1));
$days = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
$e = $days;
$f = $u * $e;
		?>
   <tr class="warning">
					<col width="100px">
					
	                    <td><?php echo $r;?></td>
						<td></td>
						<td><?php echo $x;?></td>
						<td><?php echo $t;?></td>
						<td></td>
						<td><?php echo $pp;?></td>
						<td><?php echo $sss;?></td>
						
						<td><?php echo $e;?></td>
						<td><?php echo $f;?></td></tr>

<?php			
				
				}$x++;	}?>
				 <b><a href="pending.php"><b style="margin:50px;">Pending</b></a></b>
				</table>
 <div class="panel-footer">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&copy;2013 Copyright SENTHOOR MURUGAN FINANCE. All Rights Reserved. </div>
 
</div>
</div>
	</body>
</html>		