Merge branch 'dev' of bitbucket.org:jubilian/nhance-enrollment into dev
@ -158,6 +158,8 @@ $routes->group("/employee", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->post("test-rack-rate", "EmployeeController::testRackRate");
|
||||
$routes->get('test_members_list', 'EmployeeController::test_members_list');
|
||||
$routes->post('get_emp_history','EmployeeController::getEmpHistory');
|
||||
$routes->post('download_inception','EmployeeController::download_inception');
|
||||
$routes->get('download_file','EmployeeController::download_file');
|
||||
|
||||
});
|
||||
|
||||
|
||||
@ -41,6 +41,10 @@ use CodeIgniter\API\ResponseTrait;
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
use PhpOffice\PhpSpreadsheet\Style\Alignment;
|
||||
use PhpOffice\PhpSpreadsheet\Style\Fill;
|
||||
use PhpOffice\PhpSpreadsheet\Style\Border;
|
||||
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
|
||||
|
||||
use Dompdf\Dompdf;
|
||||
use Dompdf\Options;
|
||||
@ -2722,4 +2726,100 @@ class EmployeeController extends AdminController
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function download_inception()
|
||||
{
|
||||
$client = $this->request->getPost('client');
|
||||
$branch = $this->request->getPost('branch');
|
||||
$policies = $this->request->getPost('policies');
|
||||
$status = $this->request->getPost('status');
|
||||
$empCode = $this->request->getPost('empCode');
|
||||
$empName = $this->request->getPost('empName');
|
||||
|
||||
$result = $this->employeePolicyModel->download_inception(
|
||||
$client, $branch, $policies, $status, $empCode, $empName
|
||||
);
|
||||
|
||||
if (empty($result)) {
|
||||
return $this->response->setStatusCode(204)->setBody('No data found');
|
||||
}
|
||||
|
||||
$formatted = [];
|
||||
foreach ($result as $index => $row) {
|
||||
$rowWithSerial = ['S.NO' => $index + 1] + $row;
|
||||
$formatted[] = $rowWithSerial;
|
||||
}
|
||||
$result = $formatted;
|
||||
|
||||
$spreadsheet = new Spreadsheet();
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
|
||||
$headers = array_keys($result[0]);
|
||||
$columnWidth = 20; // standard column width
|
||||
|
||||
$colIndex = 1;
|
||||
foreach ($headers as $header) {
|
||||
$columnLetter = Coordinate::stringFromColumnIndex($colIndex);
|
||||
$cellCoordinate = $columnLetter . '1';
|
||||
|
||||
$sheet->setCellValue($cellCoordinate, ucfirst(str_replace('_', ' ', $header)));
|
||||
|
||||
$sheet->getColumnDimension($columnLetter)->setWidth($columnWidth);
|
||||
|
||||
$style = $sheet->getStyle($cellCoordinate);
|
||||
$style->getFont()->setBold(true);
|
||||
$style->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
|
||||
$style->getBorders()->getAllBorders()->setBorderStyle(Border::BORDER_THIN);
|
||||
|
||||
$colIndex++;
|
||||
}
|
||||
|
||||
$rowNum = 2;
|
||||
foreach ($result as $row) {
|
||||
$colIndex = 1;
|
||||
foreach ($row as $cell) {
|
||||
$columnLetter = Coordinate::stringFromColumnIndex($colIndex);
|
||||
$cellCoordinate = $columnLetter . $rowNum;
|
||||
$sheet->setCellValue($cellCoordinate, $cell);
|
||||
$colIndex++;
|
||||
}
|
||||
$rowNum++;
|
||||
}
|
||||
|
||||
|
||||
$exportDir = WRITEPATH . 'exports';
|
||||
if (!is_dir($exportDir)) {
|
||||
mkdir($exportDir, 0777, true);
|
||||
} else {
|
||||
chmod($exportDir, 0777);
|
||||
}
|
||||
|
||||
$filename = 'inception_export_' . date('Ymd_His') . '.xlsx';
|
||||
$filepath = $exportDir . '/' . $filename;
|
||||
|
||||
$writer = new Xlsx($spreadsheet);
|
||||
$writer->save($filepath);
|
||||
|
||||
return $this->response->setJSON([
|
||||
'status' => 'success',
|
||||
'downloadUrl' => base_url('employee/download_file?file=' . urlencode($filename))
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public function download_file()
|
||||
{
|
||||
$filename = $this->request->getGet('file');
|
||||
$filepath = WRITEPATH . 'exports/' . $filename;
|
||||
|
||||
if (!file_exists($filepath)) {
|
||||
return $this->response->setStatusCode(404)->setBody('File not found.');
|
||||
}
|
||||
|
||||
return $this->response->download($filepath, null)->setFileName($filename);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1849,4 +1849,94 @@ class EmployeePolicyModel extends Model
|
||||
|
||||
return $result[0];
|
||||
}
|
||||
|
||||
public function download_inception($client_id = 0, $branch_id = 0, $policy_id = 0, $status = [], $emp_code = "", $emp_name = ""){
|
||||
|
||||
$result = $this->select([
|
||||
|
||||
'emp.emp_code AS `Emp ID`',
|
||||
'emp.name AS `Name of Emp/Dep`',
|
||||
"DATE_FORMAT(emp.dob, '%d-%b-%Y') AS `DOB`",
|
||||
'emp.gender As `Gender`',
|
||||
'emp.relationship As `Relationship`',
|
||||
|
||||
'employee_polices.basic_cover_si As `Basic cover SI`',
|
||||
|
||||
"DATE_FORMAT(emp.doj, '%d-%b-%Y') AS `DOJ`",
|
||||
'emp.basic_pay As `Basic Pay`',
|
||||
'emp.band As `Band/Grade`',
|
||||
|
||||
'emp.mobile as Phone',
|
||||
'emp.email_corporate As Email',
|
||||
'emp.change_event',
|
||||
|
||||
'employee_polices.pre_existing_alignments as `PRE EXISTING AILMENTS`',
|
||||
'employee_polices.date_of_exit',
|
||||
'employee_polices.reason_for_exit',
|
||||
|
||||
'emp.unit'
|
||||
|
||||
])
|
||||
->join('employees emp', 'employee_polices.employee_id = emp.id')
|
||||
->join('client_policy cp', 'employee_polices.client_policy_id = cp.id') //cp - client policy
|
||||
->join('policies pm', 'cp.policy_id = pm.id', 'left') //pm - policy master
|
||||
->join('policy_type', 'policy_type.id = cp.policy_type_id')
|
||||
->join('insurers im', 'cp.insurer_id = im.id', 'left') //im - insurer master
|
||||
->join('insurer_branch ib', 'cp.insurer_branch_id = ib.id', 'left') //ib - insurer branch
|
||||
->join('tpa tpam', 'cp.tpa_id = tpam.id', 'left') //tpam - tpa master
|
||||
->join('tpa_branch tpab', 'cp.tpa_branch_id = tpab.id', 'left') //tpab - tpa branch
|
||||
->join('clients cm', 'cp.client_id = cm.id') //cm - client master
|
||||
->join('client_branch', 'emp.client_branch_id = client_branch.id') //cm - client master
|
||||
->orderBy('emp.emp_code', 'ASC')
|
||||
->orderBy('employee_polices.employee_id', 'ASC');
|
||||
|
||||
|
||||
// Conditionally add where clauses
|
||||
if ($client_id != 0 && !empty(trim($client_id))) {
|
||||
$result->where('emp.client_id', $client_id);
|
||||
}
|
||||
if ($branch_id != 0 && !empty(trim($branch_id))) {
|
||||
$result->where('emp.client_branch_id', $branch_id);
|
||||
}
|
||||
if ($policy_id != 0 && !empty(trim($policy_id))) {
|
||||
$result->where('employee_polices.client_policy_id', $policy_id);
|
||||
}
|
||||
|
||||
if (is_array($status) && count($status) > 0) {
|
||||
|
||||
$result->where('employee_polices.status !=', 'expired');
|
||||
|
||||
if (in_array("active", $status)) {
|
||||
|
||||
$result->where('employee_polices.tpa_id IS NOT NULL');
|
||||
$result->where('employee_polices.uhid IS NOT NULL');
|
||||
$result->whereIn('employee_polices.status', $status);
|
||||
} elseif (in_array("pending", $status)) {
|
||||
|
||||
$result->where('employee_polices.tpa_id IS NULL');
|
||||
$result->where('employee_polices.uhid IS NULL');
|
||||
$result->whereIn('employee_polices.status', array_merge($status, ['active']));
|
||||
} else {
|
||||
|
||||
$result->whereIn('employee_polices.status', $status);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty(trim($emp_code))) {
|
||||
$result->where('emp.emp_code', $emp_code);
|
||||
}
|
||||
if (!empty(trim($emp_name))) {
|
||||
$result->like('emp.name', $emp_name);
|
||||
}
|
||||
|
||||
// Always check these conditions
|
||||
$result->where('employee_polices.is_active', 1)
|
||||
->where('emp.is_active', 1);
|
||||
|
||||
$res = $result->findAll();
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -75,6 +75,19 @@
|
||||
border-radius: 5px;
|
||||
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.btn-inception {
|
||||
background-color: #02a8b5; /* Bootstrap primary blue */
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 6px 12px;
|
||||
font-weight: 500;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.btn-inception:hover {
|
||||
background-color: #05676eff;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<?php $pro_rata_total = 0; $gst_total = 0 ?>
|
||||
@ -88,6 +101,7 @@
|
||||
<h4 style="position: relative;">Employees</h4>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table class="table table-striped mb-0 nowrap" cellspacing="0" id="tickets-table">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
@ -105,6 +119,8 @@
|
||||
<th class="font-weight-medium">EMP Code</th>
|
||||
<th class="font-weight-medium">Relationship</th>
|
||||
<th class="font-weight-medium">Gender</th>
|
||||
<th class="font-weight-medium">Email</th>
|
||||
<th class="font-weight-medium">Mobile</th>
|
||||
<th class="font-weight-medium">Date of Birth</th>
|
||||
<th class="font-weight-medium">Policy name</th>
|
||||
<th class="font-weight-medium">Insurer name</th>
|
||||
@ -144,6 +160,8 @@
|
||||
<td><?php echo $employee['emp_code']; ?></td>
|
||||
<td><?php echo $employee['relationship']; ?></td>
|
||||
<td><?php echo $employee['gender']; ?></td>
|
||||
<td><?php echo $employee['email_corporate']; ?></td>
|
||||
<td><?php echo $employee['mobile']; ?></td>
|
||||
<td><?php echo date('d/m/Y', strtotime($employee['dob'])); ?></td>
|
||||
<td><?php echo isset($employee['policy_type']) ? $employee['policy_type'] : ''; ?> -
|
||||
<?php echo isset($employee['policy_no']) ? $employee['policy_no'] : ''; ?></td>
|
||||
@ -394,7 +412,8 @@ $(document).ready(function() {
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'Member-List',
|
||||
},
|
||||
}
|
||||
,
|
||||
{
|
||||
extend: 'excelHtml5',
|
||||
text: 'Excel',
|
||||
@ -428,6 +447,15 @@ $(document).ready(function() {
|
||||
});
|
||||
}
|
||||
}
|
||||
,
|
||||
{
|
||||
|
||||
text: 'Export As Inception',
|
||||
className: 'btn-inception',
|
||||
action: function (e, dt, node, config) {
|
||||
downloadInception();
|
||||
}
|
||||
}
|
||||
],
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
@ -779,4 +807,56 @@ function get_emp_history(input, emp_id) {
|
||||
// modalInstance.hide();
|
||||
// }
|
||||
// }
|
||||
|
||||
function downloadInception(){
|
||||
|
||||
let client = $('#clients').val();
|
||||
let branch = $('#branch_id').val();
|
||||
let policies = $('#policies').val();
|
||||
let status = $('#status2').val();
|
||||
let empCode = $('#emp_code').val();
|
||||
let empName = $('#emp_name').val();
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: "<?php echo base_url('employee/download_inception') ?>",
|
||||
data: {
|
||||
client: client,
|
||||
branch: branch,
|
||||
policies: policies,
|
||||
status: status,
|
||||
empCode: empCode,
|
||||
empName: empName
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.status === 'success') {
|
||||
$('<a>', {
|
||||
href: response.downloadUrl,
|
||||
download: '',
|
||||
style: 'display:none'
|
||||
}).appendTo('body')[0].click();
|
||||
} else {
|
||||
alert(response.message || 'Download failed');
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('Error:', error);
|
||||
},
|
||||
complete: function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
console.log('AJAX request finished.');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -1,4 +1,4 @@
|
||||
<div class="tab-pane active show" id="pending-actions-dash-tab" style="/*padding-left: 35px;*/padding-right: 35px;">
|
||||
<div class="tab-pane active show" id="pending-actions-dash-tab" >
|
||||
<div class="row visa_status_count_view">
|
||||
<div class="col-12">
|
||||
<div class="card" style="border: 0px;height: 470px;">
|
||||
@ -6,20 +6,20 @@
|
||||
style="padding: 0.5rem !important;background-color: white;">
|
||||
<!-- Search Input Field -->
|
||||
<div class="row">
|
||||
<div class="col-3">
|
||||
<select class="form-control" name="" id="enrollment_status_open_close">
|
||||
<div class="col-3" >
|
||||
<select class="form-control " name="" id="enrollment_status_open_close" style="width:200px">
|
||||
<option value="open">Open Enrolment</option>
|
||||
<option value="close">Closed Enrolment</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-5"></div>
|
||||
<div class="col-4">
|
||||
<input type="text" id="searchInput" class="search-input"
|
||||
<input type="text" id="searchInput" class="search-input" style="width:200px;margin-left:150px;"
|
||||
placeholder="Search by client or branch">
|
||||
</div>
|
||||
</div>
|
||||
<!-- Carousel Structure -->
|
||||
<div id="carouselExampleControls" class="carousel slide" data-ride="carousel" data-interval="false">
|
||||
<div id="carouselExampleControls" class="carousel slide" data-ride="carousel" data-interval="false" style="height:30vh; width:90vw;">
|
||||
<div class="carousel-inner">
|
||||
<?php
|
||||
$itemsPerSlide = 3; // Number of items per slide
|
||||
@ -88,14 +88,14 @@
|
||||
class="number_css"
|
||||
onclick="enrollment_list(this, 'emp_logged_in_view_click')"><?php echo isset($clients['logged_in_count']) ? $clients['logged_in_count'] : '0'; ?></span><br>
|
||||
<span class="text-nowrap "
|
||||
style="color: currentColor;font-size: 15px;">Logged-In</span>
|
||||
style="color: black;font-size: 15px;">Logged-In</span>
|
||||
</div>
|
||||
<div class="col-6 emp-count-view-click">
|
||||
<span style="font-size: large;color: black !important;"
|
||||
class="number_css"
|
||||
onclick="enrollment_list(this, 'emp_not_logged_in_view_click')"><?php echo isset($clients['not_logged_in_count']) ? $clients['not_logged_in_count'] : '0'; ?></span><br>
|
||||
<span class="text-nowrap"
|
||||
style="color: currentColor;font-size: 15px;margin-left: -13px;">Not
|
||||
style="color: black;font-size: 15px;margin-left: -13px;">Not
|
||||
Logged-In</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -105,14 +105,14 @@
|
||||
class="number_css"
|
||||
onclick="enrollment_list(this, 'emp_not_enrolled_view_click')"><?php echo isset($clients['draft_count']) ? $clients['draft_count'] : '0'; ?></span><br>
|
||||
<span class="text-nowrap"
|
||||
style="color: currentColor;font-size: 15px;">Draft</span>
|
||||
style="color: black;font-size: 15px;">Draft</span>
|
||||
</div>
|
||||
<div class="col-6 emp-count-view-click">
|
||||
<span style="font-size: large;color: black !important;"
|
||||
class="number_css"
|
||||
onclick="enrollment_list(this, 'emp_enrolled_view_click')"><?php echo isset($clients['enrolled_count']) ? $clients['enrolled_count'] : '0'; ?></span><br>
|
||||
<span class="text-nowrap"
|
||||
style="color: currentColor;font-size: 15px;">Enrolled</span>
|
||||
style="color: black;font-size: 15px;">Enrolled</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
BIN
public/assets/images/action_on_policies_sb.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
public/assets/images/app_content_mng_sb.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
public/assets/images/claims_sb.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
public/assets/images/clients_sb.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
public/assets/images/leads_sb.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
public/assets/images/masters_sb.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
public/assets/images/policy_transactions_sb.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
public/assets/images/user_manual_sb.png
Normal file
|
After Width: | Height: | Size: 15 KiB |