diff --git a/app/Controllers/EmployeeServiceController.php b/app/Controllers/EmployeeServiceController.php index 46fb73ee..9b4dd5be 100644 --- a/app/Controllers/EmployeeServiceController.php +++ b/app/Controllers/EmployeeServiceController.php @@ -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)) { diff --git a/app/Helpers/excel_util_helper.php b/app/Helpers/excel_util_helper.php index c2dfc080..25a70785 100644 --- a/app/Helpers/excel_util_helper.php +++ b/app/Helpers/excel_util_helper.php @@ -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); } } diff --git a/public/sample_excel/sample_inception.xls b/public/sample_excel/sample_inception.xls index 934df3cd..2c3ab4e3 100644 Binary files a/public/sample_excel/sample_inception.xls and b/public/sample_excel/sample_inception.xls differ