'FIX_EMP_MODULE_BATCH_LIST_AMOUNT'
This commit is contained in:
parent
6b1f39bbc8
commit
33fb5b8c50
@ -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");
|
||||
|
||||
});
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ use App\Models\BatchFileModel;
|
||||
use App\Models\EmpEndorsementModel;
|
||||
use App\Models\ClientDepositModel;
|
||||
|
||||
use App\Controllers\Jobs ;
|
||||
use App\Controllers\Jobs;
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
// use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
use PhpOffice\PhpSpreadsheet\Reader\Xlsx;
|
||||
@ -74,8 +74,8 @@ class EmpDataServiceController extends BaseController
|
||||
$insert = $this->batchFileModel->insert($data);
|
||||
$batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
|
||||
|
||||
if($insert){
|
||||
foreach($objects as $value){
|
||||
if ($insert) {
|
||||
foreach ($objects as $value) {
|
||||
$batch_list_data['batch_code'] = $batch_file_batch_code['batch_code'];
|
||||
$batch_list_data['emp_policy_id'] = $value->primaryKey ?? $value->employee_policy_id ?? '';
|
||||
$batch_list_data['created_by'] = get_session_userid();
|
||||
@ -84,7 +84,6 @@ class EmpDataServiceController extends BaseController
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -105,18 +104,28 @@ 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;
|
||||
$this->myLogger->logme('error', 'Inception export data count : {data}', ['data'=> $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
|
||||
if($count == 0){
|
||||
if ($count == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Log the export file name
|
||||
$this->myLogger->logme('error', 'Inception export file name : {data}', ['data'=> $export_data['file_name'] ]);
|
||||
$this->myLogger->logme('error', 'Inception export file name : {data}', ['data' => $export_data['file_name']]);
|
||||
|
||||
// Transform retrieved objects to an array suitable for export
|
||||
$data = transform_objects_to_array_for_inception($objects);
|
||||
@ -194,13 +203,13 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
$count = count($objects);
|
||||
$export_data['count'] = $count;
|
||||
$this->myLogger->logme('error','Correction export data count : {data}', ['data'=> $count ]);
|
||||
$this->myLogger->logme('error', 'Correction export data count : {data}', ['data' => $count]);
|
||||
|
||||
if($count == 0){
|
||||
if ($count == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->myLogger->logme('error','Correction export file name : {data}', ['data'=> $export_data['file_name'] ]);
|
||||
$this->myLogger->logme('error', 'Correction export file name : {data}', ['data' => $export_data['file_name']]);
|
||||
|
||||
$correction_data = transform_objects_to_array_for_correction($objects);
|
||||
|
||||
@ -224,9 +233,9 @@ class EmpDataServiceController extends BaseController
|
||||
// Generate Excel file with the temporary file
|
||||
$value = generate_excel($headers, $correction_data, $tempFile);
|
||||
|
||||
if($value){
|
||||
if ($value) {
|
||||
$return = $this->batchFilesAndBatchListEntry($export_data, $objects);
|
||||
if($return){
|
||||
if ($return) {
|
||||
|
||||
foreach ($ids as $key => $id) {
|
||||
$group_key = $this->empEndorsementModel->select('group_key')->where('id', $id)->first();
|
||||
@ -251,13 +260,11 @@ class EmpDataServiceController extends BaseController
|
||||
fclose($tempFile);
|
||||
|
||||
return true;
|
||||
|
||||
}else{
|
||||
} else {
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -266,24 +273,27 @@ 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 ]);
|
||||
$this->myLogger->logme('error', 'SI_Enhancement export data count : {data}', ['data' => $count]);
|
||||
|
||||
if($count == 0){
|
||||
if ($count == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->myLogger->logme('error','SI_Enhancement export file name : {data}', ['data'=> $export_data['file_name'] ]);
|
||||
$this->myLogger->logme('error', 'SI_Enhancement export file name : {data}', ['data' => $export_data['file_name']]);
|
||||
|
||||
$si_data = transform_objects_to_array_for_si_enhancement($objects);
|
||||
|
||||
@ -317,9 +327,9 @@ class EmpDataServiceController extends BaseController
|
||||
// Generate Excel file with the temporary file
|
||||
$value = generate_excel($headers, $si_data, $tempFile);
|
||||
|
||||
if($value){
|
||||
if ($value) {
|
||||
$return = $this->batchFilesAndBatchListEntry($export_data, $objects);
|
||||
if($return){
|
||||
if ($return) {
|
||||
|
||||
foreach ($ids as $key => $id) {
|
||||
$group_key = $this->empEndorsementModel->select('group_key')->where('id', $id)->first();
|
||||
@ -343,12 +353,10 @@ class EmpDataServiceController extends BaseController
|
||||
fclose($tempFile);
|
||||
|
||||
return true;
|
||||
|
||||
}else{
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -358,24 +366,28 @@ 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 ]);
|
||||
|
||||
if($count == 0){
|
||||
$this->myLogger->logme('error', 'Deletion export data count : {data}', ['data' => $count]);
|
||||
|
||||
if ($count == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->myLogger->logme('error','Deletion export file name : {data}', ['data'=> $export_data['file_name'] ]);
|
||||
$this->myLogger->logme('error', 'Deletion export file name : {data}', ['data' => $export_data['file_name']]);
|
||||
|
||||
$si_data = transform_objects_to_array_for_deletion($objects);
|
||||
// dd($si_data);
|
||||
@ -405,9 +417,9 @@ class EmpDataServiceController extends BaseController
|
||||
// Generate Excel file with the temporary file
|
||||
$value = generate_excel($headers, $si_data, $tempFile, 2);
|
||||
|
||||
if($value){
|
||||
if ($value) {
|
||||
$return = $this->batchFilesAndBatchListEntry($export_data, $objects);
|
||||
if( $return){
|
||||
if ($return) {
|
||||
|
||||
foreach ($ids as $key => $id) {
|
||||
$group_key = $this->empEndorsementModel->select('group_key')->where('id', $id)->first();
|
||||
@ -431,13 +443,10 @@ class EmpDataServiceController extends BaseController
|
||||
fclose($tempFile);
|
||||
|
||||
return true;
|
||||
|
||||
}else{
|
||||
} 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);
|
||||
@ -569,17 +582,16 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
$policy_name = $this->getPolicyNameUsingClientPolicyId($client_policy_id);
|
||||
$depositeData = [
|
||||
'employeeIds'=>$empty_emp_tpa_uh_ids,
|
||||
'client_id'=>$client_id,
|
||||
'client_policy_id'=>$client_policy_id,
|
||||
'count'=>$count,
|
||||
'event'=>$import_data['event_type'],
|
||||
'policy_name'=>$policy_name['policy_name'],
|
||||
'employeeIds' => $empty_emp_tpa_uh_ids,
|
||||
'client_id' => $client_id,
|
||||
'client_policy_id' => $client_policy_id,
|
||||
'count' => $count,
|
||||
'event' => $import_data['event_type'],
|
||||
'policy_name' => $policy_name['policy_name'],
|
||||
];
|
||||
|
||||
$this->cashDepositCalculationForInception($depositeData);
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -642,7 +654,7 @@ class EmpDataServiceController extends BaseController
|
||||
// return 2;
|
||||
// }
|
||||
|
||||
if($missing_id_count != 0 ){
|
||||
if ($missing_id_count != 0) {
|
||||
|
||||
return 2;
|
||||
}
|
||||
@ -652,7 +664,7 @@ class EmpDataServiceController extends BaseController
|
||||
// return 3;
|
||||
// }
|
||||
|
||||
if( $empty_id_count == 0){
|
||||
if ($empty_id_count == 0) {
|
||||
|
||||
return 3;
|
||||
}
|
||||
@ -663,10 +675,10 @@ class EmpDataServiceController extends BaseController
|
||||
$is_moved = $file->move(WRITEPATH . 'uploads/import_excel');
|
||||
$filename = $file->getName();
|
||||
|
||||
$this->myLogger->logme('error','Correction Import file name : {data}', ['data'=> $filename ]);
|
||||
$this->myLogger->logme('error', 'Correction Import file name : {data}', ['data' => $filename]);
|
||||
$random_number_count = 4;
|
||||
$batch_code = generate_random_string($random_number_count);
|
||||
$this->myLogger->logme('error','Correction Import BATCH CODE : {data}', ['data'=> $batch_code ]);
|
||||
$this->myLogger->logme('error', 'Correction Import BATCH CODE : {data}', ['data' => $batch_code]);
|
||||
|
||||
|
||||
$import_data['batch_code'] = $batch_code;
|
||||
@ -678,10 +690,9 @@ class EmpDataServiceController extends BaseController
|
||||
$batch_code_for_batch_list['batch_code'] = $batch_file_batch_code['batch_code'];
|
||||
$batch_code_for_batch_list['created_by'] = get_session_userid();
|
||||
|
||||
$file_name_with_path = WRITEPATH."/uploads/import_excel/".$batch_file_batch_code['file_name'];
|
||||
$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])) {
|
||||
@ -741,16 +751,14 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
// $query = $this->employeePolicyModel->getLastQuery();
|
||||
// echo $query . "<br>";
|
||||
}else{
|
||||
} else {
|
||||
|
||||
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);
|
||||
@ -812,7 +825,7 @@ class EmpDataServiceController extends BaseController
|
||||
// return 2;
|
||||
// }
|
||||
|
||||
if($missing_id_count != 0 ){
|
||||
if ($missing_id_count != 0) {
|
||||
|
||||
return 2;
|
||||
}
|
||||
@ -822,7 +835,7 @@ class EmpDataServiceController extends BaseController
|
||||
// return 3;
|
||||
// }
|
||||
|
||||
if( $empty_id_count == 0){
|
||||
if ($empty_id_count == 0) {
|
||||
|
||||
return 3;
|
||||
}
|
||||
@ -832,25 +845,25 @@ class EmpDataServiceController extends BaseController
|
||||
$is_moved = $file->move(WRITEPATH . 'uploads/import_excel');
|
||||
$filename = $file->getName();
|
||||
|
||||
$this->myLogger->logme('error','SI_Enhancement Import file name : {data}', ['data'=> $filename ]);
|
||||
$this->myLogger->logme('error', 'SI_Enhancement Import file name : {data}', ['data' => $filename]);
|
||||
$random_number_count = 4;
|
||||
$batch_code = generate_random_string($random_number_count);
|
||||
$this->myLogger->logme('error','SI_Enhancement Import BATCH CODE : {data}', ['data'=> $batch_code ]);
|
||||
$this->myLogger->logme('error', 'SI_Enhancement Import BATCH CODE : {data}', ['data' => $batch_code]);
|
||||
|
||||
|
||||
$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();
|
||||
|
||||
$batch_code_for_batch_list['batch_code'] = $batch_file_batch_code['batch_code'];
|
||||
$batch_code_for_batch_list['created_by'] = get_session_userid();
|
||||
|
||||
$file_name_with_path = WRITEPATH."/uploads/import_excel/".$batch_file_batch_code['file_name'];
|
||||
$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) {
|
||||
|
||||
@ -870,11 +882,11 @@ class EmpDataServiceController extends BaseController
|
||||
$endorsement_id = $value[19] != null ? $value[19] : '';
|
||||
|
||||
$updateData = [
|
||||
'emp_code' =>$emp_code,
|
||||
'client_id' =>$client_id,
|
||||
'client_policy_id' =>$client_policy_id,
|
||||
'emp_name' =>$emp_name,
|
||||
'endorsement_id' =>$endorsement_id,
|
||||
'emp_code' => $emp_code,
|
||||
'client_id' => $client_id,
|
||||
'client_policy_id' => $client_policy_id,
|
||||
'emp_name' => $emp_name,
|
||||
'endorsement_id' => $endorsement_id,
|
||||
];
|
||||
|
||||
$this->employeePolicyModel->updateEndoresmentIdForSIEnhancement($updateData);
|
||||
@ -925,22 +937,20 @@ class EmpDataServiceController extends BaseController
|
||||
$this->batchListModel->insert($batch_code_for_batch_list);
|
||||
array_push($employeeIds, $id);
|
||||
}
|
||||
|
||||
}else{
|
||||
} else {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$policy_name = $this->getPolicyNameUsingClientPolicyId($client_policy_id);
|
||||
$depositeData = [
|
||||
'employeeIds'=>$employeeIds,
|
||||
'client_id'=>$client_id,
|
||||
'client_policy_id'=>$client_policy_id,
|
||||
'count'=>$count,
|
||||
'event'=>$import_data['event_type'],
|
||||
'policy_name'=>$policy_name['policy_name'],
|
||||
'employeeIds' => $employeeIds,
|
||||
'client_id' => $client_id,
|
||||
'client_policy_id' => $client_policy_id,
|
||||
'count' => $count,
|
||||
'event' => $import_data['event_type'],
|
||||
'policy_name' => $policy_name['policy_name'],
|
||||
];
|
||||
|
||||
// dd($depositeData);
|
||||
@ -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,16 +1017,16 @@ 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;
|
||||
// }
|
||||
|
||||
if($missing_id_count != 0 ){
|
||||
if ($missing_id_count != 0) {
|
||||
|
||||
return 2;
|
||||
}
|
||||
@ -1022,7 +1036,7 @@ class EmpDataServiceController extends BaseController
|
||||
// return 3;
|
||||
// }
|
||||
|
||||
if( $empty_id_count == 0){
|
||||
if ($empty_id_count == 0) {
|
||||
|
||||
return 3;
|
||||
}
|
||||
@ -1032,25 +1046,25 @@ class EmpDataServiceController extends BaseController
|
||||
$is_moved = $file->move(WRITEPATH . 'uploads/import_excel');
|
||||
$filename = $file->getName();
|
||||
|
||||
$this->myLogger->logme('error','Deletion Import file name : {data}', ['data'=> $filename ]);
|
||||
$this->myLogger->logme('error', 'Deletion Import file name : {data}', ['data' => $filename]);
|
||||
$random_number_count = 4;
|
||||
$batch_code = generate_random_string($random_number_count);
|
||||
$this->myLogger->logme('error','Deletion Import BATCH CODE : {data}', ['data'=> $batch_code ]);
|
||||
$this->myLogger->logme('error', 'Deletion Import BATCH CODE : {data}', ['data' => $batch_code]);
|
||||
|
||||
|
||||
$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();
|
||||
|
||||
$batch_code_for_batch_list['batch_code'] = $batch_file_batch_code['batch_code'];
|
||||
$batch_code_for_batch_list['created_by'] = get_session_userid();
|
||||
|
||||
$file_name_with_path = WRITEPATH."/uploads/import_excel/".$batch_file_batch_code['file_name'];
|
||||
$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;
|
||||
}
|
||||
|
||||
@ -1117,16 +1131,16 @@ class EmpDataServiceController extends BaseController
|
||||
$this->employeeModel->save($deletionDataForEmployee);
|
||||
|
||||
$e_Data = [
|
||||
'endorsement_id'=> $endorsement_id,
|
||||
'status'=> 'complete',
|
||||
'endorsement_id' => $endorsement_id,
|
||||
'status' => 'complete',
|
||||
];
|
||||
$group_key = $this->empEndorsementModel->select('group_key')->where('id', $deletionDataForEmployee['ee_id'])->first();
|
||||
$this->empEndorsementModel->where('group_key', $group_key)->set($e_Data)->update();
|
||||
|
||||
$fetchData = [
|
||||
'emp_code'=> $emp_code,
|
||||
'client_policy_id'=> $client_policy_id,
|
||||
'emp_name'=> $emp_name,
|
||||
'emp_code' => $emp_code,
|
||||
'client_policy_id' => $client_policy_id,
|
||||
'emp_name' => $emp_name,
|
||||
];
|
||||
|
||||
$deletionDataForEmployeePolicy = $this->employeePolicyModel->fetchEmpEndorsementData($fetchData);
|
||||
@ -1136,27 +1150,24 @@ class EmpDataServiceController extends BaseController
|
||||
// $query = $this->employeePolicyModel->getLastQuery();
|
||||
// echo $query . "<br>";
|
||||
|
||||
}else{
|
||||
} else {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$policy_name = $this->getPolicyNameUsingClientPolicyId($client_policy_id);
|
||||
$depositeData = [
|
||||
'employeeIds'=>$employeeIds,
|
||||
'client_id'=>$client_id,
|
||||
'client_policy_id'=>$client_policy_id,
|
||||
'count'=>$count,
|
||||
'event'=>$import_data['event_type'],
|
||||
'policy_name'=>$policy_name['policy_name'],
|
||||
'employeeIds' => $employeeIds,
|
||||
'client_id' => $client_id,
|
||||
'client_policy_id' => $client_policy_id,
|
||||
'count' => $count,
|
||||
'event' => $import_data['event_type'],
|
||||
'policy_name' => $policy_name['policy_name'],
|
||||
];
|
||||
|
||||
$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;
|
||||
@ -1426,7 +1433,7 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
|
||||
|
||||
if($obj->exist_reason != 'death'){
|
||||
if ($obj->exist_reason != 'death') {
|
||||
|
||||
$result[] = array(
|
||||
"field_name" => 'Period of non coverage',
|
||||
@ -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;
|
||||
@ -1506,8 +1510,8 @@ class EmpDataServiceController extends BaseController
|
||||
$insert = $this->batchFileModel->insert($data);
|
||||
$batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
|
||||
|
||||
if($insert){
|
||||
foreach($ids as $id){
|
||||
if ($insert) {
|
||||
foreach ($ids as $id) {
|
||||
$batch_list_data['batch_code'] = $batch_file_batch_code['batch_code'];
|
||||
$batch_list_data['emp_policy_id'] = $id;
|
||||
$batch_list_data['created_by'] = get_session_userid();
|
||||
|
||||
@ -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,12 +560,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
|
||||
@ -574,7 +581,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
|
||||
@ -583,7 +591,6 @@ class EmployeeController extends AdminController
|
||||
// You can return an error response here
|
||||
echo $errorMessage;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -628,6 +635,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>';
|
||||
@ -644,4 +652,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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -21,6 +21,7 @@ class BatchFileModel extends Model
|
||||
"created_by",
|
||||
"updated_by",
|
||||
"is_active",
|
||||
"amount",
|
||||
];
|
||||
|
||||
// Callbacks
|
||||
|
||||
@ -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 }}?>
|
||||
|
||||
|
||||
@ -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
175
app/Views/errors/404.php
Normal 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>
|
||||
Loading…
Reference in New Issue
Block a user