Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev

This commit is contained in:
velz 2024-04-16 14:52:39 +05:30
commit c2db46b769
8 changed files with 1484 additions and 1197 deletions

View File

@ -215,6 +215,7 @@ $routes->group("/util", ["filter" => "authMVC"], function($routes){
$routes->get("featch-emp-list", "EmployeeController::featchEmpList/$1");
$routes->get("view-success-emp-list", "EmployeeController::viewUploadedEmployeeList/$1");
$routes->get("fetch-policy-for-policy-type", "ClientController::fetchPolicyDataForPolicyType/$1");
$routes->get("fetch-emp-count/(:any)", "EmployeeController::getEmpCount/$1");
});

View File

@ -84,7 +84,6 @@ class EmpDataServiceController extends BaseController
}
return true;
}
@ -105,9 +104,19 @@ class EmpDataServiceController extends BaseController
// Fetch employee data for export from the database
$objects = $this->employeePolicyModel->getInceptionEmployeeDataForExportExcel($export_data);
$totals = 0;
foreach ($objects as $key => $value) {
$totals += $value->total;
}
// Log the count of exported data
$count = count($objects);
$export_data['count'] = $count;
$export_data['amount'] = $totals;
$this->myLogger->logme('error', 'Inception export data count : {data}', ['data' => $count]);
// If no data is found for export, return false
@ -251,13 +260,11 @@ class EmpDataServiceController extends BaseController
fclose($tempFile);
return true;
} else {
return false;
}
}
}
@ -266,16 +273,19 @@ class EmpDataServiceController extends BaseController
$ids = [];
$objects = $this->employeePolicyModel->getSIEnhancementEmployeesDataForExportExcel($export_data);
$totals = 0;
foreach ($objects as $obj) {
$ids[] = $obj->endorsement_primarykey;
$totals += $obj->total;
}
$rounded_totals = round($totals, 2);
// echo '<pre>';
// print_r($ids); die;
// dd($objects);
$count = count($objects);
$export_data['count'] = $count;
$export_data['amount'] = $rounded_totals;
$this->myLogger->logme('error', 'SI_Enhancement export data count : {data}', ['data' => $count]);
@ -343,12 +353,10 @@ class EmpDataServiceController extends BaseController
fclose($tempFile);
return true;
} else {
return false;
}
}
}
@ -358,16 +366,20 @@ class EmpDataServiceController extends BaseController
$objects = $this->employeePolicyModel->getDeletionEmployeeDataForExportExcel($export_data);
$totals = 0;
foreach ($objects as $obj) {
$ids[] = $obj->endorsement_primarykey;
$totals += $obj->total;
}
$rounded_totals = round($totals, 2);
// echo '<pre>';
// print_r($ids);
// print_r($objects); die;
$count = count($objects);
$export_data['count'] = $count;
$export_data['amount'] = $rounded_totals;
$this->myLogger->logme('error', 'Deletion export data count : {data}', ['data' => $count]);
@ -431,13 +443,10 @@ class EmpDataServiceController extends BaseController
fclose($tempFile);
return true;
} else {
return false;
}
}
}
@ -476,6 +485,7 @@ class EmpDataServiceController extends BaseController
$missing_id = [];
$empty_emp_tpa_uh_ids = [];
$totals = 0;
foreach ($data as $key => $value) {
try {
@ -486,6 +496,7 @@ class EmpDataServiceController extends BaseController
$emp_code = $value[2];
$name = $value[1];
$totals += $value[20];
$db = \Config\Database::connect();
@ -514,6 +525,7 @@ class EmpDataServiceController extends BaseController
}
}
$missing_id_count = count($missing_id);
$empty_id_count = count($empty_emp_tpa_uh_ids);
@ -537,6 +549,7 @@ class EmpDataServiceController extends BaseController
$import_data['count'] = $count;
$import_data['file_name'] = $filename;
$import_data['amount'] = $totals;
$this->insertBatchFileAndBatchListForImportExcel($import_data, $empty_emp_tpa_uh_ids);
@ -579,7 +592,6 @@ class EmpDataServiceController extends BaseController
$this->cashDepositCalculationForInception($depositeData);
return 1;
}
@ -680,8 +692,7 @@ class EmpDataServiceController extends BaseController
$file_name_with_path = WRITEPATH . "/uploads/import_excel/" . $batch_file_batch_code['file_name'];
if(!file_exists($file_name_with_path))
{
if (!file_exists($file_name_with_path)) {
return 2;
}
@ -689,7 +700,6 @@ class EmpDataServiceController extends BaseController
unset($data[0]);
$count = count($data);
$this->batchFileModel->where('id', $insert)->set('count', $count)->update();
// dd($data);
foreach ($data as $key => $value) {
if (!empty($value) && isset($value[10])) {
@ -745,12 +755,10 @@ class EmpDataServiceController extends BaseController
return 0;
}
}
return 1;
}
@ -765,8 +773,10 @@ class EmpDataServiceController extends BaseController
unset($data[0]);
$count = count($data);
$missing_id = [];
$empty_emp_tpa_uh_ids = [];
$totals = 0;
foreach ($data as $key => $value) {
try {
@ -774,6 +784,8 @@ class EmpDataServiceController extends BaseController
$missing_id[] = $key + 1;
}
$totals += $value[18];
$emp_name = $value[1];
$emp_code = $value[2];
$endorsement_id = $value[19] != null ? $value[19] : '';
@ -803,6 +815,7 @@ class EmpDataServiceController extends BaseController
return 0;
}
}
$rounded_totals = round($totals, 2);
$missing_id_count = count($missing_id);
$empty_id_count = count($empty_emp_tpa_uh_ids);
@ -841,6 +854,7 @@ class EmpDataServiceController extends BaseController
$import_data['batch_code'] = $batch_code;
$import_data['created_by'] = get_session_userid();
$import_data['file_name'] = $filename;
$import_data['amount'] = $rounded_totals;
$insert = $this->batchFileModel->insert($import_data);
$batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
@ -849,8 +863,7 @@ class EmpDataServiceController extends BaseController
$file_name_with_path = WRITEPATH . "/uploads/import_excel/" . $batch_file_batch_code['file_name'];
if(!file_exists($file_name_with_path))
{
if (!file_exists($file_name_with_path)) {
return 2;
}
@ -858,7 +871,6 @@ class EmpDataServiceController extends BaseController
unset($data[0]);
$count = count($data);
$this->batchFileModel->where('id', $insert)->set('count', $count)->update();
// dd($data);
$employeeIds = [];
foreach ($data as $key => $value) {
@ -925,12 +937,10 @@ class EmpDataServiceController extends BaseController
$this->batchListModel->insert($batch_code_for_batch_list);
array_push($employeeIds, $id);
}
} else {
return 0;
}
}
$policy_name = $this->getPolicyNameUsingClientPolicyId($client_policy_id);
@ -963,8 +973,10 @@ class EmpDataServiceController extends BaseController
array_pop($data);
$count = count($data);
$missing_id = [];
$empty_emp_tpa_uh_ids = [];
$totals = 0 ;
foreach ($data as $key => $value) {
try {
@ -973,6 +985,8 @@ class EmpDataServiceController extends BaseController
$missing_id[] = $key + 1;
}
$totals += $value[13];
$emp_name = $value[2]; //employee name
$emp_code = $value[1]; //employee code
$date_of_exit = $value[7]; // date of releving
@ -1003,10 +1017,10 @@ class EmpDataServiceController extends BaseController
}
}
$rounded_totals = round($totals, 2);
$missing_id_count = count($missing_id);
$empty_id_count = count($empty_emp_tpa_uh_ids);
// if($missing_id_count != $count){
// return 2;
@ -1041,6 +1055,7 @@ class EmpDataServiceController extends BaseController
$import_data['batch_code'] = $batch_code;
$import_data['created_by'] = get_session_userid();
$import_data['file_name'] = $filename;
$import_data['amount'] = $rounded_totals;
$insert = $this->batchFileModel->insert($import_data);
$batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
@ -1049,8 +1064,7 @@ class EmpDataServiceController extends BaseController
$file_name_with_path = WRITEPATH . "/uploads/import_excel/" . $batch_file_batch_code['file_name'];
if(!file_exists($file_name_with_path))
{
if (!file_exists($file_name_with_path)) {
return 2;
}
@ -1140,7 +1154,6 @@ class EmpDataServiceController extends BaseController
return 0;
}
}
$policy_name = $this->getPolicyNameUsingClientPolicyId($client_policy_id);
@ -1155,8 +1168,6 @@ class EmpDataServiceController extends BaseController
$this->cashDepositCalculationForDeletion($depositeData);
return 1;
}
@ -1207,8 +1218,6 @@ class EmpDataServiceController extends BaseController
} else {
return 0;
}
}
@ -1287,7 +1296,6 @@ class EmpDataServiceController extends BaseController
} else {
return 0;
}
}
@ -1381,7 +1389,6 @@ class EmpDataServiceController extends BaseController
"old_value" => $old_total,
"new_value" => $total
);
}
return $result;
@ -1452,9 +1459,7 @@ class EmpDataServiceController extends BaseController
"field_name" => 'Claim',
"data" => '---',
);
}
}
return $result;
@ -1488,7 +1493,6 @@ class EmpDataServiceController extends BaseController
}
return $data;
} else {
return false;

View File

@ -77,6 +77,7 @@ class EmployeeController extends AdminController
{
//echo $this->request->isAJAX();die();
$result = $this->clientModel->clientsWithPolicies();
// print_r($result);die();
if(!count($result))
{
@ -559,8 +560,6 @@ class EmployeeController extends AdminController
}
// @param int $client_policy_id
// this funciton initiate Inception/adition/DA of employees data only form enrollment app when passing
// client_policy_id pull draft and enrolled status employees and proceed to calculatin and make entry in DB
@ -572,12 +571,18 @@ class EmployeeController extends AdminController
}
public function downloadFileList($fileName = null)
public function downloadFileList($file_id = null)
{
// $actionType = $this->request->getGet();
try {
$file_data = $this->fileModel->where('id', $file_id)->first();
$fileName = $file_data['file_name'];
$error_data = json_decode($file_data['reason']);
$filePath = WRITEPATH . '/uploads/excel/' . $fileName;
try {
// Check if the file exists
if (file_exists($filePath)) {
// Set the appropriate MIME type
@ -587,7 +592,8 @@ class EmployeeController extends AdminController
return $this->response->download($filePath, null, $mimeType);
} else {
throw new \CodeIgniter\Exceptions\PageNotFoundException();
$data['message'] = 'The Physical File Not Found';
echo view('errors/404', $data);
}
} catch (\Exception $e) {
// Handle any exceptions
@ -596,7 +602,6 @@ class EmployeeController extends AdminController
// You can return an error response here
echo $errorMessage;
}
}
@ -641,6 +646,7 @@ class EmployeeController extends AdminController
$emp_data['tbody'] = $excel_data;
$html = view('view_file_upload_emp_list', $emp_data);
} else {
$html = '<div class="text-center">No Data Found</div>';
@ -657,5 +663,25 @@ class EmployeeController extends AdminController
}
}
public function getEmpCount($id = null){
$data = $this->employeeModel->select('employees.id')
->join('clients', 'clients.id = employees.client_id')
->where('employees.client_id', $id)
->findAll();
$emp_count = count($data);
if($data){
return $this->respond(['dataStatus' => true, 'code' => 200, 'emp_count' => $emp_count], 200);
}else{
return $this->respond(['dataStatus' => false, 'code' => 404], 404);
}
}
}

