<?php 
 
 $cc=0;
 $dat1=$_POST['dat1'];
 $dat2=$_POST['dat2'];
  require_once "labClass.php";
  $con = new labClass();
  $sourceID=1;
  $chkp= $con->getWithdrawRBdt($sourceID,$dat1,$dat2);  
     
  if ($chkp->rowCount()>0) {

  $chp=$chkp->fetchAll();
  ?> 

  <div class="container-fluid" id="co">
    

 <div class="container-fluid " id="dpl">
     SHOP CASH IN HAND WITHDRAW:
  <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>TIME</h6></small>
     </th>
    </thead> 
   <tbody>
   
  <?php
$tex=0;
 foreach ($chp as $key => $p) {
    $recID=$p['recID'];
      $cc++;   
        ?>
  <tr>
  <td>
  <?php echo $p['recID'];?>
  . <?php echo $p['wreason'];?>
  </td>
  <td> 
    <?php $tex=$tex+$p['amount']; echo $p['amount'];?>
  </td> 
  <td>
     <?php echo $p['dateW'];?>
  </td> 
  <td>
    <?php echo $p['timeAt'];?>
  </td>  
</tr>
<?php
}
$cc=0;
?>
 <tr>
 <td>
   Total:
 </td>
 <td> 
    <?php echo $tex;?>
 </td> 
<td> 
</td> 
</tr> 
 </tbody>
</table> 
<?php
}
  ////////////////OTHER SOURCE OF INCOME
  $tex=0;
  
  $sourceID=2;
  
  $chkp= $con->getWithdrawRBdt($sourceID,$dat1,$dat2); 
     
if ($chkp->rowCount()>0) {

  $chp=$chkp->fetchAll();
  ?> 
 OTHER SOURCE WITHDRAW:
  <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>TIME</h6></small>
     </th>
    </thead> 
   <tbody>
   
  <?php
$tex=0;
 foreach ($chp as $key => $p) {
    $recID=$p['recID'];
      $cc++;   
        ?>
  <tr>
  <td>
  <?php echo $p['recID'];?>
 . <?php echo $p['wreason'];?>
 </td>
  <td> 
    <?php $tex=$tex+$p['amount']; echo $p['amount'];?>
  </td> 
  <td>
    <?php echo $p['dateW'];?>
  </td> 
  <td>
    <?php echo $p['timeAt'];?>
  </td>  
</tr>
<?php
}
$cc=0;
?>
<tr>
 <td>
  Total:
  </td>
  <td> 
    <?php echo $tex;?>
  </td> 
  <td> 
  </td> 
</tr> 
 </tbody>
</table> 
 <?php
}


  ////////////////OTHER SOURCE OF INCOME
  
  
  $tex=0;
  
  $sourceID=12;
  
  $chkp= $con->getWithdrawRBdt($sourceID,$dat1,$dat2); 
     
if ($chkp->rowCount()>0) {

  $chp=$chkp->fetchAll();
  ?> 
 BOTH SOURCE:
  <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>TIME</h6></small>
     </th>
    </thead> 
   <tbody>
   
  <?php
$tex=0;
 foreach ($chp as $key => $p) {
    $recID=$p['recID'];
      $cc++;   
        ?>
  <tr>
  <td>
  <?php echo $p['recID'];?>
 . <?php
  
$text = $p['wreason'];
 
$firstString = explode(":", $text)[0]; 
$firstString = trim($firstString);

echo $firstString; ?>
 </td>
  <td> 
    <?php $tex=$tex+$p['amount']; echo $p['amount'];?>
  </td> 
  <td>
    <?php echo $p['dateW'];?>
  </td> 
  <td>
    <?php echo $p['timeAt'];?>
  </td>  
</tr>
<?php
}
$cc=0;
?>
<tr>
 <td>
  Total:
  </td>
  <td> 
    <?php echo $tex;?>
  </td> 
  <td> 
  </td> 
</tr> 
 </tbody>
</table> 
 <?php
}
?>
 </div>
 </div>