ESH/injury_report_pdf.php

107 lines
3.7 KiB
PHP
Raw Normal View History

2024-10-23 18:28:06 +05:30
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<?php
//include('pdf_header_reverse.php');
include('includes/config/config.php');
include ('includes/functions.php');
include("excel_ohc_header.php");
include('log_entry.php');
$from_date = $_REQUEST['injuryStartDate2'];
$to_date = $_REQUEST['injuryEndDate2'];
$filter_array = $_REQUEST['injury_filter'];
$filter_query = "";
$i = 0;
foreach ($filter_array as $filter) {
if ($i == 0) {
$filter_query .= " and injury_classes = '" . $filter . "'";
} else {
$filter_query .= "or injury_classes = '" . $filter . "'";
}
$i++;
}
// error_log("filter_query: ".print_r($_REQUEST['injury_filter'],true));
error_log("filter_query: " . $filter_query);
?>
<div style="font-size:22px;" align="center">Injury History Report</div>
<table width="100%" class="tbl2">
<tr>
<td> <br></td>
</tr>
<tr>
<td width="8%" align="left">
<p>Run Date : <?php echo date("d-M-Y"); ?></p>
</td>
<td width="8%" align="left">
<h5> User : <?php echo $username ?></h5>
</td>
<?php if (isset($from_date) && isset($to_date)) { ?>
<td width="8%" align="left">
<p> Range : <?php echo $from_date; ?> To <?php echo $to_date; ?> </p>
</td>
<?php } ?>
</tr>
</table>
<table border="1" width="100%">
<tr>
<th width="1%" bgcolor="yellow">Sr.</th>
<th width="3%" bgcolor="yellow">Appointment Date</th>
<th width="8%" bgcolor="yellow">Patient Name</th>
<th width="8%" bgcolor="yellow">DOB</th>
<th width="8%" bgcolor="yellow">Sex</th>
<th width="2%" bgcolor="yellow">Primary Phone</th>
<th width="2%" bgcolor="yellow">Injury Class</th>
<th width="2%" bgcolor="yellow">Injury Time</th>
</tr>
<?php
$sql_injury_report = "select DISTINCT(appointment_date) from employee_appointment where appointment_date between STR_TO_DATE('" . $from_date . "', '%d-%m-%Y') AND STR_TO_DATE('" . $to_date . "', '%d-%m-%Y') and appointment_type='I' $filter_query order by appointment_date ASC ";
//echo $sql_injury_report;
error_log("sql: " . $sql_injury_report);
$result_injury_report = @mysqli_query($conn,$sql_injury_report);
$count = 0;
while ($row_injury_report = @mysqli_fetch_array($result_injury_report)) {
$query_for_date = "SELECT a.*, b.patient_name, b.dob, b.primary_phone, b.gender, c.inj_class_name FROM employee_appointment a left join patient_master b on a.emp_id = b.id left join injury_class c on c.inj_class_id = a.injury_classes where a.appointment_date='" . $row_injury_report['appointment_date'] . "' ";
error_log("sql: " . $query_for_date);
$result_for_date = @mysqli_query($conn,$query_for_date);
while ($row_for_date = @mysqli_fetch_array($result_for_date)) {
$patient_name = $row_for_date['patient_name'];
$dob = $row_for_date['dob'];
$sex = $row_for_date['gender'];
$primary_phone = $row_for_date['primary_phone'];
$injury_classes = $row_for_date['inj_class_name'];
$injury_time = date_format(date_create($row_injury_report['injury_time']), "d-M-Y g:i a");
$appointment_date = date_format(date_create($row_injury_report['appointment_date']), "d-M-Y ");
}
?>
<tr>
<td text-align="left"><?= $count + 1; ?></td>
<td text-align="left"><?= $appointment_date; ?></td>
<td text-align="left"><?= $patient_name; ?></td>
<td text-align="left"><?= $dob; ?></td>
<td text-align="left"><?= $sex; ?></td>
<td text-align="left"><?= $primary_phone; ?></td>
<td text-align="left"><?= $injury_classes; ?></td>
<td text-align="left"><?= $injury_time; ?></td>
</tr><?php
//$total=$total_for_yellow_mines+$total_for_yellow_plant+$total_for_red_plant+$total_for_red_mines+$total_for_white_plant+$total_for_white_mines+$total_for_blue_plant+$total_for_blue_mines;
$count++;
}
?>
</table>
<?php
include('pdf_footer.php');
?>