<?php
   $cc=0;
 
 
  require_once"labClass.php";

  $con=new labClass();
  $dat1=$_POST['dat1'];
  $dat2=$_POST['dat2'];
  $user=$_POST['user'];
  $rQ= $con->getDrConsultByDate($dat1,$dat2,$user);
 
  if ($rQ->rowCount()>0) {

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

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


  <table class="table table-bordered table-striped">
  <thead class="bg-secondary">
   <th>  
        <small><h6>PATIENT ID</h6></small>
      </th>
      <th>  
        <small><h6>PATIENT NAME</h6></small>
      </th>
       
      <th>  
        <small><h6>GENDER</h6></small>
      </th>
      <th>  
        <small><h6>S. CATEGORY</h6></small>
      </th>

      <th>  
        <small><h6>DESCRIPTION</h6></small>
      </th>

      <th>  
        <small><h6>BILL AMOUNT</h6></small>
      </th>
      <th>
        <small><h6>P. OPTION</h6></small>
      </th>
      
       
        <th>
        <small><h6>DATE</h6></small>
      </th>
    </thead>
  <tbody>
   
  <?php
 $ttPrice=0;
 foreach ($chp as $key => $p) {

       $patientID=$p['patientID'];
    
  
 
       $ttPrice=$ttPrice+$p['amount'];
       $cc++; 
      $pn= $con->getThisPatientD($patientID)->fetch();
        ?>


    <tr>
    <td>
        <?php echo $p['patientID'];?>
      </td>
      <td> 
      <?php echo $pn['fname']." ". $pn['mname']." ".$pn['lname'];?>
      </td> 
       
      <td> 

         <?php echo $pn['gender'];?> 
       
      </td> 

       <td> 
         <?php echo $p['sCategory'];?> 
       
      </td>
       <td> 

         <?php echo $p['descript'];?> 
       
      </td>
       <td> 

         <?php echo $p['amount'];?> 
       
      </td>
      

     <td>
        <?php echo $p['paymtOp'].": By ".$p['billBy'];?>
     </td> 
    
     
     
      <td>
        <?php echo $p['dateB'];?> 
      </td> 
  </tr>

 
  <?php
 
}
  $cc=0;
}
?>
 <tr>
  <td colspan="5" align="right">Total:</td>
  <td>
     <input type="text" style="width:100%;" disabled="true" name="ttPrice<?php echo $cc;?>" id="ttPrice<?php echo $cc;?>"  value="<?php echo $ttPrice;?>" />
  </td>
  <td colspan="2"></td>
 </tr>
</tbody>
</table>
</div>
</div>
<div>
 