<?php ob_start(); ?>
<!DOCTYPE html>
<html lang="en">  

<head>
<?php   require_once 'head_link.php'; ?>

</head>

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


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


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

    <div class="pagetitle">
     <h1>Product History |  <span> <a href="product-list">   <i class="bi bi-table"></i> </a> </span> </h1>
       <hr>
    </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.No </th>
                               <th> Date </th>
                               <th> Product Name </th>
			
			<th> Sale.Qty </th>
			
			
			<th> Price </th>
			<th> Discount </th>
			<th> Total </th>
			<th> Type </th>
								
                            </tr>
                        </thead>
               <tbody id="tbody">
	<?php 
	$sl=0;
	$eq=mysqli_query($con,"SELECT Distinct orders.custom_invoice_no,product.product_name,order_item_all.rate,
	              order_item_all.order_quantity, order_item_all.total as total_rate ,
	              order_item_all.entry_date,order_item_all.single_discount,order_item_all.user_id,order_item_all.comments
	              FROM `order_item_all`
	        
			 Left join orders on orders.order_id= order_item_all.order_id
			 Left join product on product.product_id= order_item_all.product_id			 
			 
             where order_item_all.user_id='".$_SESSION['id']."'
             order by order_item_all.order_item_id	desc	 limit 300	 
			");
			
	while($eqrow=mysqli_fetch_array($eq)){
	
	?>
			<tr>
			<td><?php echo ++$sl; ?>  </td>
			<td><?php echo $eqrow['custom_invoice_no']; ?>  </td>
			<td><?php echo date("d-M-Y", strtotime($eqrow['entry_date'])); ?></td>
			<td><?php echo $eqrow['product_name']; ?>  </td>
			
			<td><?php echo $eqrow['order_quantity']; ?>  </td>
			
			<td><?php echo $eqrow['rate']; ?>  </td>
			<td><?php echo $eqrow['single_discount']; ?>  </td>
			<td><?php echo $eqrow['total_rate']; ?>  </td>
			<td><?php echo $eqrow['comments']; ?>  </td>
			
          </tr>				
		  
		<?php
		}  
		?>

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

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

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