FIX_UAT_ISSUES_DOB_SI_BAND_BPAY
This commit is contained in:
parent
4bdf7b9eeb
commit
5177967b14
@ -169,10 +169,12 @@ class EmployeeServiceController extends AdminController
|
||||
{
|
||||
break;
|
||||
}
|
||||
//iterate each row
|
||||
|
||||
//iterate each row for columns validations
|
||||
foreach ($row as $col_key => $col)
|
||||
{
|
||||
|
||||
|
||||
$is_mandatory = $columns_to_check[$keys[$col_key]]['is_mandatory'];
|
||||
$format = $columns_to_check[$keys[$col_key]]['format'];
|
||||
$allowed_values = $columns_to_check[$keys[$col_key]]['allowed_values'];
|
||||
@ -263,19 +265,14 @@ class EmployeeServiceController extends AdminController
|
||||
$result['error_summary'] = array_count_values($result['error_summary']);
|
||||
$status = 'failed';
|
||||
$failure_reason = ((json_encode($result)));
|
||||
$this->fileModel->where('id', $file_id)->set(['status' => $status,'reason' => $failure_reason])->update();
|
||||
$this->fileModel->where('id', $file_id)->set(['status' => $status,'reason' => $failure_reason])->update();
|
||||
$this->myLogger->logme("error",'{file_id} uploaded failed',['file_id' => $file_id]);
|
||||
//return $this->respond(['dataStatus' => true,'code' => 404,'data' => 'file upload failed with errors'], 200);
|
||||
// dd($failure_reason);
|
||||
|
||||
|
||||
//print_r($r);
|
||||
}
|
||||
else //trigger next data validation via job queue server
|
||||
{
|
||||
//proceed next data level validation in JOB queue
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'excelFileDataValidation','payload' => ['file_id' => $file_id]]);
|
||||
$r = Jobs::addJob(['job_name' => 'excelFileDataValidation','payload' => ['file_id' => $file_id]]);
|
||||
// $jobWorker = new JobWorker();
|
||||
// JobWorker::processJob($r);
|
||||
}
|
||||
@ -375,7 +372,7 @@ class EmployeeServiceController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
if(($file['action'] == 'inception' || $file['action'] == 'addition' || $file['action'] == 'dependent_addition') && ($policy_details['is_addon'] != 3)) // 3 is dependent addon
|
||||
if(($file['action'] == 'inception' || $file['action'] == 'addition' || $file['action'] == 'dependent_addition') && ($policy_details['policy_type_id'] != 3)) // 3 is GMC parents (base policy or dep addon)
|
||||
{
|
||||
$res = check_self_available_in_family($family,$file['action']);
|
||||
// dd($res);
|
||||
@ -385,6 +382,18 @@ class EmployeeServiceController extends AdminController
|
||||
$result['error_data'][ $res['row_id'] ]['sno']['error'][] = "Self not found ";
|
||||
}
|
||||
}
|
||||
|
||||
//check self avaialbe where self data is not available either in excel or same policy (i.e.) gMC parents
|
||||
if($policy_details['policy_type_id'] == 3) // 3 is GMC parents (base policy or dep addon)
|
||||
{
|
||||
$self_details = $this->employeeModel->getEmpFamilybyEmpCode(emp_code: $emp_id,client_id: $file['client_id'],emp_status: ['active'],policy_status:['active']);
|
||||
// dd($self_details);
|
||||
if(!count($self_details))
|
||||
{
|
||||
array_push($result['error_summary'],14); // Self not found
|
||||
$result['error_data'][ $family[0][0] ]['sno']['error'][] = "Self not found ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($file['action'] == 'dependent_addition' || $file['action'] == 'addition' || $file['action'] == 'inception')
|
||||
@ -460,9 +469,8 @@ class EmployeeServiceController extends AdminController
|
||||
else //inception OR addition OR dependent addition
|
||||
{
|
||||
//proceed next data level validation in JOB queue
|
||||
$job_details = new Jobs();
|
||||
|
||||
$r = Jobs::addJob(['job_name' => 'employeesOnboardPreprocess','payload' => ['file_id' => $file_id]]);
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'employeesOnboardPreprocess','payload' => ['file_id' => $file_id]]);
|
||||
// $jobWorker = new JobWorker();
|
||||
// JobWorker::processJob($r);
|
||||
}
|
||||
|
||||
@ -79,8 +79,8 @@ 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');
|
||||
@ -105,7 +105,7 @@ if(!function_exists('check_relationship'))
|
||||
}
|
||||
|
||||
|
||||
// }
|
||||
}
|
||||
return array('status' => true);
|
||||
}
|
||||
else
|
||||
@ -190,17 +190,27 @@ if(!function_exists('check_si'))
|
||||
}
|
||||
|
||||
// check age slab
|
||||
if($row[3] != null)// dob
|
||||
if($row[3] != null && DateTime::createFromFormat('d-M-Y', $row[3]) !== false)// dob
|
||||
{
|
||||
$dob = change_date_format($row[3],'d-M-Y','Y-m-d');
|
||||
// echo $row[3].' - '.$dob;echo '<br>';
|
||||
$currentDateTime = new DateTime();//die();
|
||||
$passedDateTime = new DateTime($dob);
|
||||
$interval = $currentDateTime->diff($passedDateTime);
|
||||
// echo $row[0].' - '.$row[3].' - '.$interval->y;echo '<br>';
|
||||
if(!$is_age_slab_found && ($slab_value['age_from'] !== null && $slab_value['age_to'] !== null) && ($slab_value['age_from'] <= $interval->y && $slab_value['age_to'] >= $interval->y) && $slab_value['si'] == $received_si)
|
||||
if(!$is_age_slab_found)
|
||||
{
|
||||
$is_age_slab_found = true;
|
||||
if(isset($slab_value['age_from']) && isset($slab_value['age_to']))
|
||||
{
|
||||
if($slab_value['age_from'] !== null && $slab_value['age_to'] !== null && $slab_value['age_from'] <= $interval->y && $slab_value['age_to'] >= $interval->y && $slab_value['si'] == $received_si)
|
||||
{
|
||||
$is_age_slab_found = true;// send true if age slab found
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$is_age_slab_found = true;// send true if age conditin is not applicable
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}//end of check age slab
|
||||
@ -248,10 +258,19 @@ if (!function_exists('check_dob_diff'))
|
||||
{
|
||||
if($row[3] != null && $row[5] != null)
|
||||
{
|
||||
if (DateTime::createFromFormat('d-M-Y', $row[3]) === false)
|
||||
{
|
||||
return array('status' => false,'error' => 'Not a valid Date');
|
||||
}
|
||||
// return array('status' => true);
|
||||
$dob = change_date_format($row[3],'d-M-Y','Y-m-d');
|
||||
// echo $row[3].' - '.$dob;echo '<br>';
|
||||
$currentDateTime = new DateTime();//die();
|
||||
// print_r($currentDateTime);
|
||||
// die();
|
||||
$passedDateTime = new DateTime($dob);
|
||||
// print_r($passedDateTime);
|
||||
|
||||
$interval = $currentDateTime->diff($passedDateTime);
|
||||
|
||||
$slug = \Config\Services::slug();
|
||||
@ -429,9 +448,9 @@ if (!function_exists('check_dependent_conflict'))
|
||||
$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();
|
||||
|
||||
// if($policy_terms['family_floater'] == true)
|
||||
// {
|
||||
// dd($policy_terms);
|
||||
if(isset($policy_terms['family_floater']) && !empty($policy_terms['family_floaters']))
|
||||
{
|
||||
|
||||
// $temp_string = implode(" ",$policy_terms['family_floaters']);
|
||||
$temp = $policy_terms['family_floaters'];
|
||||
@ -535,15 +554,12 @@ if (!function_exists('check_dependent_conflict'))
|
||||
}
|
||||
|
||||
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if(count($family_data) > 1)
|
||||
// {
|
||||
// $result['status'] = false;
|
||||
// $result['error_data'][] = ['code' => 11,'col_name' => 'sno','msg' => 'Rule conflict: Dependents not allowed','row_id' => $row[0]];//dependents not allowed
|
||||
// }
|
||||
// }
|
||||
}
|
||||
else
|
||||
{
|
||||
$result['status'] = true;
|
||||
}
|
||||
|
||||
|
||||
return $result;
|
||||
|
||||
@ -1031,7 +1047,8 @@ if (!function_exists('premium_calculation_manager'))
|
||||
}
|
||||
if(!$is_match_found)
|
||||
{
|
||||
$log_message = '[ client_policy_id : ' .$emp_data['policy_details']['client_policy_id'].' - '. $emp_data['emp_code'].' - '.$emp_data['name'] .' - '. $emp_data['policy_details']['basic_cover_si'] . ' ]';
|
||||
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
|
||||
$log_message = '[ client_policy_id : ' .$emp_data['policy_details']['client_policy_id'].' - '. $emp_data['emp_code'].' - '.$emp_data['name'] .' - '. $emp_data['policy_details']['basic_cover_si'] . ', Age : '. $age.' ]';
|
||||
if($slab_details['slab_rates'][0]['premium_type'] == 1)
|
||||
{
|
||||
$log_message .= ' - skipping, calculating only self..!';
|
||||
|
||||
@ -95,7 +95,7 @@ class EmployeeModel extends Model
|
||||
}
|
||||
|
||||
|
||||
public function getEmpFamilybyEmpCode(string $client_policy_id = null,string $emp_code = null,string $client_id = null,array $emp_status = [],array $policy_status = [])
|
||||
public function getEmpFamilybyEmpCode(string $client_policy_id = null,string $emp_code = null,string $client_id = null,array $emp_status = [],array $policy_status = [],array $relationship = [])
|
||||
{
|
||||
$result = $this->select(['employees.id as emp_id', 'employees.client_id', 'employees.relationship', 'employees.relationship_code', 'employees.change_event', 'employees.emp_code', 'employees.name', 'employees.email_personal', 'employees.email_corporate', 'employees.mobile', 'employees.gender', 'employees.dob', 'employees.doj', 'employees.basic_pay', 'employees.band', 'employees.designation', 'employees.emp_status','employee_polices.id as emp_policy_id', 'employee_polices.employee_id', 'employee_polices.client_policy_id', 'employee_polices.tpa_id', 'employee_polices.uhid', 'employee_polices.batch_code', 'employee_polices.status', 'employee_polices.pre_existing_alignments', 'employee_polices.basic_cover_si', 'employee_polices.date_coverage', 'employee_polices.policy_end_date', 'employee_polices.days', 'employee_polices.premium', 'employee_polices.rata_premimum', 'employee_polices.gst', 'employee_polices.date_of_exit', 'employee_polices.reason_for_exit'])
|
||||
->join('employee_polices', 'employee_polices.employee_id = employees.id')
|
||||
@ -105,7 +105,7 @@ class EmployeeModel extends Model
|
||||
})
|
||||
|
||||
->where('employee_polices.is_active',1)
|
||||
// ->where('employees.emp_status', ($emp_status !== null ? $emp_status : 'active'))
|
||||
->where('employees.is_active',1)
|
||||
// ->where('employees.emp_code',$emp_code)
|
||||
->when($emp_code, function($query) use ($emp_code){
|
||||
return $query->where('employees.emp_code',$emp_code);
|
||||
@ -114,6 +114,9 @@ class EmployeeModel extends Model
|
||||
->when(count($emp_status), function($query) use ($emp_status){
|
||||
return $query->whereIn('employees.emp_status', $emp_status);
|
||||
})
|
||||
->when(count($relationship), function($query) use ($relationship){
|
||||
return $query->whereIn('employees.relationship', $relationship);
|
||||
})
|
||||
->when(count($policy_status), function($query) use ($policy_status){
|
||||
return $query->whereIn('employee_polices.status', $policy_status);
|
||||
})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user