Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
c635cebbe3
@ -274,6 +274,7 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
$count = count($objects);
|
||||
$export_data['count'] = $count;
|
||||
$export_data['status'] = 'success';
|
||||
$this->myLogger->logme('error', 'Correction export data count : {data}', ['data' => $count]);
|
||||
|
||||
if ($count == 0) {
|
||||
@ -533,6 +534,90 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
|
||||
|
||||
public function generateExcelForAdditionAndDependentAddition($export_data)
|
||||
{
|
||||
$ids = [];
|
||||
|
||||
$objects = $this->employeePolicyModel->getCorrectionEmployeesDataForExportExcel($export_data);
|
||||
|
||||
foreach ($objects as $obj) {
|
||||
$ids[] = $obj->id;
|
||||
}
|
||||
|
||||
$count = count($objects);
|
||||
$export_data['count'] = $count;
|
||||
$export_data['status'] = 'success';
|
||||
$this->myLogger->logme('error', 'Addition And Dependent Addition export data count : {data}', ['data' => $count]);
|
||||
|
||||
if ($count == 0) {
|
||||
$this->myLogger->logme('error', 'No Record found. Endorsement ID Alread Updated. Correction export data count : {data}', ['data' => $count]);
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->removeOldExportInfoFromBatchFile($export_data);
|
||||
|
||||
|
||||
$this->myLogger->logme('error', 'Addition And Dependent Addition export file name : {data}', ['data' => $export_data['file_name']]);
|
||||
|
||||
$correction_data = transform_objects_to_array_for_correction($objects);
|
||||
|
||||
$headers = [
|
||||
'Emp Code',
|
||||
'RISK ID',
|
||||
'NAME OF EMP/DEP',
|
||||
'EMP/DEP TYPE',
|
||||
'RELATION',
|
||||
'DOB',
|
||||
'GENDER',
|
||||
'Wrong Data',
|
||||
'Correct Data',
|
||||
'Remarks',
|
||||
'Endorsement_Id'
|
||||
];
|
||||
|
||||
// Create a temporary file in memory
|
||||
$tempFile = tmpfile();
|
||||
|
||||
// Generate Excel file with the temporary file
|
||||
$value = generate_excel($headers, $correction_data, $tempFile);
|
||||
|
||||
if ($value) {
|
||||
|
||||
|
||||
|
||||
$return = $this->batchFilesAndBatchListEntry($export_data, $objects);
|
||||
|
||||
if ($return) {
|
||||
|
||||
foreach ($ids as $key => $id) {
|
||||
$group_key = $this->empEndorsementModel->select('group_key')->where('id', $id)->first();
|
||||
if ($group_key) {
|
||||
$this->empEndorsementModel->where('group_key', $group_key)->set('status', 'inprogress')->update();
|
||||
}
|
||||
}
|
||||
|
||||
// Set the appropriate headers for Excel file download
|
||||
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||
header('Content-Disposition: attachment;filename="' . $export_data['file_name'] . '"');
|
||||
header('Cache-Control: max-age=0');
|
||||
|
||||
// Rewind the temporary file pointer
|
||||
rewind($tempFile);
|
||||
|
||||
// Output the contents of the temporary file to the browser
|
||||
fpassthru($tempFile);
|
||||
|
||||
// Close and remove the temporary file
|
||||
fclose($tempFile);
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The below functions are Imports data from an Excel file for :
|
||||
* - Inception
|
||||
@ -583,9 +668,29 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
$file_name_with_path = WRITEPATH . "/uploads/import_excel/" . $file['file_name'];
|
||||
$excel_data = $this->readExcelFileToArray($file_name_with_path);
|
||||
$excel_header = $excel_data[0];
|
||||
unset($excel_data[0]);
|
||||
array_pop($excel_data);
|
||||
|
||||
$inceptionHeader = ['S.No', 'NAME OF EMP/DEP','EMP ID','EMP/DEP TYPE','RELATION','DOB','GENDER','PRE EXISTING AILMENTS','BASIC COVER SI','DATE OF COVERAGE','AGE','RELATIONSHIP','REMARKS','POLICY END DATE','NO OF DAYS','TPA ID','UHID','PREMIUM','PR0 RATA PREMIUM','GST','TOTAL'];
|
||||
|
||||
foreach ($inceptionHeader as $key => $value) {
|
||||
if($excel_header[$key] != $value){
|
||||
$data = [
|
||||
'status' => 'failed-5',
|
||||
];
|
||||
|
||||
$this->batchFileModel->where('id', $file_id)->set($data)->update();
|
||||
|
||||
$file_data = $this->getDataByFileId($file_id, 'failure');
|
||||
$this->setPullNotification($file_data);
|
||||
|
||||
$this->myLogger->logme('error', 'Inception File Validation -- Upload the worng excel file');
|
||||
return ['status' => 'error', 'message' => 'Upload the worng excel file'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$emp_count = count($excel_data);
|
||||
|
||||
$employee_data = $this->employeePolicyModel
|
||||
@ -1116,7 +1221,6 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
|
||||
//Endorsement Correction
|
||||
|
||||
public function importCorrectionValidation($params)
|
||||
{
|
||||
|
||||
@ -1143,8 +1247,29 @@ class EmpDataServiceController extends BaseController
|
||||
}
|
||||
|
||||
$excel_data = $this->readExcelFileToArray($file_name_with_path);
|
||||
$excel_header = $excel_data[0];
|
||||
unset($excel_data[0]);
|
||||
|
||||
$headers = ['Emp Code','RISK ID','NAME OF EMP/DEP','EMP/DEP TYPE','RELATION','DOB','GENDER','Wrong Data','Correct Data','Remarks','Endorsement_Id'];
|
||||
|
||||
|
||||
foreach ($headers as $key => $value) {
|
||||
if($excel_header[$key] != $value){
|
||||
$data = [
|
||||
'status' => 'failed-5',
|
||||
];
|
||||
|
||||
$this->batchFileModel->where('id', $file_id)->set($data)->update();
|
||||
|
||||
$file_data = $this->getDataByFileId($file_id, 'failure');
|
||||
$this->setPullNotification($file_data);
|
||||
|
||||
$this->myLogger->logme('error', 'Correction File Validation -- Upload the worng excel file');
|
||||
return ['status' => 'error', 'message' => 'Upload the worng excel file'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$endorsement_data = $this->empEndorsementModel
|
||||
->select("
|
||||
@ -1477,7 +1602,7 @@ class EmpDataServiceController extends BaseController
|
||||
if (isset($result['id']) && $result['id'] !== null) {
|
||||
|
||||
// return $result;
|
||||
$emp_details[] = array('id' => $result['emp_id'], 'group_key' => $result['group_key'], $result['field_name'] => $value[8]);
|
||||
$emp_details[] = array('id' => $result['emp_id'], $result['field_name'] => $value[8]);
|
||||
$endorsement_details[] = array('group_key' => $result['group_key'], 'id' => $result['id'], 'endorsement_id' => $value[10], 'status' => 'complete');
|
||||
}
|
||||
|
||||
@ -1486,7 +1611,7 @@ class EmpDataServiceController extends BaseController
|
||||
// return [$emp_details, $endorsement_details];
|
||||
|
||||
$this->empEndorsementModel->updateBatch($endorsement_details, 'group_key');
|
||||
$this->employeeModel->updateBatch($emp_details);
|
||||
$this->employeePolicyModel->bulkUpdateForCorrection($emp_details);
|
||||
|
||||
// Update batch file status and amount
|
||||
$this->batchFileModel->update($file_id, [
|
||||
@ -1531,9 +1656,30 @@ class EmpDataServiceController extends BaseController
|
||||
}
|
||||
|
||||
$excel_data = $this->readExcelFileToArray($file_name_with_path);
|
||||
$excel_header = $excel_data[0];
|
||||
unset($excel_data[0]);
|
||||
|
||||
|
||||
$headers = ['S.No','NAME OF EMP/DEP','EMP ID','EMP/DEP TYPE','RELATION','DOB','GENDER','PRE EXISTING AILMENTS','BASIC COVER SI','Old Sum Insured','Date of Coverage','Policy End Date','No Of Days','Old SI Premium','New SI premium','Difference premium','Pro Rata Premium','GST','Total','ENDORSEMENT_ID'];
|
||||
|
||||
|
||||
foreach ($headers as $key => $value) {
|
||||
if($excel_header[$key] != $value){
|
||||
$data = [
|
||||
'status' => 'failed-5',
|
||||
];
|
||||
|
||||
$this->batchFileModel->where('id', $file_id)->set($data)->update();
|
||||
|
||||
$file_data = $this->getDataByFileId($file_id, 'failure');
|
||||
$this->setPullNotification($file_data);
|
||||
|
||||
$this->myLogger->logme('error', 'SI Enhancement File Validation -- Upload the worng excel file');
|
||||
return ['status' => 'error', 'message' => 'Upload the worng excel file'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$db = \Config\Database::connect();
|
||||
|
||||
// Raw SQL query
|
||||
@ -2113,9 +2259,28 @@ class EmpDataServiceController extends BaseController
|
||||
}
|
||||
|
||||
$excel_data = $this->readExcelFileToArray($file_name_with_path);
|
||||
$excel_header = $excel_data[0];
|
||||
unset($excel_data[0]);
|
||||
array_pop($excel_data);
|
||||
|
||||
$headers = ['S.No','EMP ID','EMP NAME','DOB','GENDER','RELATIONSHIP','SUM INSURED','Date of Leaving','Policy End Date','No Of Days','Premium','Pro Rata Premium','GST','Total','Claim Status','ENDORSEMENT_ID'];
|
||||
|
||||
|
||||
foreach ($headers as $key => $value) {
|
||||
if($excel_header[$key] != $value){
|
||||
$data = [
|
||||
'status' => 'failed-5',
|
||||
];
|
||||
|
||||
$this->batchFileModel->where('id', $file_id)->set($data)->update();
|
||||
|
||||
$file_data = $this->getDataByFileId($file_id, 'failure');
|
||||
$this->setPullNotification($file_data);
|
||||
|
||||
$this->myLogger->logme('error', 'Deletion File Validation -- Upload the worng excel file');
|
||||
return ['status' => 'error', 'message' => 'Upload the worng excel file'];
|
||||
}
|
||||
}
|
||||
|
||||
$db = \Config\Database::connect();
|
||||
|
||||
@ -2524,17 +2689,17 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
// Check if $employees_table_data is null or empty
|
||||
if (empty($employees_table_data)) {
|
||||
return ['error' => true, 'message' => 'Employees table data is empty or null.'];
|
||||
return ['status' => 'error', 'message' => 'Employees table data is empty or null.'];
|
||||
}
|
||||
|
||||
// Check if $employee_policy_table_data is null or empty
|
||||
if (empty($employee_policy_table_data)) {
|
||||
return ['error' => true, 'message' => 'Employee policy table data is empty or null.'];
|
||||
return ['status' => 'error', 'message' => 'Employee policy table data is empty or null.'];
|
||||
}
|
||||
|
||||
// Check if $emp_endorsement_table_data is null or empty
|
||||
if (empty($emp_endorsement_table_data)) {
|
||||
return ['error' => true, 'message' => 'Employee endorsement table data is empty or null.'];
|
||||
return ['status' => 'error', 'message' => 'Employee endorsement table data is empty or null.'];
|
||||
}
|
||||
|
||||
$this->employeeModel->updateBatch($employees_table_data, 'id');
|
||||
@ -2576,6 +2741,403 @@ class EmpDataServiceController extends BaseController
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Endorsement Addition and Dependent Addition
|
||||
|
||||
|
||||
public function AdditionAndDependentAddition($params)
|
||||
{
|
||||
|
||||
$this->myLogger->logme('error', 'Addition And Dependent Addition File Validation -- Function called');
|
||||
|
||||
$file_id = $params['file_id'];
|
||||
$file = $this->batchFileModel->where('id', $file_id)->first();
|
||||
|
||||
$client_id = $file['client_id'];
|
||||
$client_policy_id = $file['client_policy_id'];
|
||||
$client_branch_id = $file['client_branch_id'];
|
||||
$batch_code = $file['batch_code'];
|
||||
$user_id = $file['created_by'];
|
||||
|
||||
$file_name_with_path = WRITEPATH . "/uploads/import_excel/" . $file['file_name'];
|
||||
|
||||
if (!file_exists($file_name_with_path)) {
|
||||
|
||||
$this->myLogger->logme('error', 'Addition And Dependent Addition File Validation -- The Physical file not found');
|
||||
$this->myLogger->logme('error', 'Addition And Dependent Addition File Validation -- File Name : {data}', ['data' => $file['file_name']]);
|
||||
$this->myLogger->logme('error', 'Addition And Dependent Addition File Validation -- File Path : {data}', ['data' => $file_name_with_path]);
|
||||
|
||||
return 'The Physical file not found';
|
||||
}
|
||||
|
||||
$excel_data = $this->readExcelFileToArray($file_name_with_path);
|
||||
unset($excel_data[0]);
|
||||
|
||||
|
||||
$endorsement_data = $this->empEndorsementModel
|
||||
->select("
|
||||
emp_endorsement.id,
|
||||
emp_endorsement.pk,
|
||||
emp_endorsement.emp_code,
|
||||
emp_endorsement.endorsement_id,
|
||||
emp_endorsement.old_value,
|
||||
emp_endorsement.new_value,
|
||||
emp_endorsement.field_name,
|
||||
emp_endorsement.remarks,
|
||||
emp_endorsement.actions,
|
||||
employees.id AS primaryKey,
|
||||
employees.name AS emp_name,
|
||||
employees.dob AS emp_dob,
|
||||
employees.gender AS emp_gender,
|
||||
employees.client_id AS emp_client_id,
|
||||
'Has Define' AS emp_type,
|
||||
employee_polices.uhid,
|
||||
employees.relationship_code
|
||||
")
|
||||
->join("employees", "employees.id = emp_endorsement.pk", "left")
|
||||
->join("employee_polices", "employees.id = employee_polices.employee_id", "left")
|
||||
->where("employees.client_id", $client_id)
|
||||
->where("employee_polices.client_policy_id", $client_policy_id)
|
||||
->where("employees.client_branch_id", $client_branch_id)
|
||||
->where("employees.is_active", 1)
|
||||
->where("employees.emp_status", "active")
|
||||
->where("emp_endorsement.actions", "c")
|
||||
->where("(emp_endorsement.endorsement_id IS NULL OR emp_endorsement.endorsement_id = '')")
|
||||
->findAll();
|
||||
|
||||
|
||||
|
||||
// dd($endorsement_data, $excel_data);
|
||||
|
||||
|
||||
if ($endorsement_data == null || empty($endorsement_data)) {
|
||||
|
||||
$data = [
|
||||
'status' => 'failed-1',
|
||||
];
|
||||
|
||||
$this->batchFileModel->where('id', $file_id)->set($data)->update();
|
||||
$this->myLogger->logme('error', 'correctionFileValidation ENDORSEMENT ID already updated');
|
||||
|
||||
$file_data = $this->getDataByFileId($file_id, 'failure');
|
||||
$this->setPullNotification($file_data);
|
||||
|
||||
return 'The list of employees provided has already been updated with the ENDORSEMENT ID, or this is not the correct file';
|
||||
|
||||
$this->myLogger->logme('error', 'Addition And Dependent Addition File Validation ENDORSEMENT ID already updated or the uploadedfile is not correct');
|
||||
}
|
||||
|
||||
$excel_data_count = count($excel_data);
|
||||
$endorsement_data_count = count($endorsement_data);
|
||||
|
||||
$this->myLogger->logme('error', 'Addition And Dependent Addition File Validation excel file count : {data}', ['data' => $excel_data_count]);
|
||||
$this->myLogger->logme('error', 'Addition And Dependent Addition File Validation database count : {data}', ['data' => $endorsement_data_count]);
|
||||
|
||||
|
||||
$difference = $endorsement_data_count - $excel_data_count;
|
||||
|
||||
$status = 'in-progress';
|
||||
if ($excel_data_count < $endorsement_data_count) {
|
||||
|
||||
$status = 'in-progress-partially';
|
||||
$partially_updated_data = 'Expected : ' . $endorsement_data_count . ', ' . 'Updated : ' . $excel_data_count . ', ' . 'difference : ' . $difference;
|
||||
$this->myLogger->logme('error', 'Addition And Dependent Addition File Validation excel file count partially : {data}', ['data' => $partially_updated_data]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($endorsement_data_count < $excel_data_count) {
|
||||
|
||||
$data = [
|
||||
'status' => 'failed-3',
|
||||
];
|
||||
|
||||
$this->batchFileModel->where('id', $file_id)->set($data)->update();
|
||||
$this->myLogger->logme('error', 'Addition And Dependent Addition File Validation excel file count ( {excel} ) exceeds db count ( {db} )', ['db' => $endorsement_data_count, 'excel' => $excel_data_count]);
|
||||
|
||||
$file_data = $this->getDataByFileId($file_id, 'failure');
|
||||
$this->setPullNotification($file_data);
|
||||
|
||||
return 'The Excel record count exceeds the DB record count. excel file count : ' . $excel_data_count . 'db count : ' . $endorsement_data_count;
|
||||
}
|
||||
|
||||
|
||||
$errors = []; // Initialize an array to store errors
|
||||
$missing_id = [];
|
||||
$batch_list_id = [];
|
||||
|
||||
foreach ($endorsement_data as $key => $endorsement_value) {
|
||||
|
||||
$key = $key + 1;
|
||||
|
||||
if (!isset($excel_data[$key])) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if ($excel_data[$key][10] === null) {
|
||||
$missing_id[$key][] = [
|
||||
'row' => $key,
|
||||
'column' => 10,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
if ($endorsement_value['emp_name'] != $excel_data[$key][2]) {
|
||||
$errors[$key][] = [
|
||||
'row' => $key,
|
||||
'column' => 2,
|
||||
'db_data' => $endorsement_value['emp_name'],
|
||||
'excel_data' => $excel_data[$key][2]
|
||||
];
|
||||
}
|
||||
|
||||
if ($endorsement_value['emp_code'] != $excel_data[$key][0]) {
|
||||
$errors[$key][] = [
|
||||
'row' => $key,
|
||||
'column' => 0,
|
||||
'db_data' => $endorsement_value['emp_code'],
|
||||
'excel_data' => $excel_data[$key][0]
|
||||
];
|
||||
}
|
||||
|
||||
if ($endorsement_value['emp_dob'] != $excel_data[$key][5]) {
|
||||
$errors[$key][] = [
|
||||
'row' => $key,
|
||||
'column' => 5,
|
||||
'db_data' => $endorsement_value['emp_dob'],
|
||||
'excel_data' => $excel_data[$key][5]
|
||||
];
|
||||
}
|
||||
|
||||
if ($endorsement_value['emp_gender'] != $excel_data[$key][6]) {
|
||||
$errors[$key][] = [
|
||||
'row' => $key,
|
||||
'column' => 6,
|
||||
'db_data' => $endorsement_value['emp_gender'],
|
||||
'excel_data' => $excel_data[$key][6]
|
||||
];
|
||||
}
|
||||
|
||||
if ($endorsement_value['old_value'] != $excel_data[$key][7]) {
|
||||
$errors[$key][] = [
|
||||
'row' => $key,
|
||||
'column' => 7,
|
||||
'db_data' => $endorsement_value['old_value'],
|
||||
'excel_data' => $excel_data[$key][7]
|
||||
];
|
||||
}
|
||||
|
||||
if ($endorsement_value['new_value'] != $excel_data[$key][8]) {
|
||||
$errors[$key][] = [
|
||||
'row' => $key,
|
||||
'column' => 8,
|
||||
'db_data' => $endorsement_value['new_value'],
|
||||
'excel_data' => $excel_data[$key][8]
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($endorsement_value['uhid'] != $excel_data[$key][1]) {
|
||||
$errors[$key][] = [
|
||||
'row' => $key,
|
||||
'column' => 1,
|
||||
'db_data' => $endorsement_value['uhid'],
|
||||
'excel_data' => $excel_data[$key][1]
|
||||
];
|
||||
}
|
||||
|
||||
$batch_list_id[] = $endorsement_value['primaryKey'];
|
||||
}
|
||||
|
||||
|
||||
$error_count = count($errors);
|
||||
$json_errors = json_encode($errors);
|
||||
|
||||
|
||||
$missing_id_count = count($missing_id);
|
||||
$json_missing_id = json_encode($missing_id);
|
||||
|
||||
// dd($error_count, $missing_id_count, $json_errors, $json_missing_id, $batch_list_id);
|
||||
|
||||
|
||||
if ($missing_id_count > 0) {
|
||||
|
||||
$data = [
|
||||
|
||||
'count' => $endorsement_data_count,
|
||||
'error_data' => $json_missing_id,
|
||||
'status' => 'failed',
|
||||
];
|
||||
|
||||
$this->batchFileModel->where('id', $file_id)->set($data)->update();
|
||||
|
||||
$file_data = $this->getDataByFileId($file_id, 'failure');
|
||||
$this->setPullNotification($file_data);
|
||||
|
||||
return 'The ENDORSEMENT ID column is either partially or entirely empty.';
|
||||
|
||||
}
|
||||
|
||||
|
||||
if ($error_count > 0) {
|
||||
|
||||
$data = [
|
||||
|
||||
'count' => $endorsement_data_count,
|
||||
'error_data' => $json_errors,
|
||||
'status' => 'failed',
|
||||
];
|
||||
|
||||
$this->batchFileModel->where('id', $file_id)->set($data)->update();
|
||||
return 'Correction Validation Failed';
|
||||
|
||||
} else {
|
||||
|
||||
$data = [
|
||||
'count' => $endorsement_data_count,
|
||||
'status' => $status,
|
||||
'error_data' => $partially_updated_data ?? null,
|
||||
];
|
||||
|
||||
$this->batchFileModel->where('id', $file_id)->set($data)->update();
|
||||
|
||||
|
||||
foreach ($batch_list_id as $key => $value) {
|
||||
|
||||
$data = [
|
||||
'emp_policy_id' => $value,
|
||||
'batch_code' => $batch_code,
|
||||
'created_by' => $user_id,
|
||||
];
|
||||
|
||||
$insert = $this->batchListModel->insert($data);
|
||||
}
|
||||
|
||||
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'importAdditionAndDependentAdditionUpdateEndorsementID','payload' => ['file_id' => $file_id]]);
|
||||
|
||||
// $this->importAdditionAndDependentAdditionUpdateEndorsementID(['file_id' => $file_id]);
|
||||
|
||||
return 'Correction Validation Success';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function importAdditionAndDependentAdditionUpdateEndorsementID($params){
|
||||
|
||||
$this->myLogger->logme('error', 'importCorrectionUpdateEndorsementID called');
|
||||
|
||||
$file_id = $params['file_id'];
|
||||
$file = $this->batchFileModel->find($file_id);
|
||||
if (!$file) {
|
||||
|
||||
$data = [
|
||||
'status' => 'failed-4',
|
||||
];
|
||||
|
||||
$this->batchFileModel->where('id', $file_id)->set($data)->update();
|
||||
$this->myLogger->logme('error', 'importCorrectionUpdateEndorsementID the Physical file not found - file id : {data}', ['data' => $file_id]);
|
||||
|
||||
$file_data = $this->getDataByFileId($file_id, 'failure');
|
||||
$this->setPullNotification($file_data);
|
||||
|
||||
return 'importCorrectionUpdateEndorsementID the Physical file not found'; // Return error code if file not found
|
||||
}
|
||||
|
||||
$client_id = $file['client_id'];
|
||||
$client_policy_id = $file['client_policy_id'];
|
||||
$client_branch_id = $file['client_branch_id'];
|
||||
$insurer_or_tpa = $file['insurer_or_tpa'];
|
||||
$status = $file['status'];
|
||||
$batch_code = $file['batch_code'];
|
||||
$user_id = $file['created_by'];
|
||||
|
||||
|
||||
$status_val = 'success';
|
||||
if ($status == 'in-progress-partially') {
|
||||
|
||||
$status_val = 'partially success';
|
||||
}
|
||||
|
||||
$this->myLogger->logme('error', 'importCorrectionUpdateEndorsementID file name : {data}', ['data'=> $file['file_name']]);
|
||||
|
||||
$file_name_with_path = WRITEPATH . "/uploads/import_excel/" . $file['file_name'];
|
||||
$excel_data = $this->readExcelFileToArray($file_name_with_path);
|
||||
unset($excel_data[0]);
|
||||
|
||||
$emp_ids = [];
|
||||
$emp_details = [];
|
||||
$endorsement_id = [];
|
||||
$endorsement_details = [];
|
||||
|
||||
$emp_count = count($excel_data);
|
||||
$db = \Config\Database::connect();
|
||||
|
||||
|
||||
foreach ($excel_data as $key => $value) {
|
||||
|
||||
$emp_code = $value[0];
|
||||
$old_value = $value[7];
|
||||
$endorsement_id[] = $value[10];
|
||||
$uhid = $value[1];
|
||||
|
||||
|
||||
$result = $this->empEndorsementModel
|
||||
->select('emp_endorsement.*, employees.id as emp_id')
|
||||
->join('employees', 'employees.id = emp_endorsement.pk')
|
||||
->join('employee_polices', 'employee_polices.employee_id = employees.id')
|
||||
->where('employees.emp_code', $emp_code)
|
||||
->where('employees.client_id', $client_id)
|
||||
->where('employees.client_branch_id', $client_branch_id)
|
||||
->where('employee_polices.client_policy_id', $client_policy_id)
|
||||
->where('employee_polices.uhid', $uhid)
|
||||
->where('emp_endorsement.old_value', $old_value)
|
||||
|
||||
->where('employee_polices.is_active', 1)
|
||||
->where('employee_polices.status', 'active')
|
||||
->where('employees.is_active', 1)
|
||||
->where('employees.emp_status', 'active')
|
||||
->first();
|
||||
|
||||
if (isset($result['id']) && $result['id'] !== null) {
|
||||
|
||||
// return $result;
|
||||
$emp_details[] = array('id' => $result['emp_id'], $result['field_name'] => $value[8]);
|
||||
$endorsement_details[] = array('group_key' => $result['group_key'], 'id' => $result['id'], 'endorsement_id' => $value[10], 'status' => 'complete');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// return [$emp_details, $endorsement_details];
|
||||
|
||||
$this->empEndorsementModel->updateBatch($endorsement_details, 'group_key');
|
||||
$this->employeePolicyModel->bulkUpdateForCorrection($emp_details);
|
||||
|
||||
// Update batch file status and amount
|
||||
$this->batchFileModel->update($file_id, [
|
||||
'count' => $emp_count,
|
||||
'status' => $status_val,
|
||||
]);
|
||||
|
||||
|
||||
$this->myLogger->logme('error', 'importCorrectionUpdateEndorsementID employee count : {data}', ['data'=> $emp_count]);
|
||||
$this->myLogger->logme('error', 'importCorrectionUpdateEndorsementID batch file status : {data}', ['data'=> $status_val]);
|
||||
|
||||
|
||||
$file_data = $this->getDataByFileId($file_id, 'success');
|
||||
$this->setPullNotification($file_data);
|
||||
|
||||
|
||||
return 'Import Correction Updated '. $status_val . '- Updated Count : ' . $emp_count;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The below functions are Calculates and records cash deposits for employee policies at inception.
|
||||
*
|
||||
@ -2601,7 +3163,7 @@ class EmpDataServiceController extends BaseController
|
||||
")->getRow();
|
||||
|
||||
$insurer_id = $this->clientPolicyModel->where('id', $arrayData['client_policy_id'])->first();
|
||||
$description = 'The following amount of Rs. ' . $amount->total_sum . '/- has been debited for the ' . $arrayData['count'] . ' employees at ' . remove_underscore_capitalize_first_letter($arrayData['event']) . ' to ' . remove_underscore_capitalize_first_letter($arrayData['policy_name']) . '.';
|
||||
$description = 'The following amount of Rs. ' . round($amount->total_sum, 2) . '/- has been debited for the ' . $arrayData['count'] . ' employees at ' . remove_underscore_capitalize_first_letter($arrayData['event']) . ' to ' . remove_underscore_capitalize_first_letter($arrayData['policy_name']) . '.';
|
||||
|
||||
if(get_session_userid() == null){
|
||||
|
||||
@ -2643,7 +3205,7 @@ class EmpDataServiceController extends BaseController
|
||||
")->getRow();
|
||||
|
||||
$insurer_id = $this->clientPolicyModel->where('id', $arrayData['client_policy_id'])->first();
|
||||
$description = 'The following amount of ' . $amount->total_sum . ' has been credited for the ' . $arrayData['count'] . ' employees at ' . remove_underscore_capitalize_first_letter($arrayData['event']) . ' to ' . remove_underscore_capitalize_first_letter($arrayData['policy_name']) . '.';
|
||||
$description = 'The following amount of ' . round($amount->total_sum, 2) . ' has been credited for the ' . $arrayData['count'] . ' employees at ' . remove_underscore_capitalize_first_letter($arrayData['event']) . ' to ' . remove_underscore_capitalize_first_letter($arrayData['policy_name']) . '.';
|
||||
|
||||
$data = [
|
||||
|
||||
@ -2683,7 +3245,7 @@ class EmpDataServiceController extends BaseController
|
||||
")->getRow();
|
||||
|
||||
$insurer_id = $this->clientPolicyModel->where('id', $arrayData['client_policy_id'])->first();
|
||||
$description = 'The following amount of ' . $amount->total_sum . ' has been credited for the ' . $arrayData['count'] . ' employees at ' . remove_underscore_capitalize_first_letter($arrayData['event']) . ' to ' . remove_underscore_capitalize_first_letter($arrayData['policy_name']) . '.';
|
||||
$description = 'The following amount of ' . round($amount->total_sum, 2) . ' has been credited for the ' . $arrayData['count'] . ' employees at ' . remove_underscore_capitalize_first_letter($arrayData['event']) . ' to ' . remove_underscore_capitalize_first_letter($arrayData['policy_name']) . '.';
|
||||
|
||||
$data = [
|
||||
|
||||
|
||||
@ -488,7 +488,7 @@ class EmployeeController extends AdminController
|
||||
// $return = $empDataServiceController->importInceptionFileValidation(['file_id' => $file_id]);
|
||||
|
||||
if ($return == 1) {
|
||||
session()->setFlashdata('success', 'Data updated successfully. File is being validated.');
|
||||
session()->setFlashdata('success', 'File Uploaded Successfully File is being validated.');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else {
|
||||
session()->setFlashdata($return['status'], $return['message']);
|
||||
@ -506,7 +506,7 @@ class EmployeeController extends AdminController
|
||||
// $return = $empDataServiceController->importCorrectionValidation(['file_id' => $file_id]);
|
||||
|
||||
if ($return == 1) {
|
||||
session()->setFlashdata('success', 'Data updated successfully. File is being validated.');
|
||||
session()->setFlashdata('success', 'File Uploaded Successfully File is being validated.');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else {
|
||||
session()->setFlashdata('error', $return);
|
||||
@ -525,7 +525,7 @@ class EmployeeController extends AdminController
|
||||
// $return = $empDataServiceController->importSIEnhancementValidation(['file_id' => $file_id]);
|
||||
|
||||
if ($return == 1) {
|
||||
session()->setFlashdata('success', 'Data updated successfully. File is being validated.');
|
||||
session()->setFlashdata('success', 'File Uploaded Successfully File is being validated.');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else {
|
||||
session()->setFlashdata('error', $return);
|
||||
@ -544,7 +544,7 @@ class EmployeeController extends AdminController
|
||||
|
||||
|
||||
if ($return == 1) {
|
||||
session()->setFlashdata('success', 'Data updated successfully. File is being validated.');
|
||||
session()->setFlashdata('success', 'File Uploaded Successfully File is being validated.');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else {
|
||||
session()->setFlashdata('error', $return);
|
||||
|
||||
@ -79,11 +79,11 @@
|
||||
<?php } else if ($file['status'] == 'failed-1') { ?>
|
||||
failed <a class="fe-alert-circle" style="color: #000;" data-toggle="tooltip"
|
||||
data-placement="top"
|
||||
title="The list of employees provided has already been updated with the TPA ID."></a>
|
||||
title="<?= $file['event_type'] == 'inception' ? 'The list of employees provided has already been updated with the TPA ID.' : 'The list of employees provided has already been updated with the ENDORSEMENT ID.' ?> "></a>
|
||||
<?php } else if ($file['status'] == 'failed-2') { ?>
|
||||
failed <a class="fe-alert-circle" style="color: #000;" data-toggle="tooltip"
|
||||
data-placement="top"
|
||||
title="The list of employees provided has already been updated with the UHID."></a>
|
||||
title="<?= $file['event_type'] == 'inception' ? 'The list of employees provided has already been updated with the UHID.' : 'The list of employees provided has already been updated with the ENDORSEMENT ID.' ?>"></a>
|
||||
<?php } else if ($file['status'] == 'failed-3') { ?>
|
||||
failed <a class="fe-alert-circle" style="color: #000;" data-toggle="tooltip"
|
||||
data-placement="top"
|
||||
@ -91,6 +91,9 @@
|
||||
<?php } else if ($file['status'] == 'failed-4') { ?>
|
||||
failed <a class="fe-alert-circle" style="color: #000;" data-toggle="tooltip"
|
||||
data-placement="top" title="Physical File Not Found."></a>
|
||||
<?php } else if ($file['status'] == 'failed-5') { ?>
|
||||
failed <a class="fe-alert-circle" style="color: #000;" data-toggle="tooltip"
|
||||
data-placement="top" title="Wrong File Uploaded"></a>
|
||||
<?php } else { ?>
|
||||
<?php echo $file['status']; ?>
|
||||
<?php } ?>
|
||||
|
||||
@ -20,6 +20,10 @@
|
||||
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;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="row" id="client_list">
|
||||
@ -32,103 +36,105 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<table class="table table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0"
|
||||
id="tickets-table">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th class="font-weight-medium">SNO</th>
|
||||
<!-- <th class="font-weight-medium">Employee code</th> -->
|
||||
<th class="font-weight-medium">Name/code</th>
|
||||
<th class="font-weight-medium">Policy name</th>
|
||||
<th class="font-weight-medium">Insurer <br> name</th>
|
||||
<th class="font-weight-medium">TPA ID</th>
|
||||
<th class="font-weight-medium">UHID</th>
|
||||
<th class="font-weight-medium">Policy <br> 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>
|
||||
<!-- <th class="font-weight-medium">Action</th> -->
|
||||
</tr>
|
||||
</thead>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0"
|
||||
id="tickets-table">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th class="font-weight-medium">SNO</th>
|
||||
<!-- <th class="font-weight-medium">Employee code</th> -->
|
||||
<th class="font-weight-medium">Name/code</th>
|
||||
<th class="font-weight-medium">Policy name</th>
|
||||
<th class="font-weight-medium">Insurer <br> name</th>
|
||||
<th class="font-weight-medium">TPA ID</th>
|
||||
<th class="font-weight-medium">UHID</th>
|
||||
<th class="font-weight-medium">Policy <br> 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>
|
||||
<!-- <th class="font-weight-medium">Action</th> -->
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody class="font-12">
|
||||
<?php
|
||||
if(isset($employees))
|
||||
{
|
||||
foreach ($employees as $key => $employee) { ?>
|
||||
<tbody class="font-12">
|
||||
<?php
|
||||
if(isset($employees))
|
||||
{
|
||||
foreach ($employees as $key => $employee) { ?>
|
||||
|
||||
<tr>
|
||||
<td><b><?php echo ($key + 1)?></b></td>
|
||||
<td><?php echo $employee['name']?>( <?php echo $employee['emp_code']?> -
|
||||
<?php echo $employee['relationship']?> )</td>
|
||||
<td><?php echo $employee['policy_name']?></td>
|
||||
<td><?php echo $employee['insurer_short_name']?></td>
|
||||
<td><?php echo $employee['tpa_id']?></td>
|
||||
<td><?php echo $employee['uhid']?></td>
|
||||
<td>
|
||||
<?php
|
||||
if ($employee['status'] == 'draft') {
|
||||
echo '<span class="badge badge-secondary">' . $employee['status'] . '</span>';
|
||||
} elseif ($employee['status'] == 'active') {
|
||||
echo '<span class="badge badge-success">' . $employee['status'] . '</span>';
|
||||
} elseif ($employee['status'] == 'inactive') {
|
||||
echo '<span class="badge badge-warning">' . $employee['status'] . '</span>';
|
||||
}elseif ($employee['status'] == 'expired') {
|
||||
echo '<span class="badge badge-danger">' . $employee['status'] . '</span>';
|
||||
}elseif ($employee['status'] == 'enrolled') {
|
||||
echo '<span class="badge2 badge2-secondary2">' . $employee['status'] . '</span>';
|
||||
}else{
|
||||
echo $employee['status'];
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td class="indian-number"> <?php echo $employee['basic_cover_si']?> </td>
|
||||
<td class="indian-number"><?php echo $employee['premium']?></td>
|
||||
<td class="indian-number"><?php echo $employee['rata_premimum']?></td>
|
||||
<td class="indian-number"><?php echo $employee['gst']?></td>
|
||||
<!-- <td>
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);"
|
||||
class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"
|
||||
aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a class="dropdown-item" href="#"><i
|
||||
class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
|
||||
Ticket</a>
|
||||
<a class="dropdown-item" href="#"><i
|
||||
class="mdi mdi-check-all mr-2 text-muted font-18 vertical-middle"></i>Close</a>
|
||||
<a class="dropdown-item" href="#"><i
|
||||
class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Remove</a>
|
||||
<a class="dropdown-item" href="#"><i
|
||||
class="mdi mdi-star mr-2 font-18 text-muted vertical-middle"></i>Mark as
|
||||
Unread</a>
|
||||
<tr>
|
||||
<td><b><?php echo ($key + 1)?></b></td>
|
||||
<td><?php echo $employee['name']?>( <?php echo $employee['emp_code']?> -
|
||||
<?php echo $employee['relationship']?> )</td>
|
||||
<td><?php echo $employee['policy_name']?></td>
|
||||
<td><?php echo $employee['insurer_short_name']?></td>
|
||||
<td><?php echo $employee['tpa_id']?></td>
|
||||
<td><?php echo $employee['uhid']?></td>
|
||||
<td>
|
||||
<?php
|
||||
if ($employee['status'] == 'draft') {
|
||||
echo '<span class="badge badge-secondary">' . $employee['status'] . '</span>';
|
||||
} elseif ($employee['status'] == 'active') {
|
||||
echo '<span class="badge badge-success">' . $employee['status'] . '</span>';
|
||||
} elseif ($employee['status'] == 'inactive') {
|
||||
echo '<span class="badge badge-warning">' . $employee['status'] . '</span>';
|
||||
}elseif ($employee['status'] == 'expired') {
|
||||
echo '<span class="badge badge-danger">' . $employee['status'] . '</span>';
|
||||
}elseif ($employee['status'] == 'enrolled') {
|
||||
echo '<span class="badge2 badge2-secondary2">' . $employee['status'] . '</span>';
|
||||
}else{
|
||||
echo $employee['status'];
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td class="indian-number"> <?php echo $employee['basic_cover_si']?> </td>
|
||||
<td class="indian-number"><?php echo $employee['premium']?></td>
|
||||
<td class="indian-number"><?php echo $employee['rata_premimum']?></td>
|
||||
<td class="indian-number"><?php echo $employee['gst']?></td>
|
||||
<!-- <td>
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);"
|
||||
class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"
|
||||
aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a class="dropdown-item" href="#"><i
|
||||
class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
|
||||
Ticket</a>
|
||||
<a class="dropdown-item" href="#"><i
|
||||
class="mdi mdi-check-all mr-2 text-muted font-18 vertical-middle"></i>Close</a>
|
||||
<a class="dropdown-item" href="#"><i
|
||||
class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Remove</a>
|
||||
<a class="dropdown-item" href="#"><i
|
||||
class="mdi mdi-star mr-2 font-18 text-muted vertical-middle"></i>Mark as
|
||||
Unread</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td> -->
|
||||
</tr>
|
||||
<?php }}?>
|
||||
</td> -->
|
||||
</tr>
|
||||
<?php }}?>
|
||||
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th>Total</th>
|
||||
<th class="indian-number"></th>
|
||||
<th class="indian-number"></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th>Total</th>
|
||||
<th class="indian-number"></th>
|
||||
<th class="indian-number"></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
|
||||
Loading…
Reference in New Issue
Block a user