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

90 lines
3.5 KiB
PHP

<?php
include('includes/config/config.php');
include('includes/functions.php');
//include('pop_up_top.php');
header("Content-type:application/octet-stream");
header("Content-type: application/x-msdownload");
header("Content-Disposition: attachment; filename=pending_medical_examination_list_excel.xls");
header("Pragma: no-cache");
header("Expires: 0");
?>
<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:30px"><strong>Long Term Report </strong></td>
<td width="25%" align="left"> User : <?php echo $username ?></td>
</tr>
</table>
<table border="1" width="100%">
<?php
//$month=$_POST['month'];
$year = $_POST['year1'];
$today = date("Y-M-d");
//$sql_waste="SELECT c.ohc_type_name,a.waste_category_name,b.* FROM `waste_category` a inner join bio_medical_waste b on a.waste_category_id=b.waste_category inner join ohc_type c on c.ohc_type_id=b.ohc_type_id where b.ohc_type_id='".$_SESSION['current_ohcttype']."' ";
//$results_issue_items = mysqli_query($conn,$sql_issue_items);
//$sql=base64_decode($filterkey);
//$results= mysqli_query($conn,$sql_waste);
$sqll="SELECT count(*) as total FROM `medical_examination` WHERE DATEDIFF(next_due_date,'$today') <= 30 AND year(medical_entry_date) ='$year' ORDER BY medical_entry_date ASC";
$result_sqll=mysqli_query($conn,$sqll);
$num_rows=mysqli_num_rows($result_sqll);
$row0= mysqli_fetch_assoc($result_sqll);
// error_log("total".$row0['total']);
$sql="SELECT DATE_FORMAT(a.medical_entry_date, '%d-%m-%y') as date,a.*,b.patient_name,b.dept_id,b.employer_contractor_id,b.blood_group FROM `medical_examination` a JOIN patient_master b on a.patient_id=b.id WHERE DATEDIFF(next_due_date,'$today') <= 30 AND year(a.medical_entry_date) =$year and ORDER BY a.medical_entry_date ASC";
error_log($sql);
$result = mysqli_query($conn,$sql);
?>
<strong>
<tr bgcolor="#eeeeee">
<td align="left" width="2%">Sr.</td>
<td align="left" width="10%">emp code</td>
<td align="left" width="10%">medical entry date</td>
<td align="left" width="10%"> Name </td>
<td align="left" width="8%">Contractor</td>
<td valign="top" align="left" width="5%">DEPARTMENT</td>
<td width="5%" valign="top" align="left">Next Due Date</td>
<td valign="top" align="left" width="2%">contact no</td>
</tr>
<?php
$count=1;
while ($row1= mysqli_fetch_assoc($result)){
extract($row1);
// error_log($row1['employer_contractor_id']);
?>
<tr>
<td><?php echo $count?></td>
<td><?php echo $row1['medical_entry_date']?></td>
<td><?php echo $row1['emp_code']?></td>
<td><?php echo $row1['patient_name']?></td>
<td><?php echo getTableFieldValue('employer_contractor','employer_contractor_name',$row1['employer_contractor_id'],'id')?>
</td>
<td><?php echo getTableFieldValue('department','dept_name',$row1['dept_id'],'dept_id')?></td>
<td><?php echo $row1['next_due_date']?></td>
<td><?php echo $row1['primary_phone']?></td>
</tr>
<?php
$count++;
}
?>
<tr Height="10px">
<td colspan="8"><b>TOTAL: &nbsp;<?php echo $row0['total']?></b></td>
</tr>
</table>
</body>