147 lines
5.9 KiB
PHP
147 lines
5.9 KiB
PHP
<?php
|
|
include('includes/config/config.php');
|
|
|
|
// Set headers for the Excel file
|
|
header('Content-Type: application/vnd.ms-excel');
|
|
header('Content-Disposition: attachment; filename="placement_pool_list.xls"');
|
|
header('Pragma: no-cache');
|
|
header('Expires: 0');
|
|
|
|
include('includes/functions.php');
|
|
?>
|
|
|
|
<body>
|
|
<div style="text-align: center; margin-bottom: 20px;">
|
|
<h2 style="font-size: 24px; margin: 0;">Placement Pool Report</h2>
|
|
</div>
|
|
|
|
<br>
|
|
<table border="1" width="100%" cellspacing="0" style="border-collapse: collapse; font-size: large;">
|
|
<thead>
|
|
<tr>
|
|
<th>Sr.</th>
|
|
<th>Employer Name</th>
|
|
<th>Placement Officer</th>
|
|
<th>Address</th>
|
|
<th>Owner/MD Name</th>
|
|
<th>HR/Rep Name</th>
|
|
<th>Contact No.</th>
|
|
<th>WhatsApp No.</th>
|
|
<th>Salary Offering</th>
|
|
<th>Food</th>
|
|
<th>Accommodations</th>
|
|
<th>Salary Compliance</th>
|
|
<th>PF/MC Benefits</th>
|
|
<th>Placement Proof</th>
|
|
<th>Employer Visits</th>
|
|
<th>MOU</th>
|
|
<th>Other Facilities</th>
|
|
<th>Brand</th>
|
|
<th>Trainee Feedback</th>
|
|
<th>Retention</th>
|
|
<th>Infrastructure Support</th>
|
|
<th>Total (12)</th>
|
|
<th>Category</th>
|
|
<th>Job Position</th>
|
|
<th>Skill Set Requirement</th>
|
|
<th>Remarks</th>
|
|
<th>Trainees Working</th>
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody style="font-size: 14px;">
|
|
<?php
|
|
$sql = "SELECT * FROM placement_pool";
|
|
$result = mysqli_query($conn, $sql);
|
|
$count = 1;
|
|
while ($rowOfrecord = mysqli_fetch_array($result)) {
|
|
$partner = $rowOfrecord['partner_name'];
|
|
$partner_id = getFieldFromTable('partner_id', 'partners', 'partner_name', $partner);
|
|
$partner_location = getFieldFromTable('partner_location', 'partners', 'partner_id', $partner_id);
|
|
$total = $rowOfrecord['food'] + $rowOfrecord['accommodation'] + $rowOfrecord['standard_salary'] + $rowOfrecord['PF'] + $rowOfrecord['proof'] + $rowOfrecord['visits'] + $rowOfrecord['mou'] + $rowOfrecord['o_facilities'] + $rowOfrecord['brand'] + $rowOfrecord['culture'] + $rowOfrecord['retention'] + $rowOfrecord['support'];
|
|
?>
|
|
|
|
<tr>
|
|
<td ><?= $count++ ?></td>
|
|
<td><?= getFieldFromTable('client_name', 'client_master', 'id', $partner_id) ?></td>
|
|
<td><?= getFieldFromTable('contact_person', 'partners', 'partner_id', $partner); ?></td>
|
|
<td><?= $partner_location ?></td>
|
|
<td><?= $rowOfrecord['md_name'] ?></td>
|
|
<td><?= $rowOfrecord['hr_name'] ?></td>
|
|
<td><?= getFieldFromTable('partner_phone', 'partners', 'partner_id', $partner_id); ?></td>
|
|
<td><?= $rowOfrecord['w_number'] ?></td>
|
|
<td><?= $rowOfrecord['salary_offering'] ?></td>
|
|
<td><?= $rowOfrecord['food'] ?></td>
|
|
<td><?= $rowOfrecord['accommodation'] ?></td>
|
|
<td><?= $rowOfrecord['standard_salary'] ?></td>
|
|
<td><?= $rowOfrecord['PF'] ?></td>
|
|
<td><?= $rowOfrecord['proof'] ?></td>
|
|
<td><?= $rowOfrecord['visits'] ?></td>
|
|
<td><?= $rowOfrecord['mou'] ?></td>
|
|
<td><?= $rowOfrecord['o_facilities'] ?></td>
|
|
<td><?= $rowOfrecord['brand'] ?></td>
|
|
<td><?= $rowOfrecord['culture'] ?></td>
|
|
<td><?= $rowOfrecord['retention'] ?></td>
|
|
<td><?= $rowOfrecord['support'] ?></td>
|
|
<td><?= $total ?></td>
|
|
<td>
|
|
<?php
|
|
if ($total >= 9) {
|
|
echo "A";
|
|
} else if ($total >= 5 && $total <= 8) {
|
|
echo "B";
|
|
} else {
|
|
echo "C";
|
|
}
|
|
?>
|
|
</td>
|
|
<td><?= $rowOfrecord['position'] ?></td>
|
|
<td><?php echo getFieldFromTable('skill_name', 'skill_get', 'id', getFieldFromTable('skill_set', 'partners', 'partner_id', $partner_id)); ?></td>
|
|
<td><?= $rowOfrecord['remarks'] ?></td>
|
|
<td style="text-align: center;"><?= getCount('placement_records', 'partner_id', $partner, '') ?></td>
|
|
</tr>
|
|
<?php } ?>
|
|
</tbody>
|
|
</table>
|
|
</body>
|
|
|
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
|
<script>
|
|
// $(document).ready(function() {
|
|
// window.print();
|
|
// });
|
|
</script>
|
|
|
|
<?php
|
|
function getCount($table, $idfield, $id, $status) {
|
|
global $conn; // Access the global $conn variable
|
|
|
|
// Escape input parameters
|
|
$table = mysqli_real_escape_string($conn, $table);
|
|
$id = mysqli_real_escape_string($conn, $id);
|
|
$idfield = mysqli_real_escape_string($conn, $idfield);
|
|
$status = mysqli_real_escape_string($conn, $status);
|
|
|
|
// Correct SQL query
|
|
if ($status == '') {
|
|
$sql = "SELECT COUNT(*) AS count FROM $table WHERE $idfield = '$id'";
|
|
} else {
|
|
$sql = "SELECT COUNT(*) AS count FROM $table WHERE $idfield = '$id' AND status = '$status'";
|
|
}
|
|
error_log("check_sql : " . $sql);
|
|
|
|
// Execute the query
|
|
$result = mysqli_query($conn, $sql);
|
|
|
|
// Check for query success and fetch the result
|
|
if ($result) {
|
|
$row = mysqli_fetch_assoc($result);
|
|
return (int) ($row ? $row['count'] : 0);
|
|
} else {
|
|
// Handle SQL error
|
|
error_log("SQL Error: " . mysqli_error($conn));
|
|
return 0; // Or handle it as needed
|
|
}
|
|
}
|
|
?>
|