<?php
$cc=0;
//if(isset($_POST["sdate"]))
//{
 $iname=$_POST["iname"];
  require_once"labClass.php";
  $con=new labClass();
 
  ?>  
  <div class="container-fluid" id="co"> 
  <small><h6>PRODUCT  REPORTS:</h6></small>
  <?php  $r= $con->getThisStoreItem($iname)->fetch();
  echo "Product name: ".$r['iname'].     " :: Qty:". $r['iqty'];;
  ?>
  <table class="table" width="70%">
 <tr>
  <td style="width:33%;">
  <h4>Purchase records:</h4></small>
  
  
  
  
  
   <?php
  $rQ= $con->getStorePurchaseTrackR($iname);
  if ($rQ->rowCount()>0) {
  $chp=$rQ->fetchAll();
 ?>
  <table class="table table-bordered table-striped">
  <thead class="bg-secondary">
       <th>
        <small><h6>DATE</h6></small>
      </th>
      <th>  
        <small><h6>ITEM NAME</h6></small>
      </th>
     
      <th>  
        <small><h6>QTY</h6></small>
      </th>
     
       
    </thead>
  <tbody>
   
  <?php 
 $tqtyp=0;
 foreach ($chp as $key => $p) {
        $cc++;
        ?>
    <tr>
     <td> 
    <?php echo $p['entryD'];?> 
    </td>
    <td> 
      <?php echo $p['iname'];?>
    </td> 
    <td> 
    <?php $tqtyp=$tqtyp+$p['eQty']; echo $p['eQty'];?> 
    </td>
    
   
    
  </tr>
<?php
}
  $cc=0;
?>
 <tr>
  <td colspan="2" align="right">Total:</td>
    <td>
     <?php echo $tqtyp;?>
  </td>
  
 </tr>
</tbody>
</table>
 
<?php
}
else{
?>
<small><h6 class="text-danger">No matching record!..</h6></small>
<?php
}
?> 
 </td>

  <td style="width:33%;" > 
  <h4>Transfer report:</h4></small>
  <?php
  $rQ= $con->getStoreTransTrackR($iname);
  if ($rQ->rowCount()>0) {
  $chp=$rQ->fetchAll();
 ?>
  <table class="table table-bordered table-striped">
  <thead class="bg-secondary">
     <th>
        <small><h6>DATE</h6></small>
      </th>
      <th>  
        <small><h6>ITEM NAME</h6></small>
      </th>
      <th>  
        <small><h6>QTY</h6></small>
      </th>
            
    </thead>
  <tbody>
   
  <?php
 $tqtys=0; 
 foreach ($chp as $key => $p) {
        $cc++;
        ?>
    <tr>
      <td> 
    <?php echo $p['entryD'];?> 
    </td>
    <td> 
      <?php echo $p['iname'];?>
    </td> 
    <td> 
    <?php echo $p['eQty'];?> 
    </td>
      
    <?php $tqtys=$tqtys+$p['eQty'];// echo $p['eQty'];?>
     
    
  </tr>
  <?php
}
  $cc=0;
?>
  <tr>
  <td colspan="2" align="right">Total:</td>
    <td>
     <?php echo $tqtys;?>
  </td>
  
 </tr>

 
  

   
</tbody>

</table>

 

<?php
}
else{
?>
<small><h6 class="text-danger">No matching record!..</h6></small>
<?php
}
?> 
  
  
  
  
  
  
  
  </td>
  <td style="width:33%;" > 
  <h4>Dumped records:</h4></small>
  
  
  <?php
  $rQ= $con->getDumpsTrackR($iname);
  if ($rQ->rowCount()>0) {
  $chp=$rQ->fetchAll();
 ?>
  <table class="table table-bordered table-striped">
  <thead class="bg-secondary">
      <th>
        <small><h6>DATE.</h6></small>
      </th>
      <th>  
        <small><h6>ITEM NAME</h6></small>
      </th>
       
      <th>  
        <small><h6> QTY</h6></small>
      </th>
      
    </thead>
  <tbody>
 <?php
 $tqtyd=0; 
 foreach ($chp as $key => $p) {
        $cc++;
        ?>
    <tr>
     <td> 
    <?php echo $p['entryD'];?> 
    </td>
    <td> 
      <?php echo $p['iname'];?>
    </td>
    
    <td> 
    <?php echo $p['eQty'];?> 
    </td>
     
      <?php 
     $tqtyd=$tqtyd+$p['eQty']; 
      ?> 
  
    
  </tr>
<?php
}
  $cc=0;
?>
 <tr>
  <td colspan="2" align="right">Total:</td>
    <td>
      <?php echo $tqtyd;?>
  </td>
  
 </tr>
</tbody>
</table>

 
<?php
}
else{
?>
<small><h6 class="text-danger">No matching record!..</h6></small>
<?php
}
 ?>
  </td>     
 </tr>
 </table>
  </div>
 