code_merge : RV
This commit is contained in:
commit
a43394eb6e
@ -35,7 +35,7 @@ class EmployeeServiceController extends AdminController
|
||||
protected $empEndorsementModel;
|
||||
protected $general_relationships = ['self' => ['name' => 'Self', 'gender' => 'M','age_min' => 18,'age_max' => null], 'spouse' => ['name' => 'Spouse', 'gender' => 'F','age_min' => 18,'age_max' => null], 'son' => ['name' => 'Son', 'gender' => 'M','age_min' => null,'age_max' => 25], 'daughter' => ['name' => 'Daughter', 'gender' => 'F','age_min' => null,'age_max' => 25], 'father' => ['name' => 'Father', 'gender' => 'M','age_min' => 18,'age_max' => null], 'mother' => ['name' => 'Mother', 'gender' => 'F','age_min' => 18,'age_max' => null], 'father-in-law' => ['name' => 'Father in Law', 'gender' => 'M','age_min' => 18,'age_max' => null], 'mother-in-law' => ['name' => 'Mother in Law', 'gender' => 'F','age_min' => 18,'age_max' => null]];
|
||||
|
||||
protected $inception_excel_columns = ['sno'=>['col_idx'=>0,'col_cell_name'=>'A','col_name'=>'S.No','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'emp_id'=>['col_idx'=>1,'col_cell_name'=>'B','col_name'=>'EMP ID','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'name_of_emp_dep'=>['col_idx'=>2,'col_cell_name'=>'C','col_name'=>'NAME OF EMP/DEP','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'dob'=>['col_idx'=>3,'col_cell_name'=>'D','col_name'=>'DOB','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null,'custom'=>'check_dob_diff','params'=>['row','relationship']],'gender'=>['col_idx'=>4,'col_cell_name'=>'E','col_name'=>'Gender','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>['M','F']],'relationship'=>['col_idx'=>5,'col_cell_name'=>'F','col_name'=>'RELATIONSHIP','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom'=>'check_relationship','params'=>['row','relationship']],'basic_cover_si'=>['col_idx'=>6,'col_cell_name'=>'G','col_name'=>'BASIC COVER SI','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom' => 'check_si','params' => ['row','policy_terms','slab_details']],'doc'=>['col_idx'=>7,'col_cell_name'=>'H','col_name'=>'Date of Coverage','is_mandatory'=>['A','DA'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null,'params'=>['row']],'doj'=>['col_idx'=>8,'col_cell_name'=>'I','col_name'=>'DOJ','is_mandatory'=>false,'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null,'custom'=>'check_doj','params'=>['row']],'basic_pay'=>['col_idx'=>9,'col_cell_name'=>'J','col_name'=>'Basic Pay','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom'=>'check_basic_pay','params'=>['row','policy_terms','slab_details']],'band_grade'=>['col_idx'=>10,'col_cell_name'=>'K','col_name'=>'Band/Grade','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom'=>'check_employee_band','params'=>['row','policy_terms','slab_details']],'designation'=>['col_idx'=>11,'col_cell_name'=>'L','col_name'=>'Designation','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null],'phone'=>['col_idx'=>12,'col_cell_name'=>'M','col_name'=>'Phone','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null],'email'=>['col_idx'=>13,'col_cell_name'=>'N','col_name'=>'Email','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null],'pre_existing_ailments'=>['col_idx'=>14,'col_cell_name'=>'O','col_name'=>'PRE EXISTING AILMENTS','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>['0','1']],'change_event'=>['col_idx'=>15,'col_cell_name'=>'P','col_name'=>'Change event','is_mandatory'=>['A','DA','D'],'data_type'=>'str','format'=>null,'allowed_values'=>null],'date_of_exit'=>['col_idx'=>16,'col_cell_name'=>'Q','col_name'=>'Date of exit','is_mandatory'=>['D'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null],'reason_for_exit'=>['col_idx'=>17,'col_cell_name'=>'R','col_name'=>'Reason for exit','is_mandatory'=>['D'],'data_type'=>'str','format'=>null,'allowed_values'=>null]];
|
||||
protected $inception_excel_columns = ['sno'=>['col_idx'=>0,'col_cell_name'=>'A','col_name'=>'S.No','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'emp_id'=>['col_idx'=>1,'col_cell_name'=>'B','col_name'=>'EMP ID','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'name_of_emp_dep'=>['col_idx'=>2,'col_cell_name'=>'C','col_name'=>'NAME OF EMP/DEP','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'dob'=>['col_idx'=>3,'col_cell_name'=>'D','col_name'=>'DOB','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null,'custom'=>'check_dob_diff','params'=>['row','relationship']],'gender'=>['col_idx'=>4,'col_cell_name'=>'E','col_name'=>'Gender','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>['M','F']],'relationship'=>['col_idx'=>5,'col_cell_name'=>'F','col_name'=>'RELATIONSHIP','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom'=>'check_relationship','params'=>['row','relationship','policy_terms']],'basic_cover_si'=>['col_idx'=>6,'col_cell_name'=>'G','col_name'=>'BASIC COVER SI','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom' => 'check_si','params' => ['row','policy_terms','slab_details']],'doc'=>['col_idx'=>7,'col_cell_name'=>'H','col_name'=>'Date of Coverage','is_mandatory'=>['A','DA'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null,'params'=>['row']],'doj'=>['col_idx'=>8,'col_cell_name'=>'I','col_name'=>'DOJ','is_mandatory'=>false,'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null,'custom'=>'check_doj','params'=>['row']],'basic_pay'=>['col_idx'=>9,'col_cell_name'=>'J','col_name'=>'Basic Pay','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom'=>'check_basic_pay','params'=>['row','policy_terms','slab_details']],'band_grade'=>['col_idx'=>10,'col_cell_name'=>'K','col_name'=>'Band/Grade','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom'=>'check_employee_band','params'=>['row','policy_terms','slab_details']],'designation'=>['col_idx'=>11,'col_cell_name'=>'L','col_name'=>'Designation','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null],'phone'=>['col_idx'=>12,'col_cell_name'=>'M','col_name'=>'Phone','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null],'email'=>['col_idx'=>13,'col_cell_name'=>'N','col_name'=>'Email','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null],'pre_existing_ailments'=>['col_idx'=>14,'col_cell_name'=>'O','col_name'=>'PRE EXISTING AILMENTS','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>['0','1']],'change_event'=>['col_idx'=>15,'col_cell_name'=>'P','col_name'=>'Change event','is_mandatory'=>['A','DA','D'],'data_type'=>'str','format'=>null,'allowed_values'=>null],'date_of_exit'=>['col_idx'=>16,'col_cell_name'=>'Q','col_name'=>'Date of exit','is_mandatory'=>['D'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null],'reason_for_exit'=>['col_idx'=>17,'col_cell_name'=>'R','col_name'=>'Reason for exit','is_mandatory'=>['D'],'data_type'=>'str','format'=>null,'allowed_values'=>null]];
|
||||
|
||||
protected $deletion_excel_columns = ['sno'=>['col_idx'=>0,'col_cell_name'=>'A','col_name'=>'S.No','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'emp_id'=>['col_idx'=>1,'col_cell_name'=>'B','col_name'=>'EMP ID','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'name_of_emp_dep'=>['col_idx'=>2,'col_cell_name'=>'C','col_name'=>'NAME OF EMP/DEP','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'change_event'=>['col_idx'=>3,'col_cell_name'=>'D','col_name'=>'Change event','is_mandatory'=>['D'],'data_type'=>'str','format'=>null,'allowed_values'=>null],'date_of_exit'=>['col_idx'=>4,'col_cell_name'=>'E','col_name'=>'Date of exit','is_mandatory'=>['D'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null],'reason_for_exit'=>['col_idx'=>5,'col_cell_name'=>'F','col_name'=>'Reason for exit','is_mandatory'=>['D'],'data_type'=>'str','format'=>null,'allowed_values'=>null]];
|
||||
|
||||
@ -142,7 +142,10 @@ class EmployeeServiceController extends AdminController
|
||||
|
||||
// get policy and rack details
|
||||
$policy_terms = $this->clientPolicyModel->getPolicyDetails($file['client_id'],$file['policy_id']);
|
||||
$policy_terms = (array) $policy_terms[0];// convert obj to array
|
||||
$policy_terms = json_decode($policy_terms[0]->policy_terms);
|
||||
$policy_terms = (array) $policy_terms;// convert obj to array
|
||||
//
|
||||
// dd($policy_terms);
|
||||
|
||||
//get policy slab rates
|
||||
$slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($file['policy_id'],$file['client_id']);
|
||||
@ -318,7 +321,7 @@ class EmployeeServiceController extends AdminController
|
||||
|
||||
// get policy and rack details
|
||||
$policy_terms = $this->clientPolicyModel->getPolicyDetails($file['client_id'],$file['policy_id']);
|
||||
// dd($policy_terms);
|
||||
// dd($this->clientPolicyModel->getLastQuery());
|
||||
$policy_terms = json_decode($policy_terms[0]->policy_terms);
|
||||
$policy_terms = (array) $policy_terms;// convert obj to array
|
||||
// dd($policy_terms);
|
||||
@ -369,6 +372,17 @@ class EmployeeServiceController extends AdminController
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($file['action'] == 'inception')
|
||||
{
|
||||
$res = check_self_available_in_family($family,$file['action']);
|
||||
// dd($res);
|
||||
if(!$res['is_self_found'])
|
||||
{
|
||||
array_push($result['error_summary'],14); // Self not found
|
||||
$result['error_data'][ $res['emp_code'] ]['name_of_emp_dep']['error'][] = "Self not found ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($file['action'] == 'dependent_addition' || $file['action'] == 'addition' || $file['action'] == 'inception')
|
||||
@ -387,7 +401,7 @@ class EmployeeServiceController extends AdminController
|
||||
|
||||
//check dup with empid and name with db
|
||||
$res = name_and_empid_check_in_db($family,$file);
|
||||
// dd($file);
|
||||
// dd($res);
|
||||
// echo '<br/>';
|
||||
// print_r($res);
|
||||
if(count($res['del']))
|
||||
@ -447,8 +461,8 @@ class EmployeeServiceController extends AdminController
|
||||
$job_details = new Jobs();
|
||||
|
||||
$r = Jobs::addJob(['job_name' => 'employeesOnboardPreprocess','payload' => ['file_id' => $file_id]]);
|
||||
$jobWorker = new JobWorker();
|
||||
JobWorker::processJob($r);
|
||||
// $jobWorker = new JobWorker();
|
||||
// JobWorker::processJob($r);
|
||||
}
|
||||
return $result;
|
||||
|
||||
@ -552,7 +566,7 @@ class EmployeeServiceController extends AdminController
|
||||
//get policy slab rates
|
||||
$slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($client_policy_id,$client_id);
|
||||
|
||||
$existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(client_id: $client_id,client_policy_id: $client_policy_id,emp_status: 'draft');
|
||||
$existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(client_id: $client_id,client_policy_id: $client_policy_id,emp_status: 'enrolled');
|
||||
|
||||
$file = ['id' => null,'client_id' => $client_id,'policy_id' => $client_policy_id,'action' => 'inception'];
|
||||
// dd($this->employeeModel->getLastQuery());
|
||||
@ -932,7 +946,7 @@ class EmployeeServiceController extends AdminController
|
||||
try {
|
||||
$file = $this->fileModel->find($file_id);
|
||||
$error_data = json_decode($file['reason']);
|
||||
|
||||
// dd($error_data);
|
||||
// return $error_data;
|
||||
|
||||
$file_name_with_path = WRITEPATH."/uploads/excel/".$file['file_name'];
|
||||
@ -952,7 +966,7 @@ class EmployeeServiceController extends AdminController
|
||||
$excelErrorData['excel_header'] = $excel_data[0];
|
||||
unset($excel_data[0]);
|
||||
// echo '<pre>';
|
||||
|
||||
// Kint::dump($excel_data);
|
||||
if($error_data->error_type == 1){
|
||||
|
||||
$finalArray = [];
|
||||
@ -995,13 +1009,24 @@ class EmployeeServiceController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// dd(array_keys($allErrors));
|
||||
foreach ($allErrors as $key => $value){
|
||||
$data = ['value' => $excel_data[$key][1], 'error'=>$value,];
|
||||
$excel_data[$key][1] = $data;
|
||||
array_push($typeTowArray, $excel_data[$key]);
|
||||
// echo $key;
|
||||
// print_r($value);
|
||||
foreach($excel_data as $excel_data_index => $excel_data_value)
|
||||
{
|
||||
if($excel_data_value[0] == $key)
|
||||
{
|
||||
$data = ['value' => $excel_data[$excel_data_index][1], 'error'=>$value,];
|
||||
$excel_data[$excel_data_index][1] = $data;
|
||||
array_push($typeTowArray, $excel_data[$excel_data_index]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dd($data);
|
||||
foreach ($typeTowArray as $fkey => $value){
|
||||
foreach ($value as $vkey => $arrayData){
|
||||
if(!is_array($arrayData)){
|
||||
@ -1018,7 +1043,7 @@ class EmployeeServiceController extends AdminController
|
||||
|
||||
}catch (\Exception $e) {
|
||||
// Handle any exceptions
|
||||
$errorMessage = $e->getMessage();
|
||||
$errorMessage = $e->getMessage();//die();
|
||||
$this->myLogger->logme('error', $errorMessage);
|
||||
return false; // You can return an error response here
|
||||
}
|
||||
|
||||
@ -67,7 +67,7 @@ if (!function_exists('check_excel_date_format')) {
|
||||
|
||||
if(!function_exists('check_relationship'))
|
||||
{
|
||||
function check_relationship($row,$relationship)
|
||||
function check_relationship($row,$relationship,$policy_terms)
|
||||
{
|
||||
// print_r($relationship);
|
||||
// echo '<br>';
|
||||
@ -78,21 +78,33 @@ if(!function_exists('check_relationship'))
|
||||
$slug = \Config\Services::slug();
|
||||
$col = $slug->slugify($row[5]);
|
||||
// echo $col;//die();
|
||||
if($col != 'self' && $col != 'spouse')
|
||||
{
|
||||
// if($col != 'self' && $col != 'spouse')
|
||||
// {
|
||||
if(!isset($relationship[ $col ]))
|
||||
{
|
||||
return array('status' => false,'error' => 'Rule Conflict: Unknown Relationship');
|
||||
}
|
||||
|
||||
if(isset($relationship[ $col ]) && $relationship[ $col ]['gender'] != $row[4])
|
||||
$family_floaters = isset($policy_terms['family_floaters']);
|
||||
if($family_floaters)
|
||||
{
|
||||
$error = "Gender relationship conflict: Expected ".$relationship[ $col ]['gender'].", received $row[4]";
|
||||
return array('status' => false,'error' => $error);
|
||||
if(isset($relationship[ $col ]) && $relationship[ $col ]['gender'] != $row[4])
|
||||
{
|
||||
$error = "Gender relationship conflict: Expected ".$relationship[ $col ]['gender'].", received $row[4]";
|
||||
return array('status' => false,'error' => $error);
|
||||
}
|
||||
}
|
||||
else // if family_floaters not set the its GPA, reject all other dependents
|
||||
{
|
||||
if($col != 'self')
|
||||
{
|
||||
$error = "Dependent(s) are not allowed";
|
||||
return array('status' => false,'error' => $error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// }
|
||||
return array('status' => true);
|
||||
}
|
||||
else
|
||||
@ -278,6 +290,26 @@ if (!function_exists('name_dup_check_within_family'))
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('check_self_available_in_family'))
|
||||
{
|
||||
function check_self_available_in_family($family_data)
|
||||
{
|
||||
|
||||
$is_self_found = false;
|
||||
foreach ($family_data as $rkey => $row)
|
||||
{
|
||||
if($row[5] != null && strtolower($row[5]) == 'self')//$row[5] = relationship $row[4] = Gender
|
||||
{
|
||||
$is_self_found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return ['is_self_found' => $is_self_found,'emp_code' => $family_data[0][1]];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!function_exists('name_and_empid_check_in_db'))
|
||||
@ -295,13 +327,13 @@ if (!function_exists('name_and_empid_check_in_db'))
|
||||
$res = $employeeModel
|
||||
->join('client_policy cp',"employees.client_id = cp.client_id")
|
||||
->join('employee_polices ep',"cp.id = ep.client_policy_id AND employees.id = ep.employee_id")
|
||||
->where("cp.policy_id",$policy_id)
|
||||
// ->where("cp.id",$policy_id)
|
||||
->where("employees.client_id",$client_id)
|
||||
// ->where("ep.client_id",$client_id)
|
||||
->where('name',$row[2])->where('emp_code',$row[1])
|
||||
->findAll();
|
||||
|
||||
// dd($employeeModel);
|
||||
// dd($employeeModel->getLastQuery());
|
||||
|
||||
|
||||
if(($current_action == 'deletion' || $current_action == 'correction' || $current_action == 'si_enhancement') && !count($res))
|
||||
@ -338,7 +370,7 @@ if (!function_exists('check_dependent_conflict'))
|
||||
$allowed_parent_in_laws_count = 0;
|
||||
$received_parent_in_laws_count = 0;
|
||||
$overall_famility_relationships = [];
|
||||
$self_emp_row_id = 0;
|
||||
$self_emp_row_id = null;
|
||||
$temp_counts = [2,3,4,5,6,7,8,9,10]; //temp variable for check relation repetaed count
|
||||
$slug = \Config\Services::slug();
|
||||
|
||||
@ -356,6 +388,7 @@ if (!function_exists('check_dependent_conflict'))
|
||||
// dd($allowed_adults == 0);
|
||||
foreach ($family_data as $key => $row)
|
||||
{
|
||||
// dd($family_data[0][0]);
|
||||
$relationship = $slug->slugify($row[5]);
|
||||
|
||||
if($actionArr != 'deletion' && $relationship != 'son' && $relationship != 'daughter')
|
||||
@ -411,7 +444,7 @@ if (!function_exists('check_dependent_conflict'))
|
||||
// print_r(array_values(array_count_values($overall_famility_relationships)));
|
||||
// print_r(in_array(2,array_values(array_count_values($overall_famility_relationships))));
|
||||
|
||||
if($self_gender == $spouse_gender)
|
||||
if($self_gender && $spouse_gender && $self_gender == $spouse_gender)
|
||||
{
|
||||
$result['status'] = false;
|
||||
$result['error_data'][] = ['code' => 4,'col_name' => 'gender','msg' => 'Rule conflict: Self and Spouse cannot be same gender','row_id' => (isset($self_emp_row_id) ? $self_emp_row_id : $family_data[0][0])];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user