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

164 lines
5.4 KiB
PHP

<?php
header('Content-Type: application/force-download');
header('Content-disposition: attachment; filename=Employee Detention List.xls');
include('includes/config/config.php');
include('includes/functions.php');
//include('pop_up_top.php');
?>
<html>
<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:40px"><strong>Employee Detention List</strong></td>
<td width="25%" align="left"> User : <?php echo $username ?></td>
</tr>
</table>
<style>
td {
font-size: 8px;
}
th {
font-size: 8px;
}
body {
font-size: 8px;
}
table,
td,
th {
font-family: Arial, Helvetica, sans-serif;
font-size: 8px;
font-weight: normal;
color: #000000;
text-decoration: none;
line-height: 10px;
}
</style>
<table border="1">
<?php
$sql=base64_decode($filterkey);
$result_detention = mysqli_query($conn,$sql);
//echo $result;
?><tr>
<th>Date</th>
<th>Ticket No</th>
<th>ECode / G.Pass</th>
<th>Patient Name</th>
<th>Detention Status</th>
<th>Doctor Consulted</th>
<th>Complaints.</th>
<th>Exam.Find.</th>
<th>Dign.</th>
<th>Trtmnt.</th>
<th>Referral</th>
<th>Follow up</th>
<th>Vitals</th>
</tr><?php
while($rowOfEmployeeAppointment=mysqli_fetch_array($result_detention)){
$treatment_text =getTreatmentText($rowOfEmployeeAppointment['appointment_id']);
$detention_status = '';
if($row_detention['disposal_time'] != null ){
$detention_status = "<span class='red'>Admitted</i></span>";
}
else{
$detention_status = "<span class='green'>Discharged</i></span>";
}
$doctor_attended_flag="No";
if ($rowOfEmployeeAppointment['doctor_attended_flag'] == 'Y') {
$doctor_attended_flag = "Yes";
}else{
$doctor_attended_flag = "No";
}
$check_results = "SBP:".$rowOfEmployeeAppointment['bp_sbp'].", DBP:".$rowOfEmployeeAppointment['bp_dbp'].", FBS:".$rowOfEmployeeAppointment['blood_sugar_fbs'].", RBS:".$rowOfEmployeeAppointment['blood_sugar_rbs'].", Temp:".$rowOfEmployeeAppointment['temperature'].", SPOC2%:".$rowOfEmployeeAppointment['spo2_percent'];
?><tr>
<td><?php echo $rowOfEmployeeAppointment['appointment_date']?></td>
<td><?php echo $rowOfEmployeeAppointment['ticket_no']?></td>
<td><?php echo $rowOfEmployeeAppointment['emp_code']?></td>
<td><?php echo $rowOfEmployeeAppointment['patient_name']?></td>
<td><?php echo $detention_status?></td>
<td><?php echo $doctor_attended_flag?></td>
<?php
$complaint_ids = $rowOfEmployeeAppointment['complaints'];
$complaint_ids_array = array();
$complaint_ids_array = explode(",", $complaint_ids);
$complaints = "";
for ($i = 0; $i < count($complaint_ids_array); $i++) {
if ($i == 0) {
if (is_numeric($complaint_ids_array[$i])) {
$complaints = getTableFieldValue('complaints', 'complaint', 'complaint_id', $complaint_ids_array[$i]);
} else {
$complaints = $complaint_ids_array[$i];
}
} else {
if (is_numeric($complaint_ids_array[$i])) {
$complaints = $complaints . "," . getTableFieldValue('complaints', 'complaint', 'complaint_id', $complaint_ids_array[$i]);
} else {
$complaints = $complaints . "," . $complaint_ids_array[$i];
}
}
}
?>
<td><?php echo $complaints?></td>
<td><?php
$findings_ids = $rowOfEmployeeAppointment['examination_remarks'];
$findings_ids_array = array();
$findings_ids_array = explode(",", $findings_ids);
$findings = "";
for ($i = 0; $i < count($findings_ids_array); $i++) {
if ($i == 0) {
$findings = getTableFieldValue('examination_findings', 'examination_finding', 'id', $findings_ids_array[$i]);
} else {
$findings = $findings . "," . getTableFieldValue('examination_findings', 'examination_finding', 'id', $findings_ids_array[$i]);
}
} echo $findings;?>
</td>
<td><?php
$ailment_names = $rowOfEmployeeAppointment['ailments_new'];
$ailment_names_ids = $rows_emp_appoint['ailments_new'];
$ailment_names_ids_array = array();
$ailment_names_ids_array = explode(",", $ailment_names_ids);
$ailment_names = "";
for ($i = 0; $i < count($ailment_names_ids_array); $i++) {
if ($i == 0) {
$ailment_names = getTableFieldValue('ailment', 'ailment_name', 'ailment_id', $ailment_names_ids_array[$i]);
} else {
$ailment_names = $ailment_names . "," . getTableFieldValue('ailment', 'ailment_name', 'ailment_id', $ailment_names_ids_array[$i]);
}
}
echo strtoupper($ailment_names)?></td>
<td><?php echo getTreatmentText($rowOfEmployeeAppointment['appointment_id'])?></td>
<td><?php echo $rowOfEmployeeAppointment['referral']?></td>
<td><?php echo $rowOfEmployeeAppointment['followup']?></td>
<td><?php echo $check_results?></td>
</tr>
<?php
}
?>
</table>
</body>
</html>