View File

@ -339,8 +339,10 @@ class EmployeeRestController extends AdminController
$result = [];
foreach ($ClientPolicyData as $key => $value) {
$getSlabAndGridData = $this->policesModel->getPolicySlabRatesForEmpOnboard( $value['client_policy_id'],$value['client_id']);
if($value['is_addon'] == 1){
$value['type'] = 'AddOn';
if($value['is_addon'] == "2"){
$value['type'] = 'SI-TopUp';
}else if($value['is_addon'] == "3"){
$value['type'] = 'Dependent-AddOn';
}else{
$value['type'] = $getSlabAndGridData['grid_master']['policy_type'];
}
@ -854,6 +856,7 @@ class EmployeeRestController extends AdminController
// $return_log = json_decode($return_log);
// $this->myLogger->logme('info', "Email Status : {mail_status}, Sender Email:{email}", ['mail_status' => $return_log->status, 'email'=> $return_log->data]);
}
return $this->respond(['status' => 'success', 'code' => 200, 'message' => "Success" ], 404);
}else{
return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "Client id and Client Policy id is Not Match!" ], 404);
}
@ -882,7 +885,7 @@ public function getEmployeePolicy()
$empPolicy = $this->employeeModel->getEmployeePolicy($id);
// Retrieve employee and dependents data by passing the employee code
$employeeData = $this->employeeModel->where('emp_code',$emp_code)->where('is_active', 1 )->where('is_addon_value',0)->findAll();
// dd($empPolicy);
if ($empPolicy) {
@ -1099,14 +1102,12 @@ public function getAddOnPolicy()
{
$PolicyData = [];
foreach ($clientPolicy as $key => $array) {
$responce = [];
$decodedArray = json_decode($array['policy_terms']);
$policy_terms = $decodedArray;
$getSlabAndGridData = $this->policesModel->getPolicySlabRatesForEmpOnboard($array['id'],$array['client_id']);
if($array['is_addon'] == 1)
{
$responce['policy_name'] = $this->policesModel->where('id',$array['policy_id'])->get()->getRow()->name;
$responce['SlabRates'] = $getSlabAndGridData['slab_rates'];
$responce['GridMaster'] = $getSlabAndGridData['grid_master'];
@ -1116,6 +1117,8 @@ public function getAddOnPolicy()
$responce['open_for_enrollment'] = $array['open_for_enrollment'];
$responce['policy_terms'] = $decodedArray;
if($array['is_addon'] == 3)
{
// Map family floaters that already exist in the employee table
@ -1213,6 +1216,17 @@ public function getAddOnPolicy()
$responce['family_floaters_of_dependent_and_si_premium_value'] = $dependent_and_si_premium_value;
if($this->request->getGet('policy') == 'GMC-DEPENDENT-ADDON'){
return $this->respond(['status' => 'success','code' => 200,'data' => ['gmc_dependent_addon'=>$responce]], 200);
}
//array_push($PolicyData, $responce);
}else if($array['is_addon'] == 2){
$only_si_array = [];
$only_si_value = null;
$only_si_premium_value = null;
@ -1237,16 +1251,17 @@ public function getAddOnPolicy()
$responce['family_floaters_of_only_si_value'] = $only_si_value;
$responce['family_floaters_of_only_si_premium_value'] = $only_si_premium_value;
if($this->request->getGet('policy') == 'GMC-SI-TOPUP'){
return $this->respond(['status' => 'success','code' => 200,'data' => ['gmc_si_topup'=>$responce]], 200);
}
array_push($PolicyData, $responce);
}
}
return $this->respond(['status' => 'success','code' => 200,'data' => ['addon_policy'=>$responce]], 200);
// return $this->respond(['status' => 'success','code' => 200,'data' => ['addon_policy'=>$responce]], 200);
}else{
return $this->respond(['status' => 'failed','code' => 404,'data' => []], 404);

View File

@ -21,6 +21,7 @@ class BatchFileModel extends Model
"created_by",
"updated_by",
"is_active",
"amount",
];
// Callbacks

View File

@ -26,6 +26,7 @@
<th class="font-weight-medium">Insurer/TPA</th>
<th class="font-weight-medium">Action</th>
<th class="font-weight-medium">Count</th>
<th class="font-weight-medium">Amount</th>
</tr>
</thead>
@ -46,6 +47,7 @@
<td><?php echo $file['insurer_or_tpa']?></td>
<td><?php echo $file['actions']?></td>
<td><?php echo $file['count']?></td>
<td><?php echo $file['amount']?></td>
</tr>
<?php }}?>

