csrtechnew.ohctech.in/cancers_awarenes_report_pdf.php
2025-04-14 13:28:09 +05:30

160 lines
4.5 KiB
PHP

<?php
include('includes/config/config.php');
include('includes/functions.php');
// Get and sanitize input
$ohc_type_id = $_POST['pohcid'];
$from_date1 = date('Y-m-d', strtotime($_POST['procurement_date1']));
$from_date2 = date('Y-m-d', strtotime($_POST['procurement_date2']));
function calculateAge($dob) {
$dob = new DateTime($dob);
$today = new DateTime();
return $today->diff($dob)->y;
}
?>
<style>
@page {
margin: 15px;
}
.btn {
background-color: #4CAF50;
border-radius: 5%;
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;
}
}
.table-fixed {
table-layout: fixed;
width: 100%;
}
.table-fixed td {
word-wrap: break-word;
}
</style>
<body>
<?php
if ($type === 'excel') {
} else {
include('pdf_current_ohc_header.php');
}
?>
<table width="100%">
<!-- 3rd Row: Right Aligned -->
<tr align="right">
<td align="right" style="font-size: 12px">
<strong>Selected Location: <?= htmlspecialchars(getFieldFromTable('ohc_type_name', 'ohc_type', 'ohc_type_id', $ohc)) ?></strong>
</td>
</tr>
</table>
<br>
<table width="100%">
<tr>
<td style="font-size: 15px;">
<strong style="margin-left: 500px">
Cancers Awarenes Report
</strong>
</td>
</tr>
<tr>
<td align="left" style="font-size: 12px">
<strong>
From Date: <?php echo date("d-M-Y", strtotime($from_date1)); ?>
&nbsp;&nbsp;&nbsp;To Date: <?php echo date("d-M-Y", strtotime($from_date2)); ?>
</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 border="1" width="100%" cellspacing="0">
<tr bgcolor="#eeeeee">
<td style="width:5%;">Sr.</td>
<td style="width:8%;">Date</td>
<td style="width:8%;">Patient Name</td>
<td style="width:8%;">Feedback</td>
<td style="width:8%;">First Followup Date</td>
<td style="width:8%;">First Followup Remarks</td>
<td style="width:8%;">Second Followup Date</td>
<td style="width:8%;">Second Followup Remarks</td>
<td style="width:8%;">Remarks</td>
</tr>
<?php
$sql = "SELECT * FROM cancers_awarenes
WHERE ohc_type_id = '" . $ohc_type_id . "'
AND STR_TO_DATE('$from_date1', '%Y-%m-%d') <= date(date)
AND date(date) <= STR_TO_DATE('$from_date2', '%Y-%m-%d')
ORDER BY date DESC";
error_log($sql);
$result = mysqli_query($conn, $sql);
$count = 1;
while ($row1 = mysqli_fetch_assoc($result)) {
?>
<tr>
<td><?php echo $count; ?></td>
<td><?php echo date_format(date_create($row1['date']), "d-m-Y"); ?></td>
<td><?php echo getFieldFromTable('patient_name','patient_master','id',$row1['beneficiary']); ?></td>
<td><?php echo $row1['feedback']; ?></td>
<td><?php echo date_format(date_create($row1['first_followup_date']), "d-m-Y"); ?></td>
<td><?php echo $row1['first_followup_remarks']; ?></td>
<td><?php echo date_format(date_create($row1['second_followup_date']), "d-m-Y"); ?></td>
<td><?php echo $row1['second_followup_remarks']; ?></td>
<td><?php echo $row1['remarks']; ?></td>
</tr>
<?php
$count++;
}
?>
</table>
<div style="text-align: center; margin-top: 20px;">
<button id="printPageButton" class="btn" onClick="window.print();">Print</button>
</div>
</body>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
$(document).ready(function() {
// Uncomment below to enable print on load
// window.print();
});
</script>