147 lines
5.4 KiB
PHP
147 lines
5.4 KiB
PHP
<?php
|
|
include('includes/config/config.php');
|
|
include('includes/functions.php');
|
|
|
|
header('Content-Type: application/vnd.ms-excel');
|
|
header('Content-Disposition: attachment; filename="excel_followup_report.xls"');
|
|
|
|
$startDate = date('Y-m-d', strtotime($_POST['f_startdate']));
|
|
$endDate = date('Y-m-d', strtotime($_POST['f_enddate']));
|
|
$batch_name = $_POST['batch_name'];
|
|
$ohc = $_SESSION['current_ohcttype'];
|
|
|
|
?>
|
|
|
|
<html>
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Follow Up Report</title>
|
|
<style>
|
|
table { width: 100%; border-collapse: collapse; }
|
|
th, td { border: 1px solid black; text-align: center; font-size: 10px; }
|
|
th { background-color: #eeeeee; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<table>
|
|
<tr>
|
|
<td colspan="2" style="font-size: 15px;"><strong>Follow Up Report</strong></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" style="font-size: 15px"><strong>Duration: </strong> <?php echo date("d-M-Y", strtotime($startDate)) . " To " . date("d-M-Y", strtotime($endDate)); ?></td>
|
|
<td align="right" style="font-size: 15px"><strong>Batch Name: </strong>
|
|
<?php
|
|
if ($batch_name == "All") {
|
|
echo "Report For All Batches";
|
|
} else {
|
|
echo htmlspecialchars(getFieldFromTable('batch_name', 'training_batch_master', 'batch_id', $batch_name));
|
|
}
|
|
?>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<br>
|
|
<table>
|
|
<tr>
|
|
<th>Sr.</th>
|
|
<th>Batch Name</th>
|
|
<th>Name of Trainees</th>
|
|
<th>Placement Partner</th>
|
|
<th>Placement Date</th>
|
|
<th>Placement Status</th>
|
|
<th>Salary</th>
|
|
<th>Contact Number</th>
|
|
<th colspan="4">First Follow Up</th>
|
|
<th colspan="4">Second Follow Up</th>
|
|
<th colspan="4">Third Follow Up</th>
|
|
</tr>
|
|
<tr>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th>Partner Name</th>
|
|
<th>Date</th>
|
|
<th>Salary</th>
|
|
<th>Remark</th>
|
|
<th>Partner Name</th>
|
|
<th>Date</th>
|
|
<th>Salary</th>
|
|
<th>Remark</th>
|
|
<th>Partner Name</th>
|
|
<th>Date</th>
|
|
<th>Salary</th>
|
|
<th>Remark</th>
|
|
</tr>
|
|
|
|
<?php
|
|
$count = 1;
|
|
if ($batch_name == "All") {
|
|
$sql2 = "SELECT * FROM placement_records WHERE DATE(placement_date) BETWEEN ? AND ? AND ohc_type_id = ?";
|
|
} else {
|
|
$sql2 = "SELECT * FROM placement_records WHERE batch_name = ? AND DATE(placement_date) BETWEEN ? AND ? AND ohc_type_id = ?";
|
|
}
|
|
|
|
// Prepare statement
|
|
$stmt = $conn->prepare($sql2);
|
|
if ($batch_name == "All") {
|
|
$stmt->bind_param('ssi', $startDate, $endDate, $ohc);
|
|
} else {
|
|
$stmt->bind_param('ssii', $batch_name, $startDate, $endDate, $ohc);
|
|
}
|
|
$stmt->execute();
|
|
$result2 = $stmt->get_result();
|
|
|
|
while ($row2 = $result2->fetch_assoc()) {
|
|
$batch = htmlspecialchars(getFieldFromTable('batch_name', 'training_batch_master', 'batch_id', $row2['batch_name']));
|
|
$beneficiary_name = htmlspecialchars(getFieldFromTable('patient_name', 'patient_master', 'id', $row2['beneficiary']));
|
|
$primary_phone = htmlspecialchars(getFieldFromTable('primary_phone', 'patient_master', 'id', $row2['beneficiary']));
|
|
$partner_id = htmlspecialchars(getFieldFromTable('partner_name', 'partners', 'partner_id', $row2['partner_id']));
|
|
$placement_name = htmlspecialchars(getFieldFromTable('client_name', 'client_master', 'id', $partner_id));
|
|
$reg_date = date_format(date_create($row2['placement_date']), "d-m-Y");
|
|
|
|
echo "<tr>
|
|
<td>{$count}</td>
|
|
<td>{$batch}</td>
|
|
<td>{$beneficiary_name}</td>
|
|
<td>{$placement_name}</td>
|
|
<td>{$reg_date}</td>
|
|
<td>{$row2['status']}</td>
|
|
<td>{$row2['salary']}</td>
|
|
<td>{$primary_phone}</td>";
|
|
|
|
// Fetch follow-up data
|
|
for ($i = 1; $i <= 3; $i++) {
|
|
$follow_up = "{$i} Follow Up";
|
|
$stmt = $conn->prepare("SELECT * FROM placement_feedback WHERE beneficiary = ? AND follow_up_routine = ?");
|
|
$stmt->bind_param('is', $row2['beneficiary'], $follow_up);
|
|
$stmt->execute();
|
|
$result = $stmt->get_result();
|
|
|
|
if ($follow_up_data = $result->fetch_assoc()) {
|
|
$placement_date = date_format(date_create($follow_up_data['last_modified_by']), "d-m-Y");
|
|
echo "<td>" . htmlspecialchars($follow_up_data['placement_id']) . "</td>
|
|
<td>{$placement_date}</td>
|
|
<td>" . htmlspecialchars($follow_up_data['salary']) . "</td>
|
|
<td>" . htmlspecialchars($follow_up_data['remark']) . "</td>";
|
|
} else {
|
|
echo "<td colspan='4'></td>";
|
|
}
|
|
|
|
$stmt->close();
|
|
}
|
|
|
|
echo "</tr>";
|
|
$count++;
|
|
}
|
|
|
|
$stmt->close();
|
|
?>
|
|
</table>
|
|
</body>
|
|
</html>
|