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

160 lines
4.5 KiB
PHP

<?php
// include('pdf_header.php');
include ('includes/config/config.php');
include ('includes/functions.php');
header('Content-Type: application/force-download');
header('Content-disposition: attachment; filename=mockdril_report.xls');
?>
<?php
$from_date = $_REQUEST['startDate2'];
$to_date = $_REQUEST['endDate2'];
//include('pop_up_top.php');
?>
<body>
<table width="100%" class="tbl2" >
<tr>
<td colspan="2" align="left"> Run Date : <?php echo date("d-M-Y"); ?></td>
<td colspan="9" align="center" ><strong>MOCKDRILL REPORT</strong></td>
<td colspan="3" align="right"> User : <?php echo $username ?></td>
</tr>
<tr>
<?php if(isset($from_date) && isset($to_date)){?>
<td width="25%" align="left"><h5> Range : <?php echo $from_date; ?> To <?php echo $to_date ;?></h5></td>
<?php php }?>
</tr>
</table>
<?php
//$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);
$sql="SELECT * FROM `mockdril` ";
$result = mysqli_query($conn,$sql);
?>
<?php
if($row1= mysqli_fetch_assoc($result)){
extract($row1);
?>
<table width="100%">
<tr >
<td ><strong>NAME OF UNIT: TATA METALIKS LIMITED , SAMRAIPUR, KHARAGPUR, PASCHIM MEDINIPUR, WB, PIN-721301</strong>
</td>
</tr>
</table>
<?php }?>
<table border="1" width="100%" class="tbl2">
<?php
//$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);
$sql="SELECT * FROM `mockdril` WHERE date_of_mockdrill between STR_TO_DATE('".$from_date."', '%d-%m-%Y') AND STR_TO_DATE('".$to_date."', '%d-%m-%Y') order by date_of_mockdrill ASC";
$result = mysqli_query($conn,$sql);
?>
<tr>
<th>Sr. No.</th>
<th>Date</th>
<th>Name</th>
<th>Age</th>
<th>Contractor</th>
<th>Location</th>
<th>Blood press</th>
<th>Pulse</th>
<th>SPO2</th>
<th>RBS</th>
<th>Temp</th>
<th>Given Treatment</th>
<th>Patient attending doctor name</th>
<th>Patient attending staff name</th>
<th>Patients in hospital</th>
<th>Patient condition on discharge time</th>
<th>Inform receiving time</th>
<th>Discharge time</th>
<th>Amb sent</th>
<th>Inform ation</th>
<th>Complaint of Patient</th>
<th>Examine patient</th>
</tr>
<?php
$count=1;
while ($row1= mysqli_fetch_assoc($result)){
extract($row1);
$filled=$row1['id'];
$box2="select patient_name from patient_master where id='".$filled."'";
error_log("filled".$box2);
$result1=mysqli_query($conn,$box2);
$row3=mysqli_fetch_assoc($result1);
$box3="SELECT dob,employer_contractor_name from patient_master p, employer_contractor ec where p.employer_contractor_id=ec.id and p.id='$filled'";
$result2=mysqli_query($conn,$box3);
$row4=mysqli_fetch_assoc($result2);
$dob=$row4['dob'];
$birthdate = new DateTime($dob);
$today = new DateTime('today');
$age = $birthdate->diff($today)->y;
?>
<tr>
<td><?=$count?></td>
<td><?=date_format(date_create($row1['date_of_mockdrill']),"d-M-Y ")?></td>
<td bgcolor="#f9e84e"><?=$row3['patient_name']?></td>
<td><?=$age?></td>
<td bgcolor="#f9e84e"><?=$row4['employer_contractor_name']?></td>
<td bgcolor="#eeeeee"><?=$row1['location']?></td>
<td bgcolor="#fa8072" ><?=$row1['bp']?></td>
<td bgcolor="#6495ed"><?=$row1['pulse']?></td>
<td bgcolor="#f9e84e"><?=$row1['Spo2']?></td>
<td bgcolor="#eeeeee"><?=$row1['RBS']?></td>
<td bgcolor="#6495ed"><?=$row1['temp']?></td>
<td bgcolor="#fa8072" ><?=$row1['given_treatment']?></td>
<td><?=$row1['patient_attending_doctor_name']?></td>
<td><?=$row1['patient_attending_staff_name']?></td>
<td><?=$row1['patients_in_hospital']?></td>
<td><?=$row1['patient_condition_on_discharge_time']?></td>
<td><?=$row1['inf_rec_time']?></td>
<td><?=$row1['dis_time']?></td>
<td><?=$row1['amb_sen_t']?></td>
<td><?=$row1['info']?></td>
<td><?=$row1['complt_of_patient']?></td>
<td><?=$row1['patient_diagnosis']?></td>
</tr>
<?php
$count++;
}
?>
</table>
</body>