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

209 lines
6.5 KiB
PHP

<?
//include ('pdf_header_reverse.php');
include('includes/config/config.php');
include('includes/functions.php');
include('log_entry.php');
?>
<?php
$start = date('Y-m-d', strtotime($_POST['startDate_l_qty']));
$end = date('Y-m-d', strtotime($_POST['endDate_l_qty']));
$ohc = $_SESSION['current_ohcttype'];
$month_name = date("F", mktime(0, 0, 0, $month, 10));
//echo $from_date;
//echo $hygiene_abnormal1;
?>
<link href="includes/css-js/admin.css" rel="stylesheet" type="text/css" />
<style>
@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;
}
}
</style>
<body>
<?php include('pdf_ohc_header.php'); ?>
<table width="100%">
<tr>
<td align="center" style="font-size: 15px"><strong>Less Qty Prescribe Medicine Report</strong></td>
</tr>
<tr>
<td align="left" style="font-size: 12px"><strong>Date :
<? echo date('d-m-Y', strtotime($_POST['startDate_l_qty'])) . " To " . date('d-m-Y', strtotime($_POST['endDate_l_qty'])); ?>
</strong></td>
<td align="right" style="font-size: 15px"><button align="center" id="printPageButton" class="btn btn-success" onClick="window.print();">Print</button></td>
</tr>
</table>
<br>
<table width="100%" border="1" cellspacing="0">
<tr>
<th width="2%"><strong>Sr</th>
<th width="5%"><strong>Emp Code</th>
<th width="5%"><strong>Patient Name</th>
<th width="5%"><strong>Designation</th>
<th width="5%"><strong>Division</th>
<th width="5%"><strong>Department</th>
<th width="5%"><strong>Section</th>
<th width="5%"><strong>Items Name</th>
<th width="5%"><strong>Frequency</th>
<th width="5%"><strong>Duration / Days</th>
<th width="5%"><strong>Daily Dose Qty</th>
<th width="5%"><strong>Prescribe Qty </th>
<th width="5%"><strong>Issued Qty</th>
<th width="5%"><strong>Less Qty</th>
<th width="5%"><strong>Batch</th>
</strong>
</tr>
<?php
$query = "SELECT t.* , a.appointment_date , a.appointment_id,a.emp_id FROM treatment t INNER JOIN employee_appointment a ON t.appointment_id = a.appointment_id WHERE t.issued_qty < (t.for_days * t.item_qty) AND a.appointment_date between '$start' AND '$end'";
error_log("###########QQQQQQQQ" . $query);
$result = mysqli_query($conn, $query);
$total = mysqli_num_rows($result);
if ($total != 0) { ?>
<?
while ($row = mysqli_fetch_assoc($result)) {
$item_from_id = getTableFieldValue("tbl_items", "item_form_id", "item_id", $row['item_id']);
$is_qty_fixed = getTableFieldValue("medicine_form", "is_qty_fixed", "form_id", $item_from_id);
if($is_qty_fixed != 'YES'){
}else{
continue;
}
?>
<?php if ($newCat) {
$newCat = false; ?>
<tr rowspan="2">
<th colspan='15'>
<center><?= getTableFieldValue("tbl_categories", "cat_name", "cat_id", $value) ?></center>
</th>
</tr>
<?php } ?>
<tr>
<td align="left"><?= ++$count ?></td>
<?php $emp_id = getTableFieldValue("employee_appointment", "emp_id", "appointment_id", $row['appointment_id']);
$emp_code = getTableFieldValue("patient_master", "emp_code", "id", $emp_id);
?>
<td align="left"><?= $emp_code ?></td>
<?php
$patient_name = getTableFieldValue("patient_master", "patient_name", "id", $emp_id);
?>
<td align="left"><?= $patient_name ?></td>
<td align="left"><?php
$designation_id = getTableFieldValue("patient_master", "designation_id", "id", $emp_id);
echo getTableFieldValue('designation', 'designation_name', $designation_id, 'designation_id',); ?></td>
<td><?php
$bu_id = getTableFieldValue("patient_master", "bu_id", "id", $emp_id);
echo getTableFieldValue('bussiness_unit', 'bu_name', $bu_id, 'bu_id');
?></td>
<td><?php
$dept_id = getTableFieldValue("patient_master", "dept_id", "id", $emp_id);
echo getTableFieldValue('department', 'dept_name', $dept_id, 'dept_id');
?></td>
<td><?php
$section_id = getTableFieldValue("patient_master", "section_id", "id", $emp_id);
echo getTableFieldValue('section', 'section_name', $section_id, 'section_id') ?>
</td>
<?php $item_name = getTableFieldValue("tbl_items", "item_name", "item_id", $row['item_id']) ?>
<td align="left"><?= $item_name ?></td>
<?php $frequency_name = getTableFieldValue("medicine_frequency", "frequency_description", "frequency_id", $row['frequency_id']) ?>
<td align="left"><?= $frequency_name ?></td>
<td align="left"><?php echo $row['for_days'] ?></td>
<td align="left"><?php echo $row['item_qty'] ?></td>
<td align="left"><?php echo $prescribe_qty = $row['item_qty'] * $row['for_days'] ?></td>
<td align="left"><?php echo $row['issued_qty'] ?></td>
<td align="left"><?php echo $prescribe_qty - $row['issued_qty'] ?></td>
<td align="left"><?php echo $row['item_batch_no'] ?></td>
</tr>
<?php }
}
?>
</table>
</body>
<script>
$(document).ready(function() {
window.print();
});
</script>