<!DOCTYPE html>
<html lang="en"> 

<head>
<?php ob_start(); ?>
<?php   require_once 'head_link.php'; ?>

</head>

<body>
 
<?php   require_once 'header1.php'; ?> 

<?php
	if(isset($_GET['delete_id']))
	{
		
		
		// it will delete an actual record from db
		$stmt_delete = $DB_con->prepare('DELETE FROM orders_dues WHERE id =:uid');
		$stmt_delete->bindParam(':uid',$_GET['delete_id']);
		$stmt_delete->execute();
		
			}
?>

<?php  require_once 'sidebar.php'; ?>


  <main id="main" class="main"> 

    <div class="pagetitle bg-light rounded p-2">
     <h1>Students Recent Dues | <span> <a target="_blank" href="dues-report-all">  <i class="bi bi-printer"></i> </a> </span> |  <span> <a href="students-dues-paid">   <i class="bi bi-check2-circle"></i> </a> </span> </h1>
    </div> 

    <section class="section">
      <div class="row">
	  
        <div class="col-lg-12">

          <div class="card">
            <div class="card-body">
             
              <table class="table table-hover datatable">
                 <thead class="bg-light"> 
							<tr>
                                
                                 
                                <th>SL </th>
                                <th>Inv.Date </th>
                                <th>Last Update</th>
                               
                                <th>Invoice</th>								
                                 
                                <th>Student Name</th> 
								
								 
								<th>Paid</th>
								<th>Rec.Due</th>
								
								<th>Pym.Type</th>
								
                            </tr>
                        </thead>
						
						
             <tbody id="tbody">

	
	
	<?php
	$eq=mysqli_query($con,"select * from orders_dues  
	Left JOIN customer ON customer.customer_id = orders_dues.customer_id
	left join product on product.product_id = customer.course_id
    Where orders_dues.recent_due !=0  	
	ORDER BY orders_dues.last_update DESC ");
	
	 
	while($eqrow=mysqli_fetch_array($eq)){
		
	$Total+=$eqrow['recent_due'];
	?>
			<tr>
			
			<td><?php echo ++$sl; ?>  </td>
			
			<td><?php echo date("M d,Y", strtotime($eqrow['order_date'])); ?></td>
			<td><?php echo date("M d,Y", strtotime($eqrow['last_update'])); ?></td>
			
			<td><?php echo $eqrow['custom_invoice']; ?>  </td>
			 
			<td> <a target="_blank" href="due-paid-print?edit_id=<?php echo $eqrow['customer_id']; ?>"> <?php echo $eqrow['client_name']; ?> - <?php echo $eqrow['product_name']; ?> </a></td> 
			
		 
			<td><?php echo $eqrow['paid']; ?></td>
			<td><?php echo $eqrow['recent_due']; ?>  </td>
			
			<td><?php echo $eqrow['cuses']; ?>  </td>
		<!--	<td>
		 		<a class="btn btn-info" href="dues_edit.php?edit_id=<?php echo $eqrow['id']; ?>" title="click for edit" onclick="return confirm('Are You Sure To Edit ?')"><span class="glyphicon glyphicon-edit"></span> Edit</a> 
				<a class="btn btn-danger" href="?delete_id=<?php echo $eqrow['id']; ?>" title="click for delete" onclick="return confirm('Are You Sure To Delete ?')"><span class="glyphicon glyphicon-remove-circle"></span> Delete</a>  
			</td>
           -->			
          </tr>			
	
<?php
}
?>

<tr> 
<td colspan="13" > <center> <b>Total Recent Due : <?php echo $Total; ?> /- </center> </b></td>
</tr>	  



</tbody>
              </table>
            
            </div>
          </div>

        </div>
      </div>
    </section>

  </main>
  
  <?php  require_once 'footer1.php'; ?>