<?php 
     
 require_once "labClass.php";
  
 $con = new labClass();
  
 $chkp= $con->getUsersRecord(); 
    
     
 if ($chkp->rowCount()>0) {

  $chp=$chkp->fetchAll();
  ?>
  <div class="container-fluid " id="co">
  <small><h6>STAFF'S PROFILE REPORT</h6></small> 
  <table class="table table-bordered table-striped">
  <thead class="bg-secondary">
   <th>  
        <small><h6>EMP ID/NAME</h6></small>
        </th>
        <th>
        <small><h6>PHONE NO</h6></small>
        </th>
         <th>
        <small><h6>EMAIL</h6></small>
        </th>
       <th>
        <small><h6>GENDER</h6></small>
        </th>
        <th>
        <small><h6>DATE OF BIRTH</h6></small>
        </th>
        <th>
        <small><h6>ADDRESS</h6></small>
        </th>
        <th>
        <small><h6>NATIONALITY</h6></small>
        </th>
        <th>
        <small><h6>OCCUPATION</h6></small>
      </th>
       <th>
        <small><h6>DEPARTMENT</h6></small>
      </th>
       <th>
        <small><h6>DATE HIRED</h6></small>
     </th>
   </thead>
<tbody>
   
  <?php

 foreach ($chp as $key => $p) {
 
  ?>


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

  <td>
        <small> <?php echo $p['phoneno'];?></small>
  </td> 
     <td>
        <small> <?php echo $p['email'];?></small>
  </td>
  <td> <small>
    <?php echo $p['gender'];?></small>
  </td>
    
  <td> <small>
       <?php echo $p['dob'];?></small>
  </td>
  <td><small> 
    <?php echo $p['address'];?></small>
  </td>
 <td> <small>
    <?php echo $p['citizen'];?></small>
  </td>
  <td class="col"> <small>
    <?php echo $p['occupation'];?></small>
  </td>
   <td class="col"> <small>
    <?php echo $p['department'];?></small>
  </td>
  <td><small> 
    <?php echo $p['dhired'];?></small>
  </td>
</tr>

  <?php
}
?>
</tbody> 
 </table>
</div><div>
   <button type="submit" class="btn btn-primary" value="Print" style="width:10%; height:30px;" onclick="printPageArea();">Print </button>
</div>
 
<?php
}
?>

<script type="text/javascript">
  function printPageArea(){
    var printContent = document.getElementById('co').innerHTML;
    var originalContent = document.body.innerHTML;
    document.body.innerHTML = printContent;
    window.print();
    document.body.innerHTML = originalContent;
}

</script>