<?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>
         <th class=""> 
        <small><h6>ACTION</h6></small>
     </th>
    </thead> 
   <tbody>
   
  <?php
$tex=0;
 foreach ($chp as $key => $p) {

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

 
  <tr>
  <td>
      
    <sup id="rdn<?php echo $cc;?>" class="text-danger" ></sup>
      <input type="hidden" name="exD<?php echo $cc;?>" id="exD<?php echo $cc;?>" value="<?php echo $p['expID'];?>"/>
       <?php echo $p['expID'];?>
  
       <?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>
          <td> 
        <input type="submit" name="add<?php echo $cc;?>" id="add<?php echo $cc;?>" value="Delete" id="submit" onclick="var exD =$('#exD<?php echo $cc;?>').val();  if(exD!='' ) { $.post('delexpensRpro.php',{exD:exD},function(data){$('#rdn<?php echo $cc;?>').html(data).show();});} else{document.getElementById('rdn<?php echo $cc;?>').innerHTML='Valide item detail required!..';}" />
  </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
}
?>

 