<?php 
header("Content-type:application/octet-stream");

header("Content-type: application/x-msdownload"); 
header("Content-Disposition: attachment; filename=excel_users_list.xls"); 
header("Pragma: no-cache"); 
header("Expires: 0"); 
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
?>
<?php

// include("excel_ohc_header.php");
include('includes/config/config.php');
include('includes/functions.php')
//include('pop_up_top.php');
?>

<body>
    <table width="100%">
        <tr>
            <div style="font-size: 12px">
                <td width="25%" align="left"> Run Date : <?php  echo date("d-M-Y"); ?></td>
                <td width="50%" align="center" style="font-size: 20px"><strong>Users List</strong></td>
                <td width="25%" align="center"> User : <?php  echo $username ?></td>

        </tr>
    </table>
    <table border="1" width="100%">
    <?php 
  $sql=base64_decode($filterkey);
   
	 $result = mysqli_query($conn,$sql);
     
  $count=0;

  ?>
    <tr bgcolor="#eeeeee">
        <th>Sr.</th>
        <th>User ID</th>
        <th>User</th>
        <th>Emp ID</th>
        <th>Employee Code</th>
        <th>Email</th>
        <th>User Role</th>
        <th width="15%">OHC Type</th>
        <th>Status</th>
    </tr>
    <?php 
 
  while($rowOfEmployee=mysqli_fetch_array($result)){
	  $ohc_type_names=getCommaSeperatedValuesForInClause("select ohc_type_name from ohc_type","ohc_type_id",$rowOfEmployee['ohc_type']);
	   // $ohc_type_names = getTableFieldValue('tbl_users','ohc_type_name','ohc_type_id',$rowOfEmployee['ohc_type']);
if($rowOfEmployee['status']=='1'){
	$rowOfEmployee['status']="Active";
}else{
	$rowOfEmployee['status']="Inactive";
}
  $count=$count+1;
  ?>
    <tr>
        <td><?php  echo $count?></td>
        <td><?php  echo $rowOfEmployee['user_id']?></td>
        <td><?php  echo $rowOfEmployee['user_name']?></td>
        <td><?php  echo $rowOfEmployee['emp_id']?></td>
        <td><?php  echo $rowOfEmployee['emp_code']?></td>
        <td><?php  echo $rowOfEmployee['email']?></td>
        <td><?php  echo $rowOfEmployee['role_name']?></td>
        <td>
            <?php  echo $ohc_type_names ; ?>
        </td>
        <td><?php  echo $rowOfEmployee['status']?></td>
    </tr>
    <?php 

}
?>
</table>

</body>