<?php
$cc=0;
if(isset($_POST["sdate"]) &&  isset($_POST["dat1"]) && isset($_POST["dat2"]))
{
 $sdate=$_POST["sdate"];
 $dat1=$_POST['dat1'];   
 $dat2=$_POST['dat2'];
  require_once"labClass.php";
  $con=new labClass();
  $rQ= $con->getPharmExRBydate($dat1,$dat2);
  if ($rQ->rowCount()>0) {
  $chp=$rQ->fetchAll();
 ?>  
  <table class="table table-bordered" style="width:74%;">
    <thead> 
     <th class="">
        <small><h6>S/N- PURPOSE</h6></small>
     </th>
      <th class=""> 
        <small><h6>AMOUNT</h6></small>
      </th>
     <th class=""> 
        <small><h6>DATE</h6></small>
     </th>
    </thead> 
   <tbody>
   
  <?php
$tex=0;
 foreach ($chp as $key => $p) {

    $expID=$p['expID'];
    
      $cc++; 
     
        ?>

 
  <tr>
  <td>
  
       <?php echo $p['expID'];?>
      
        . <?php echo $p['exReason'];?>
         
  
  </td>
  <td> 
    <?php $tex=$tex+$p['exAmount']; echo $p['exAmount'];?>
  </td> 

  <td>
        <?php echo $p['exDate'];?>
  </td> 
     
</tr>
 
 
 
  <?php
 
}
  $cc=0;

 ?>
   <tr>
  <td>
   Total:
  
  </td>
  <td> 
    <?php echo $tex;?>
  </td> 

  <td> 
  </td> 
     
</tr> 
 </tbody>
</table> 
  
<div>
   <button type="submit" class="btn btn-primary" value="Print" style="width:10%; height:30px;" onclick="printPageArea();">Print </button>
</div>
<?php
}
else{
?>
<small><h6 class="text-danger">No matching record!..</h6></small>
<?php
}
}
else{
?>
<small><h6 class="text-danger">Valide date required!..</h6></small>
<?php
}
?>

 