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

136 lines
6.1 KiB
PHP

<?php
include('includes/config/config.php');
include('includes/functions.php');
// Get and sanitize input
$startDate = date('Y-m-d', strtotime($_POST['startDate_regi']));
$endDate = date('Y-m-d', strtotime($_POST['endDate_regi']));
$ohc = $_POST['ohc_id7'];
// Log the dates
error_log("Start date: " . $startDate);
error_log("End date: " . $endDate);
// Prepare SQL query
$sql = "SELECT pm.*, be.patient_id
FROM patient_master pm
INNER JOIN beneficiary_enquiry be
ON pm.id = be.patient_id
WHERE DATE(be.enquiry_date) BETWEEN ? AND ?
AND be.ohc_type_id = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param('ssi', $startDate, $endDate, $ohc);
$stmt->execute();
$result = $stmt->get_result();
// Check for errors
if (!$result) {
error_log("Error executing query: " . mysqli_error($conn));
die("Error executing query");
}
?>
<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 include('pdf_current_ohc_header.php'); ?>
<table width="100%">
<tr>
<td style="font-size: 15px;"><strong style="margin-left: 670px">Trainees Registration Report</strong></td>
</tr>
<tr>
<td align="left" style="font-size: 12px">
<strong>From Date: <?php echo date("d-M-Y", strtotime($startDate)); ?> To <?php echo date("d-M-Y", strtotime($endDate)); ?></strong>
</td>
<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 border="1" width="100%" cellspacing="0" class="table-fixed">
<tr bgcolor="#eeeeee">
<td style="width: 5%;">Sr.</td>
<td style="width: 15%; font-size: 10px;">Full Name</td>
<td style="width: 10%; font-size: 10px;">Gender</td>
<td style="width: 10%; font-size: 10px;">DOB</td>
<td style="width: 10%; font-size: 10px;">Email ID</td>
<td style="width: 10%; font-size: 10px;">Marital Status</td>
<td style="width: 10%; font-size: 10px;">Father Name</td>
<td style="width: 10%; font-size: 10px;">Guardians Name</td>
<td style="width: 10%; font-size: 10px;">Religion</td>
<td style="width: 10%; font-size: 10px;">Category</td>
<td style="width: 10%; font-size: 10px;">Disability</td>
<td style="width: 10%; font-size: 10px;">Type of Disability</td>
<td style="width: 10%; font-size: 10px;">Domicile State</td>
<td style="width: 10%; font-size: 10px;">Domicile District</td>
<td style="width: 10%; font-size: 10px;">ID Type</td>
<td style="width: 10%; font-size: 10px;">Type of Alternate ID</td>
<td style="width: 10%; font-size: 10px;">Mobile No</td>
<td style="width: 10%; font-size: 10px;">Education Level</td>
<td style="width: 10%; font-size: 10px;">Tehsil</td>
</tr>
<?php
$count = 1;
while ($row1 = $result->fetch_assoc()) {
?>
<tr>
<td style="font-size: 10px;"><?php echo $count ?></td>
<td style="font-size: 10px;"><?php echo htmlspecialchars($row1['patient_name']) ?></td>
<td style="font-size: 10px;"><?php echo $row1['gender'] === 'M' ? 'Male' : 'Female'; ?></td>
<td style="font-size: 10px;"><?php echo date('d-m-Y', strtotime($row1['dob'])) ?></td>
<td style="font-size: 10px;"><?php echo htmlspecialchars($row1['email_id']) ?></td>
<td style="font-size: 10px;"><?php echo htmlspecialchars($row1['marital_status']) ?></td>
<td style="font-size: 10px;"><?php echo htmlspecialchars($row1['father_name']) ?></td>
<td style="font-size: 10px;"></td>
<td style="font-size: 10px;"><?php echo htmlspecialchars($row1['religen']) ?></td>
<td style="font-size: 10px;"><?php echo htmlspecialchars(getFieldFromTable('category_name','beneficiary_category','id',$row1['beneficiary_category'])) ?></td>
<td style="font-size: 10px;"><?php echo $row1['disabilty'] ? 'Yes' : 'No'; ?></td>
<td style="font-size: 10px;"><?php echo htmlspecialchars($row1['disabilty']) ?></td>
<td style="font-size: 10px;"><?php echo htmlspecialchars(getFieldFromTable('name', 'states', 'id', $row1['state'])) ?></td>
<td style="font-size: 10px;"><?php echo htmlspecialchars(getFieldFromTable('name','districts','id',$row1['district'])) ?></td>
<td style="font-size: 10px;"><?php echo htmlspecialchars($row1['identity_type']) ?></td>
<td style="font-size: 10px;"><?php echo htmlspecialchars($row1['identity_number']) ?></td>
<td style="font-size: 10px;"><?php echo htmlspecialchars($row1['primary_phone']) ?></td>
<td style="font-size: 10px;"><?php echo htmlspecialchars(getFieldFromTable('qualification','qualification','id',$row1['education'])) ?></td>
<td style="font-size: 10px;"><?php echo htmlspecialchars(getFieldFromTable('name','tehsils','id',$row1['tehsil'])) ?></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>