View File

@ -478,15 +478,75 @@ $(document).ready(function() {
$('#client_id').on('change', function() {
var selectedClient = $(this).val();
console.log(selectedClient);
console.log('selectedClient', selectedClient);
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
// Check if the selected option exists in apiData
var foundPolicies = clientPolicies.find(function(item) {
return item.id === selectedClient;
});
console.log(foundPolicies.policies);
appendPolicies(foundPolicies.policies);
var apiURL = '<?php echo base_url();?>' + 'util/fetch-emp-count/' + selectedClient;
console.log(apiURL);
$.ajax({
url: apiURL,
method: 'GET',
headers: {
"Content-Type": "application/json",
"X-Requested-With": "XMLHttpRequest"
},
success: function(response) {
console.log('responce data emp_count', response);
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
try {
console.log(response.emp_count.length)
if(response.emp_count > 0){
var select = document.getElementById("upload-action-type");
for (var i = 0; i < select.options.length; i++) {
if (select.options[i].value === "inception") {
select.options[i].disabled = true;
break;
}
}
}else{
var select = document.getElementById("upload-action-type");
for (var i = 0; i < select.options.length; i++) {
if (select.options[i].value === "inception") {
select.options[i].disabled = false;
break;
}
}
}
} catch (error) {
console.error('Error parsing API response data:', error);
}
} else if (response.code === 404 && response.dataStatus === false) {
console.error('no data found', response);
} else {
console.error('Something went wrong!');
}
},
error: function(xhr, status, error) {
console.error('Error fetching data from API:', error);
var select = document.getElementById("upload-action-type");
for (var i = 0; i < select.options.length; i++) {
if (select.options[i].value === "inception") {
select.options[i].disabled = false;
break;
}
}
}
});
});
});
@ -573,7 +633,9 @@ document.getElementById('toggleIcon1').addEventListener('click', function() {
icon.classList.toggle('mdi-chevron-up');
});
$('#fetch_enrolled_data').click(function() {
$('#fetch_enrolled_data').click(function()
{
$('#emp_data').empty();
var client_id = $('#client_id').val();
@ -637,5 +699,6 @@ $('#fetch_enrolled_data').click(function() {
});
})
//--------------------------------------------------------------------------------------
</script>

175
app/Views/errors/404.php Normal file
View File

@ -0,0 +1,175 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title><?= isset($page_name) ? $page_name : 'NHance'; ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta content="" name="description" />
<meta content="NHANCE" name="NHANCE" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<!-- App favicon -->
<link rel="shortcut icon" href="<?= base_url()."public"; ?>/assets/images/Nhance_Favi.svg">
<style>
@import url('https://fonts.googleapis.com/css2?family=Poppins&display=swap');
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
position: relative;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background: #22232e;
font-family: 'Poppins', sans-serif;
}
a {
text-decoration: none;
}
ul {
list-style: disc;
color: #e0ffff;
}
section {
width: 100%;
}
.container {
display: flex;
justify-content: center;
align-items: center;
flex-direction: row;
column-gap: 20px;
}
.container img {
width: 420px;
}
.text {
display: block;
padding: 40px 40px;
width: 450px;
}
.text h1 {
color: #00c2cb;
font-size: 35px;
font-weight: 700;
margin-bottom: 15px;
}
.text p {
font-size: 15px;
color: #e0ffff;
margin-bottom: 15px;
line-height: 1.5rem;
margin-bottom: 15px;
}
.text .input-box {
position: relative;
display: flex;
width: 100%;
}
.input-box input {
width: 85%;
height: 40px;
padding: 5px 15px;
font-family: 'Jost', sans-serif;
font-size: 16px;
color: #22232e;
border-radius: 5px 0px 0px 5px;
border: 2px solid #42455a;
outline: none;
}
.input-box button {
display: flex;
width: 15%;
border: 1px solid #004958;
border-radius: 0px 5px 5px 0px;
background: #004958;
color: #e0ffff;
font-size: 22px;
align-items: center;
justify-content: center;
cursor: pointer;
}
.menu {
display: flex;
flex-direction: column;
margin-top: 15px;
margin-left: 30px;
}
.menu li a {
display: flex;
font-size: 1rem;
color: #00c2cb;
transition: 0.1s;
}
@media screen and (max-width:600px) {
.container {
display: flex;
flex-direction: column-reverse;
}
.text,
.image {
width: 100%;
}
.container {
min-width: 200px;
padding: 40px 0px;
}
.text {
display: block;
width: 100%;
padding: 20px 40px;
}
.image {
display: flex;
width: 200px;
align-self: center;
justify-content: center;
margin: auto;
}
}
</style>
</head>
<body>
<section>
<div class="container">
<div class="text">
<h1><?= isset($message) && !empty($message) ? $message : '404 PAGE NOT FOUND' ?></h1>
</div>
<div><img class="image" src="https://omjsblog.files.wordpress.com/2023/07/errorimg.png" alt=""></div>
</div>
</div>
</section>
</body>
</html>