nhance/app/Views/employee_data_list.php
2024-09-13 09:00:09 +05:30

200 lines
9.7 KiB
PHP
Executable File

<style>
.badge2 {
box-shadow: none;
}
.badge2-secondary2 {
color: #fff;
background-color: #187607;
}
.badge2 {
display: inline-block;
padding: .25em .4em;
font-size: 75%;
font-weight: 700;
line-height: 1;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
border-radius: .25rem;
transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}
.table-responsive {
overflow-x: auto;
}
.word-wrap {
word-wrap: break-word;
white-space: normal;
}
.dataTables_filter{
position: absolute;
}
</style>
<?php $pro_rata_total = 0; $gst_total = 0 ?>
<div class="row" id="client_list">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="row" style="padding-bottom: 10px;">
<div class="col-6" style="align-self: center;">
<h4 style="position: relative;">Employees</h4>
</div>
</div>
<table class="table table-hover m-0 table-centered dt-responsive w-100" cellspacing="0" id="tickets-table">
<thead class="bg-light">
<tr>
<th class="font-weight-medium">SNO</th>
<?php if (isset($getData)) { ?>
<?php if ($getData['client_id'] == '0' && $getData['policy_id'] == '0' && $getData['branch_id'] == '0' && ($getData['emp_code'] != "" || $getData['emp_name'] != "" || $getData['status'] != "")) { ?>
<th class="font-weight-medium">Client/Branch</th>
<?php } ?>
<?php } ?>
<?php if (isset($getData)) { ?>
<?php if ($getData['client_id'] != '0' && $getData['branch_id'] == '0') { ?>
<th class="font-weight-medium">Branch</th>
<?php } ?>
<?php } ?>
<th class="font-weight-medium">Name/code</th>
<th class="font-weight-medium">Policy name</th>
<th class="font-weight-medium">Insurer name</th>
<th class="font-weight-medium">TPA ID</th>
<th class="font-weight-medium">Risk ID</th>
<th class="font-weight-medium">Policy status</th>
<th class="font-weight-medium">(₹)Sum Insured</th>
<th class="font-weight-medium">(₹)Premium</th>
<th class="font-weight-medium" id="rata_premium" data-toggle="tooltip" data-placement="top">(₹)Pro Rata <br> Premium</th>
<th class="font-weight-medium" id="gst" data-toggle="tooltip" data-placement="top">(₹)GST</th>
</tr>
</thead>
<tbody class="font-12">
<?php
if (isset($employees)) {
$pro_rata_total = 0;
$gst_total = 0;
foreach ($employees as $key => $employee) { ?>
<tr>
<td><b><?php echo ($key + 1); ?></b></td>
<?php if (isset($getData)) { ?>
<?php if ($getData['client_id'] == '0' && $getData['policy_id'] == '0' && $getData['branch_id'] == '0' && ($getData['emp_code'] != "" || $getData['emp_name'] != "" || $getData['status'] != "")) { ?>
<td><?php echo $employee['client_short_name'] . ' - ' . $employee['client_branch_name']; ?></td>
<?php } ?>
<?php } ?>
<?php if (isset($getData)) { ?>
<?php if ($getData['client_id'] != '0' && $getData['branch_id'] == '0') { ?>
<td><?php echo $employee['client_branch_name']; ?></td>
<?php } ?>
<?php } ?>
<td><?php echo $employee['name'] . ' (' . $employee['emp_code'] . ' - ' . $employee['relationship'] . ')'; ?></td>
<td><?php echo isset($employee['policy_type']) ? $employee['policy_type'] : ''; ?> - <?php echo isset($employee['policy_no']) ? $employee['policy_no'] : ''; ?></td>
<td><?php echo $employee['insurer_short_name']; ?></td>
<td><?php echo $employee['tpa_id']; ?></td>
<td><?php echo $employee['uhid']; ?></td>
<td>
<?php
switch ($employee['status']) {
case 'draft':
echo '<span class="badge badge-secondary">' . $employee['status'] . '</span>';
break;
case 'active':
echo '<span class="badge badge-success">' . $employee['status'] . '</span>';
break;
case 'inactive':
echo '<span class="badge badge-warning">' . $employee['status'] . '</span>';
break;
case 'expired':
echo '<span class="badge badge-danger">' . $employee['status'] . '</span>';
break;
case 'enrolled':
echo '<span class="badge2 badge2-secondary2">' . $employee['status'] . '</span>';
break;
default:
echo $employee['status'];
break;
}
?>
</td>
<td><?php echo format_indian_number($employee['basic_cover_si']); ?></td>
<td><?php echo format_indian_number($employee['premium']); ?></td>
<td><?php $pro_rata_total += $employee['rata_premimum']; echo format_indian_number($employee['rata_premimum']); ?></td>
<td><?php $gst_total += $employee['gst']; echo format_indian_number($employee['gst']); ?></td>
</tr>
<?php }
} ?>
</tbody>
<tfoot>
<tr>
<th></th>
<?php if (isset($getData)) { ?>
<?php if ($getData['client_id'] == '0' && $getData['policy_id'] == '0' && $getData['branch_id'] == '0' && ($getData['emp_code'] != "" || $getData['emp_name'] != "" || $getData['status'] != "")) { ?>
<th></th>
<?php } ?>
<?php } ?>
<?php if (isset($getData)) { ?>
<?php if ($getData['client_id'] != '0' && $getData['branch_id'] == '0') { ?>
<th></th>
<?php } ?>
<?php } ?>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th>Total</th>
<th><?php echo format_indian_number($pro_rata_total); ?></th>
<th><?php echo format_indian_number($gst_total); ?></th>
</tr>
</tfoot>
</table>
</div>
</div>
</div><!-- end col -->
</div>
<script>
$(document).ready(function() {
var ticketsTable = $('#tickets-table');
if (ticketsTable.length) {
ticketsTable.DataTable({
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
buttons: [{
extend: 'csv',
text: 'CSV',
title: 'Member-List',
exportOptions: {
columns: ':not(:last-child)'
},
}],
language: {
search: "_INPUT_",
searchPlaceholder: "Search..."
},
paging: true, // Enable pagination
pageLength: 25 // Set default number of rows per page (optional)
});
} else {
console.error("Table not found.");
}
});
</script>