172 lines
5.0 KiB
PHP
172 lines
5.0 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=clinical_visit_report_excel.xls');
|
|
error_reporting(E_ERROR | E_PARSE);
|
|
$start = $_POST['startexpDate'];
|
|
$end = $_POST['endexpDate'];
|
|
$ohc_id = $_SESSION['current_ohcttype'];
|
|
?>
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
<link href="https://fonts.googleapis.com/css2?family=Mulish:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
|
|
<link href="includes/css-js/admin.css" rel="stylesheet" type="text/css" />
|
|
|
|
<style>
|
|
* {
|
|
font-family: 'Mulish', sans-serif;
|
|
}
|
|
|
|
@page {
|
|
margin: 15px;
|
|
}
|
|
|
|
.btn {
|
|
background-color: #4CAF50;
|
|
border-radius: 5%;
|
|
/* Green */
|
|
border: none;
|
|
color: white;
|
|
padding: 5px 8px;
|
|
text-align: center;
|
|
text-decoration: none;
|
|
display: inline-block;
|
|
font-size: 12px;
|
|
margin: 4px 2px;
|
|
cursor: pointer;
|
|
}
|
|
|
|
@media print {
|
|
#printPageButton {
|
|
display: none;
|
|
}
|
|
}
|
|
|
|
#main-table {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
border: 1px solid black;
|
|
font-size: 11px;
|
|
}
|
|
|
|
#main-table td {
|
|
padding: 5px;
|
|
border: 1px solid black;
|
|
font-size: 11px;
|
|
}
|
|
|
|
#main-table tr:nth-child(even) {
|
|
background-color: lightgoldenrodyellow;
|
|
color: black;
|
|
}
|
|
|
|
#main-table thead tr {
|
|
background-color: lightcoral;
|
|
}
|
|
</style>
|
|
|
|
<body>
|
|
<?php include('excel_ohc_header.php') ?>
|
|
|
|
|
|
<table width="100%">
|
|
<tr>
|
|
<td style="font-size: 10px;"><strong style="margin-left: 600px">Clinical Visit Summary Report</strong></td>
|
|
|
|
</tr>
|
|
<tr>
|
|
<td align="left" style="font-size: 12px"><strong>For Duration: <?php echo $start; ?> -
|
|
<?php echo $end; ?></strong></td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
<br>
|
|
|
|
<table id="main-table" border="1" width="100%" cellspacing="0">
|
|
<thead>
|
|
<tr>
|
|
<th>Sr No.</th>
|
|
<th>Details</th>
|
|
<th>Count</th>
|
|
</tr>
|
|
</thead>
|
|
|
|
|
|
<?php
|
|
$opd_count = 0;
|
|
$inj_count = 0;
|
|
|
|
|
|
|
|
$query = "select count(*) as count from employee_appointment where date(appointment_date) between STR_TO_DATE('" . $start . "', '%d-%m-%Y') AND STR_TO_DATE('" . $end . "', '%d-%m-%Y') and ohc_type_id='" . $ohc_id . "' and appointment_type='O'";
|
|
error_log("query to count employee in opd" . $query);
|
|
|
|
if ($result = mysqli_query($conn, $query)) {
|
|
$row = mysqli_fetch_assoc($result);
|
|
$opd_count = $row['count'];
|
|
}
|
|
|
|
$query_inj = "select count(*) as count from employee_appointment where date(appointment_date) between STR_TO_DATE('" . $start . "', '%d-%m-%Y') AND STR_TO_DATE('" . $end . "', '%d-%m-%Y') and ohc_type_id='" . $ohc_id . "' and appointment_type='I'";
|
|
error_log("query to count employee in opd" . $query_inj);
|
|
|
|
if ($result_inj = mysqli_query($conn, $query_inj)) {
|
|
$row_inj = mysqli_fetch_assoc($result_inj);
|
|
$inj_count = $row_inj['count'];
|
|
}
|
|
|
|
$data = [];
|
|
$medical_name = [];
|
|
$checkup = "select * from checkup_type where type_status='Active' and type_state='No'";
|
|
$res = mysqli_query($conn, $checkup);
|
|
while ($row_checkup = mysqli_fetch_assoc($res)) {
|
|
|
|
array_push($medical_name, $row_checkup['checkup_type_name']);
|
|
|
|
$checkup_count = "select count(*) as count from checkup_form where date(checkup_date) between STR_TO_DATE('" . $start . "', '%d-%m-%Y') AND STR_TO_DATE('" . $end . "', '%d-%m-%Y') and checkup_type_id = '" . $row_checkup['checkup_type_id'] . "' and ohc_type_id='" . $ohc_id . "'";
|
|
|
|
$result_checkup = mysqli_query($conn, $checkup_count);
|
|
$row_checkup_count = mysqli_fetch_assoc($result_checkup);
|
|
|
|
$data['emp'][$row_checkup['checkup_type_name']] = $row_checkup_count['count'];
|
|
|
|
error_log("query for medical " . $checkup_count);
|
|
}
|
|
|
|
error_log("final checkup data " . print_r($data, true));
|
|
|
|
?>
|
|
<tbody>
|
|
|
|
<tr>
|
|
<td><?= ++$count ?></td>
|
|
<td>Opd</td>
|
|
<td><?= $opd_count ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td><?= ++$count ?></td>
|
|
<td>Injury</td>
|
|
<td><?= $inj_count ?></td>
|
|
</tr>
|
|
|
|
|
|
<?php
|
|
for ($i = 0; $i < sizeof($data['emp']); $i++) {
|
|
?>
|
|
<tr>
|
|
<td><?= ++$count ?></td>
|
|
<td style="text-transform: capitalize !important;"><?= $medical_name[$i] ?></td>
|
|
<td><?= $data['emp'][$medical_name[$i]] ?></td>
|
|
</tr>
|
|
|
|
<?php
|
|
}
|
|
?>
|
|
|
|
|
|
|
|
</tbody>
|
|
</table>
|
|
</body>
|