CHNAGE_INCEPTION_SAMPLE_FILE&PULL_ORIGINAL_DATA_ISSUE

This commit is contained in:
velz 2024-04-27 11:05:39 +05:30
parent 9793593854
commit 89ea5cd9a5
3 changed files with 5 additions and 49 deletions

View File

@ -834,7 +834,7 @@ class EmployeeServiceController extends AdminController
foreach($familiy_data as $fkey => $value)
{
if($file['id'] == null || ($value['temp']['source'] == 'excel' || (in_array($value['temp']['grid_type'],[10,11]) && strtolower($value['relationship']) == 'self'))) //insert data come from excel and from db
if($file['id'] == null || $value['temp']['source'] == 'excel') //insert data come from excel and from db i.e. ( $file['id'] == null for enrollment data)
{
$employee = $this->employeeModel->checkExistingEmp($value);
@ -842,50 +842,6 @@ class EmployeeServiceController extends AdminController
$temp = $value['temp'];
unset($value['policy_details']);
unset($value['temp']);
if($file['id'] == null && (strtolower($value['relationship']) == 'self' && $temp['source'] == 'db' && $temp['emp_id'] != null && $temp['emp_policy_id'] != null))
{
//check existing si and new si
$employee_policy = $this->employeePolicyModel->where('employee_id',$employee['id'])->where('client_policy_id',$file['policy_id'])->first();
if($employee_policy['basic_cover_si'] != $policy_data['basic_cover_si'])
{
//check any existing si enhancement pending
$existing_endorsements = $this->empEndorsementModel->where('actions','si')
->where('table_name','employee_polices')
->where('endorsement_id is null')
->where('emp_code',$employee['emp_code'])
->where('name',$employee['name'])
->where('field_name','basic_cover_si')
->findAll();
if(!count($existing_endorsements))
{
$slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($file['policy_id'],$file['client_id']);
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
{
if($slab_value['si'] == $policy_data['si'])
{
$group_key = rand(100000, 999999);
//add new premimum details in endorsement table
$this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'basic_cover_si','old_value' => $employee_policy['basic_cover_si'],'new_value' => $policy_data['premium'],'created_by' => $file['created_by'],'remarks' => 'da auto si enhancement','group_key' => $group_key]);
$this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'premium','old_value' => $employee_policy['premium'],'new_value' => $slab_value['premium'],'created_by' => $file['created_by'],'remarks' => 'da auto si enhancement','group_key' => $group_key]);
$this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'si_enhancement_date','old_value' => null,'new_value' => ($policy_data['date_coverage']),'created_by' => $file['created_by'],'remarks' => 'da auto si enhancement','group_key' => $group_key]);
break;
}
}
}
}
break;
}// end of self employee si enhance ment
//save employee table
if(count($employee))
{

View File

@ -659,25 +659,25 @@ if (!function_exists('premium_calculation_manager'))
//audit history table then initiate calculation with it. so this data again get updated in emp table
//check emp records
if($file['id'] == null && $emp_data['temp']['emp_status'] == 'draft' && $emp_data['temp']['policy_status'] == 'draft')
if($emp_data['file_id'] == null && $emp_data['temp']['emp_status'] == 'draft' && $emp_data['temp']['policy_status'] == 'draft')
{
$original_emp_records = get_emp_records_from_audit_history($emp_data['temp']['emp_id']);
if(is_array($original_emp_records))
{
// Kint::dump($original_emp_records);
// $emp_data = replace_original_data(original_data:$original_emp_records,current_data:$emp_data);
$emp_data = replace_original_data(original_data:$original_emp_records,current_data:$emp_data);
// Kint::dump($value);
}
}
//check emp policy records
if($file['id'] == null && $emp_data['temp']['emp_status'] == 'draft' && $emp_data['temp']['policy_status'] == 'draft')
if($emp_data['file_id'] == null && $emp_data['temp']['emp_status'] == 'draft' && $emp_data['temp']['policy_status'] == 'draft')
{
$original_emp_policy_records = get_emp_policy_records_from_audit_history($emp_data['temp']['emp_policy_id']);
if(is_array($original_emp_policy_records))
{
// Kint::dump($original_emp_records);
// $emp_data['policy_details'] = replace_original_data(original_data:$original_emp_policy_records,current_data:$emp_data['policy_details']);
$emp_data['policy_details'] = replace_original_data(original_data:$original_emp_policy_records,current_data:$emp_data['policy_details']);
// Kint::dump($policy_data);
}
}