CHANGE_TPA_RECON
This commit is contained in:
parent
7a97ced0f6
commit
9194787e14
@ -227,6 +227,8 @@ $routes->group("/employee", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get("retail-endorsement-list", "EmployeeController::retailendorsementlist");
|
||||
$routes->post("retail-endorsement-save", "EmployeeController::retailendorsementsave");
|
||||
$routes->get("getTPADataVariationReport/(:num)", "EmployeeController::getTPADataVariationReport/$1");
|
||||
$routes->get("getTPADataVariationReportView/(:num)", "EmployeeController::getTPADataVariationReport/$1/view");
|
||||
$routes->get("proceedTPADataVariationNextStep/(:num)", "EmployeeController::proceedTPADataVariationNextStep/$1");
|
||||
$routes->get("bulkGenerateEcardAndStoreinS3", "EmployeeController::bulkGenerateEcardAndStoreinS3");
|
||||
$routes->get('clearCdSession', 'EmployeeController::clearCdSession');
|
||||
$routes->get('checkSessionStatus', 'EmployeeController::checkSessionStatus');
|
||||
|
||||
@ -3938,14 +3938,14 @@ class EmployeeController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
public function getTPADataVariationReport($file_id)
|
||||
public function getTPADataVariationReport($file_id, $type = 'download')
|
||||
{
|
||||
$file_info = $this->batchFileModel->where('id', $file_id)->find();
|
||||
$client_id = $file_info[0]['client_id'];
|
||||
$client_policy_id = $file_info[0]['client_policy_id'];
|
||||
$TpaApiDataModel = new TpaApiDataModel();
|
||||
$emp_data_wo_tpa_id = $this->employeePolicyModel->getTPADataVariationReport($client_id, $client_policy_id, $file_id);
|
||||
|
||||
|
||||
|
||||
//loop emp data with TPA data for matches
|
||||
foreach ($emp_data_wo_tpa_id as $db_key => $db_row)
|
||||
@ -3965,10 +3965,10 @@ class EmployeeController extends AdminController
|
||||
// die();
|
||||
//not_in_tpa
|
||||
$tpa_emp_codes = $TpaApiDataModel->select('emp_code')
|
||||
->where('file_id', $file_id)
|
||||
->where('is_active', 1)
|
||||
->groupBy('emp_code')
|
||||
->findAll();
|
||||
->where('file_id', $file_id)
|
||||
->where('is_active', 1)
|
||||
->groupBy('emp_code')
|
||||
->findAll();
|
||||
$tpa_emp_codes = array_column($tpa_emp_codes, 'emp_code');
|
||||
|
||||
$not_in_tpa = $this->employeePolicyModel->getTPADataVariationReport($client_id, $client_policy_id, $file_id,$tpa_emp_codes);
|
||||
@ -3982,20 +3982,110 @@ class EmployeeController extends AdminController
|
||||
->where('is_active',1)
|
||||
->where('file_id',$file_id)
|
||||
->whereNotIn('emp_code',$master_emp_codes)
|
||||
->findAll();
|
||||
->findAll();
|
||||
// d($not_in_nhance);die();
|
||||
|
||||
if( !empty($not_in_tpa) || !empty($not_in_nhance) || !empty($emp_data_wo_tpa_id) )
|
||||
{
|
||||
$this->exportVariationReportExcel($not_in_tpa,$not_in_nhance,$emp_data_wo_tpa_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// $this->exportVariationReportExcel([],[],[]);
|
||||
if (!empty($not_in_tpa) || !empty($not_in_nhance) || !empty($emp_data_wo_tpa_id)) {
|
||||
if ($type === 'download') {
|
||||
$this->exportVariationReportExcel($not_in_tpa, $not_in_nhance, $emp_data_wo_tpa_id);
|
||||
} else {
|
||||
$response = [
|
||||
'not_in_tpa' => $not_in_tpa,
|
||||
'not_in_nhance' => $not_in_nhance,
|
||||
'mismatch_data' => $emp_data_wo_tpa_id,
|
||||
];
|
||||
|
||||
return $this->respond(
|
||||
[
|
||||
'status' => true,
|
||||
'code' => 200,
|
||||
'message' => '',
|
||||
'data' => $response,
|
||||
],
|
||||
200
|
||||
);
|
||||
}
|
||||
} else {
|
||||
if ($type === 'download') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->respond(
|
||||
[
|
||||
'status' => false,
|
||||
'code' => 202,
|
||||
'message' => 'No data found',
|
||||
'data' => [],
|
||||
],
|
||||
200
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function proceedTPADataVariationNextStep($file_id)
|
||||
{
|
||||
try {
|
||||
if (empty($file_id)) {
|
||||
return $this->respond(
|
||||
[
|
||||
'status' => false,
|
||||
'code' => 400,
|
||||
'message' => 'Invalid file reference',
|
||||
'data' => [],
|
||||
],
|
||||
200
|
||||
);
|
||||
}
|
||||
|
||||
$file = $this->batchFileModel->find($file_id);
|
||||
|
||||
if (!$file) {
|
||||
return $this->respond(
|
||||
[
|
||||
'status' => false,
|
||||
'code' => 404,
|
||||
'message' => 'File not found',
|
||||
'data' => [],
|
||||
],
|
||||
200
|
||||
);
|
||||
}
|
||||
|
||||
$this->myLogger->logme(
|
||||
'error',
|
||||
'TPA variation review completed and proceed to next clicked',
|
||||
[
|
||||
'file_id' => $file_id,
|
||||
'user_id' => get_session_userid(),
|
||||
]
|
||||
);
|
||||
|
||||
return $this->respond(
|
||||
[
|
||||
'status' => true,
|
||||
'code' => 200,
|
||||
'message' => 'Proceed to next step recorded successfully.',
|
||||
'data' => [],
|
||||
],
|
||||
200
|
||||
);
|
||||
} catch (\Throwable $e) {
|
||||
$this->myLogger->logme(
|
||||
'error',
|
||||
'Error while processing TPA variation proceed to next: ' . $e->getMessage(),
|
||||
['file_id' => $file_id]
|
||||
);
|
||||
|
||||
return $this->respond(
|
||||
[
|
||||
'status' => false,
|
||||
'code' => 500,
|
||||
'message' => 'Unable to proceed to the next step at the moment.',
|
||||
'data' => [],
|
||||
],
|
||||
200
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user