From e117ed6941b3099b7bc706b0281b3f099d8d0bc2 Mon Sep 17 00:00:00 2001 From: Srinivas-Saravanan Date: Fri, 2 May 2025 15:48:35 +0530 Subject: [PATCH 1/2] FIX_EXCEL_UTIL_ROW_ID --- app/Helpers/excel_util_helper.php | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/app/Helpers/excel_util_helper.php b/app/Helpers/excel_util_helper.php index 108174f..92b55c9 100755 --- a/app/Helpers/excel_util_helper.php +++ b/app/Helpers/excel_util_helper.php @@ -566,6 +566,15 @@ if (!function_exists('check_dependent_conflict')) $allowed_parents_count = $temp['either-parents-pil'] == 0 ? $temp['parents'] : 0; $allowed_parent_in_laws_count = $temp['either-parents-pil'] == 0 ? $temp['parents-in-law'] : 0; // dd($allowed_adults == 0); + + $firstNonTemp = null; + + foreach ($family_data as $family) { + if (!isset($family['temp'])) { + $firstNonTemp = $family; + break; + } + } foreach ($family_data as $key => $row) { // dd($family_data[0][0]); @@ -580,7 +589,7 @@ if (!function_exists('check_dependent_conflict')) if($relationship == 'self') { $self_gender = $row[4]; - $self_emp_row_id = $row[0]; + $self_emp_row_id = isset($row['temp']) ? null : $row[0]; } if($relationship == 'spouse') { @@ -613,7 +622,7 @@ if (!function_exists('check_dependent_conflict')) if(is_array($repeated_count) && count($repeated_count)) { $result['status'] = false; - $result['error_data'][] = ['code' => 13,'col_name' => 'relationship','msg' => 'Rule conflict: Twofold relationship found within family','row_id' => $family_data[0][0]]; + $result['error_data'][] = ['code' => 13,'col_name' => 'relationship','msg' => 'Rule conflict: Twofold relationship found within family','row_id' => $firstNonTemp[0]]; } } // print_r($repeated_count); @@ -629,26 +638,26 @@ if (!function_exists('check_dependent_conflict')) 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])]; + $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 : $firstNonTemp[0])]; } } if(($allowed_spouse_count < $received_spouse_count) || ($allowed_child_count < $received_child_count) ) { $result['status'] = false; - $result['error_data'][] = ['code' => 12,'col_name' => 'sno','msg' => 'Rule conflict: As per policy, count of dependents has exceeded configured count','row_id' => (isset($self_emp_row_id) ? $self_emp_row_id : $family_data[0][0])];//dependent count mismatch + $result['error_data'][] = ['code' => 12,'col_name' => 'sno','msg' => 'Rule conflict: As per policy, count of dependents has exceeded configured count','row_id' => (isset($self_emp_row_id) ? $self_emp_row_id : $firstNonTemp[0])];//dependent count mismatch } // || ($allowed_parents_count < $received_parents_count) || ($allowed_parent_in_laws_count < $received_parent_in_laws_count) if($allowed_adults == 1 && $received_parents_count && $received_parent_in_laws_count ) { $result['status'] = false; - $result['error_data'][] = ['code' => 12,'col_name' => 'sno','msg' => 'Rule conflict: Parents and Parents in law both not allowed','row_id' => (isset($self_emp_row_id) ? $self_emp_row_id : $family_data[0][0])]; + $result['error_data'][] = ['code' => 12,'col_name' => 'sno','msg' => 'Rule conflict: Parents and Parents in law both not allowed','row_id' => (isset($self_emp_row_id) ? $self_emp_row_id : $firstNonTemp[0])]; if((2 < $received_parents_count) || (2 < $received_parent_in_laws_count)) { $result['status'] = false; - $result['error_data'][] = ['code' => 12,'col_name' => 'sno','msg' => 'Rule conflict: As per policy, count of dependents has exceeded configured count','row_id' => (isset($self_emp_row_id) ? $self_emp_row_id : $family_data[0][0])];//dependent count mismatch + $result['error_data'][] = ['code' => 12,'col_name' => 'sno','msg' => 'Rule conflict: As per policy, count of dependents has exceeded configured count','row_id' => (isset($self_emp_row_id) ? $self_emp_row_id : $firstNonTemp[0])];//dependent count mismatch } } //check for any cross parents but not more than two @@ -656,7 +665,7 @@ if (!function_exists('check_dependent_conflict')) { // dd($allowed_adults); $result['status'] = false; - $result['error_data'][] = ['code' => 12,'col_name' => 'sno','msg' => 'Rule conflict:As per policy, count of dependents has exceeded configured count','row_id' => (isset($self_emp_row_id) ? $self_emp_row_id : $family_data[0][0])];//dependent count mismatch + $result['error_data'][] = ['code' => 12,'col_name' => 'sno','msg' => 'Rule conflict:As per policy, count of dependents has exceeded configured count','row_id' => (isset($self_emp_row_id) ? $self_emp_row_id : $firstNonTemp[0])];//dependent count mismatch } From 32d095f2b92fc53213b86d3b7e0388fb703e1ce1 Mon Sep 17 00:00:00 2001 From: Gowtham M Date: Tue, 6 May 2025 10:20:29 +0530 Subject: [PATCH 2/2] GWM :is_premium_summery logic handling --- app/Controllers/EmployeeRestController.php | 88 ++++++++++++++++------ app/Models/EmployeeModel.php | 1 + 2 files changed, 68 insertions(+), 21 deletions(-) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 247d940..c5e84ea 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -1157,9 +1157,16 @@ class EmployeeRestController extends AdminController $array->mapped_family_floaters = $self; $array->type = 'GPA'; - $array->si_value = $si_value; - $array->si_premium_value = $si_premium_value; - $array->si_gst_value = $si_gst_value; + if($array->is_premium_summery == 1){ + $array->si_value = $si_value; + $array->si_premium_value = $si_premium_value; + $array->si_gst_value = $si_gst_value; + }else{ + $array->si_value = 0; + $array->si_premium_value = 0; + $array->si_gst_value = 0; + } + @@ -1299,9 +1306,15 @@ class EmployeeRestController extends AdminController $array->mapped_family_floaters = $data; $array->type = "GMC"; - $array->family_floaters_of_dependent_and_si_value = $dependent_and_si_value > 0 ? $dependent_and_si_value : 0; - $array->family_floaters_of_dependent_and_si_premium_value = $dependent_and_si_premium_value > 0 ? round($dependent_and_si_premium_value) : 0; - $array->family_floaters_of_dependent_and_gst_value = $dependent_and_si_gst_value > 0 ? round($dependent_and_si_gst_value) : 0; + if($array->is_premium_summery == 1){ + $array->family_floaters_of_dependent_and_si_value = $dependent_and_si_value > 0 ? $dependent_and_si_value : 0; + $array->family_floaters_of_dependent_and_si_premium_value = $dependent_and_si_premium_value > 0 ? round($dependent_and_si_premium_value) : 0; + $array->family_floaters_of_dependent_and_gst_value = $dependent_and_si_gst_value > 0 ? round($dependent_and_si_gst_value) : 0; + }else{ + $array->family_floaters_of_dependent_and_si_value = 0; + $array->family_floaters_of_dependent_and_si_premium_value = 0; + $array->family_floaters_of_dependent_and_gst_value = 0; + } $checkGmcParentsPolicyExist = $this->clientPolicyModel->select('client_policy.id as ClientPolicyId , client_policy.client_id as ClientId, client_policy.policy_type_id as policy_type_id, policy_type.long_name as Policy_Name , client_policy.is_addon as is_addon , client_policy.open_for_enrollment as OpenForEnrollment , client_policy.inception_type as inception_type , client_policy.policy_terms as Policy_Terms') ->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left') @@ -1499,9 +1512,15 @@ class EmployeeRestController extends AdminController $array->mapped_family_floaters = $data; $array->type = "GMC - Parents"; - $array->family_floaters_of_dependent_and_si_value = $dependent_and_si_value > 0 ? $dependent_and_si_value : 0; - $array->family_floaters_of_dependent_and_si_premium_value = $dependent_and_si_premium_value > 0 ? round($dependent_and_si_premium_value) : 0; - $array->family_floaters_of_dependent_and_gst_value = $dependent_and_si_gst_value > 0 ? round($dependent_and_si_gst_value) : 0; + if($array->is_premium_summery == 1){ + $array->family_floaters_of_dependent_and_si_value = $dependent_and_si_value > 0 ? $dependent_and_si_value : 0; + $array->family_floaters_of_dependent_and_si_premium_value = $dependent_and_si_premium_value > 0 ? round($dependent_and_si_premium_value) : 0; + $array->family_floaters_of_dependent_and_gst_value = $dependent_and_si_gst_value > 0 ? round($dependent_and_si_gst_value) : 0; + }else{ + $array->family_floaters_of_dependent_and_si_value = 0; + $array->family_floaters_of_dependent_and_si_premium_value = 0; + $array->family_floaters_of_dependent_and_gst_value = 0; + } return $array; @@ -1544,9 +1563,15 @@ class EmployeeRestController extends AdminController $array->type = $policyTypeData->policy_type; $array->Policy_Name = $policyTypeData->long_name; - $array->si_value = $si_value; - $array->si_premium_value = $si_premium_value; - $array->si_gst_value = $si_gst_value; + if($array->is_premium_summery == 1){ + $array->si_value = $si_value; + $array->si_premium_value = $si_premium_value; + $array->si_gst_value = $si_gst_value; + }else{ + $array->si_value = 0; + $array->si_premium_value = 0; + $array->si_gst_value = 0; + } if($employee_policy){ @@ -1952,9 +1977,16 @@ class EmployeeRestController extends AdminController } $responce['family_floaters_of_dependent_and_si_array'] = $data; - $responce['family_floaters_of_dependent_and_si_value'] = $dependent_and_si_value > 0 ? $dependent_and_si_value : 0; - $responce['family_floaters_of_dependent_and_si_premium_value'] = $dependent_and_si_premium_value > 0 ? round($dependent_and_si_premium_value) : 0; - $responce['family_floaters_of_dependent_and_gst_value'] = $dependent_and_si_gst_value > 0 ? round($dependent_and_si_gst_value) : 0; + if($array['is_premium_summery']){ + $responce['family_floaters_of_dependent_and_si_value'] = $dependent_and_si_value > 0 ? $dependent_and_si_value : 0; + $responce['family_floaters_of_dependent_and_si_premium_value'] = $dependent_and_si_premium_value > 0 ? round($dependent_and_si_premium_value) : 0; + $responce['family_floaters_of_dependent_and_gst_value'] = $dependent_and_si_gst_value > 0 ? round($dependent_and_si_gst_value) : 0; + }else{ + $responce['family_floaters_of_dependent_and_si_value'] = 0; + $responce['family_floaters_of_dependent_and_si_premium_value'] = 0; + $responce['family_floaters_of_dependent_and_gst_value'] = 0; + } + @@ -2014,9 +2046,16 @@ class EmployeeRestController extends AdminController } $responce['family_floaters_of_only_si_array'] = $only_si_array; - $responce['family_floaters_of_only_si_value'] = $only_si_value; - $responce['family_floaters_of_only_si_premium_value'] = round($only_si_premium_value); - $responce['family_floaters_of_only_si_gst_value'] = $only_si_gst_value; + if($array['is_premium_summery']){ + $responce['family_floaters_of_only_si_value'] = $only_si_value; + $responce['family_floaters_of_only_si_premium_value'] = round($only_si_premium_value); + $responce['family_floaters_of_only_si_gst_value'] = $only_si_gst_value; + }else{ + $responce['family_floaters_of_only_si_value'] = 0; + $responce['family_floaters_of_only_si_premium_value'] = 0; + $responce['family_floaters_of_only_si_gst_value'] = 0; + } + if($this->request->getGet('policy') == 'GMC-SI-TOPUP'){ @@ -2070,9 +2109,16 @@ class EmployeeRestController extends AdminController } $responce['family_floaters_of_only_si_array'] = $only_si_array; - $responce['family_floaters_of_only_si_value'] = $only_si_value; - $responce['family_floaters_of_only_si_premium_value'] = round($only_si_premium_value); - $responce['family_floaters_of_only_si_gst_value'] = round($only_si_gst_value); + if($array['is_premium_summery']){ + $responce['family_floaters_of_only_si_value'] = $only_si_value; + $responce['family_floaters_of_only_si_premium_value'] = round($only_si_premium_value); + $responce['family_floaters_of_only_si_gst_value'] = round($only_si_gst_value); + }else{ + $responce['family_floaters_of_only_si_value'] = 0; + $responce['family_floaters_of_only_si_premium_value'] = 0; + $responce['family_floaters_of_only_si_gst_value'] = 0; + } + if($this->request->getGet('policy') == 'GMC-SI-PARENT-TOPUP'){ diff --git a/app/Models/EmployeeModel.php b/app/Models/EmployeeModel.php index 0826428..97c2dfe 100755 --- a/app/Models/EmployeeModel.php +++ b/app/Models/EmployeeModel.php @@ -155,6 +155,7 @@ class EmployeeModel extends Model client_policy.client_id as ClientId, client_policy.policy_id as PolicyId, client_policy.id as ClientPolicyId, + client_policy.is_premium_summery, CASE WHEN client_policy.open_for_enrollment IS NULL THEN 0 ELSE client_policy.open_for_enrollment