ESH/mediclaim_report_excel.php
2024-10-23 18:28:06 +05:30

170 lines
3.9 KiB
PHP

<?php
include ('includes/config/config.php');
include ('includes/functions.php');
header("Content-type:application/octet-stream");
header("Content-type: application/x-msdownload");
header("Content-Disposition: attachment; filename=mediclaim_report_excel.xls");
header("Pragma: no-cache");
header("Expires: 0");
error_reporting(E_ERROR | E_PARSE);
?>
<link href="includes/css-js/admin.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.btn {
background-color: #4CAF50;
border-radius : 5%; /* Green */
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
}
@media print {
#printPageButton {
display: none;
}
}
</style>
<body>
<?php $queryc = "select * from company_profile ";
// echo $query;
$resultc = mysqli_query($conn,$queryc);
$row_company = mysqli_fetch_array($resultc);?>
<!-- <div align="right" >
<button align ="center" id="printPageButton" class="btn btn-success" onClick="window.print();">Print</button>
</div> -->
<table width="100%" >
<tr><div style="font-size:12px">
<td colspan="12" align="center" style="font-size:20px"><strong><?=$row_company['company_name']?></strong></td>
</tr>
<tr>
<td colspan="12" align="center" ><strong><?=$row_company['address']?></strong></td>
</tr>
<tr>
<td colspan="12" align="center" ><strong>LIST OF MEDICLAIM PERSONS OF TATA METALIKS LIMITED </strong></td>
</tr>
</table>
<table border="1" cellspacing="0" width="100%">
<tr>
<th>SR.NO.</th>
<th>EMP. CODE/P.NO.</th>
<th>BUSINESS UINT</th>
<th>NAME OF EMPLOYEE</th>
<th>DATE OF BIRTH</th>
<th>EMPLOYEE CADRE LEVEL</th>
<th>DEPLOYMENT LOCATION</th>
<th>MOBILE NO</th>
<th>NAME OF DEPENDENT</th>
<th>RELATION</th>
<th>DOB</th>
<th>CURRENT AGE</th>
</tr>
<?php
if($_POST['category'] == 'tml'){
$sql_med = "select a.dob,a.id,a.emp_code,a.bu_id,a.patient_name,a.dob,a.emp_cadre,a.deployment_location,a.primary_phone from patient_master a where a.employer_contractor_id='355'";
}
else{
$sql_med = "select a.dob,a.id,a.emp_code,a.bu_id,a.patient_name,a.dob,a.emp_cadre,a.deployment_location,a.primary_phone from patient_master a";
}
$result_med = mysqli_query($conn,$sql_med);
$count = 1;
while($row_med = mysqli_fetch_array($result_med)){
$sql_fam = "select * from emp_family_members where emp_id = '".$row_med['id']."'";
error_log("FAMILY QUERY:".$sql_fam);
$result_fam = mysqli_query($conn,$sql_fam);
$num_fam = mysqli_num_rows($result_fam);
?>
<tr>
<td rowspan="<?=$num_fam+1?>"><?=$count?></td>
<td rowspan="<?=$num_fam+1?>"><?=$row_med['emp_code']?></td>
<td rowspan="<?=$num_fam+1?>"><?=getFieldFromTable('bu_name','bussiness_unit','bu_id',$row_med['bu_id'])?></td>
<td rowspan="<?=$num_fam+1?>"><?=$row_med['patient_name']?></td>
<td rowspan="<?=$num_fam+1?>"><?=date("d-M-Y",strtotime($row_med['dob']))?></td>
<td rowspan="<?=$num_fam+1?>"><?=getFieldFromTable('emp_cadre','emp_cadre','emp_cadre_id',$row_med['emp_cadre'])?></td>
<td rowspan="<?=$num_fam+1?>"><?=getFieldFromTable('branch_name','branch','branch_id',$row_med['deployment_location'])?></td>
<td rowspan="<?=$num_fam+1?>"><?=$row_med['primary_phone']?></td>
</tr>
<?php while($row_fam = mysqli_fetch_array($result_fam)){ ?>
<?php if($row_fam['name'] != '' || $row_fam['name'] != null){ ?>
<tr>
<td><?=$row_fam['name']?></td>
<td><?=$row_fam['relation_type']?></td>
<td><?=date("d-M-Y",strtotime($row_fam['dob']))?></td>
<td><?=ageCalculator($row_fam['dob'])?></td>
</tr>
<?php } else {?>
<tr>
<td>Employee</td>
<td>Self</td>
<td>NA</td>
<td>NA</td>
</tr>
<?php }?>
<?php }?>
<?php $count++;}?>
</table>
</body>
<script>
$(document).ready(function(){
window.print();
});
</script>
<?php
//include('pdf_footer.php');
?>