diff --git a/app/Helpers/excel_util_helper.php b/app/Helpers/excel_util_helper.php index a3e4369d..21be120d 100644 --- a/app/Helpers/excel_util_helper.php +++ b/app/Helpers/excel_util_helper.php @@ -787,6 +787,22 @@ if (!function_exists('calculate_premimum')) } } + //set primary_rack_rate_acting_self in emp_details_with_empband_max_age_max_count array for policies where self not available and premium type is 1 (i.e.) GMC parents as dep addon policy + $transformed_familiy_member_data['temp']['primary_rack_rate_acting_self'] = false; + if(!isset($emp_details_with_empband_max_age_max_count[ $transformed_familiy_member_data['emp_code'] ]['primary_rack_rate_acting_self']) && $current_grid_info['type'] == 'primary') + { + if(strtolower($transformed_familiy_member_data['relationship']) == 'self') + { + $transformed_familiy_member_data['temp']['primary_rack_rate_acting_self'] = true; + $emp_details_with_empband_max_age_max_count[ $transformed_familiy_member_data['emp_code'] ]['primary_rack_rate_acting_self'] = true; + } + else + { + $transformed_familiy_member_data['temp']['primary_rack_rate_acting_self'] = true; + $emp_details_with_empband_max_age_max_count[ $transformed_familiy_member_data['emp_code'] ]['primary_rack_rate_acting_self'] = true; + } + } + //generate relationship code if($transformed_familiy_member_data['temp']['action'] != 'D' && $transformed_familiy_member_data['temp']['action'] != 'C' && $transformed_familiy_member_data['temp']['action'] != 'SI') { @@ -1013,7 +1029,7 @@ if (!function_exists('premium_calculation_manager')) $employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si; foreach ($temp_slab_rates as $skey => $slab_value) { - if($slab_value['si'] == $employee_received_si && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) )) + if($slab_value['si'] == $employee_received_si && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) )) { $emp_data['policy_details']['basic_cover_si'] = $slab_value['si']; $emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']); @@ -1036,7 +1052,7 @@ if (!function_exists('premium_calculation_manager')) foreach ($temp_slab_rates as $skey => $slab_value) { $age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y; - if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) )) + if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) )) { // dd($slab_value); $emp_data['policy_details']['basic_cover_si'] = $slab_value['si']; @@ -1057,7 +1073,7 @@ if (!function_exists('premium_calculation_manager')) foreach ($temp_slab_rates as $skey => $slab_value) { $age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y; - if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) )) + if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) )) { $emp_data['policy_details']['basic_cover_si'] = $slab_value['si']; $emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']); @@ -1077,7 +1093,7 @@ if (!function_exists('premium_calculation_manager')) foreach ($temp_slab_rates as $skey => $slab_value) { $age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y; - if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) )) + if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) )) { // echo $emp_data['name']; $emp_data['policy_details']['basic_cover_si'] = $slab_value['si']; @@ -1099,7 +1115,7 @@ if (!function_exists('premium_calculation_manager')) foreach ($temp_slab_rates as $skey => $slab_value) { $age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y; - if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) )) + if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) )) { $emp_data['policy_details']['basic_cover_si'] = $slab_value['si']; $emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']); @@ -1121,7 +1137,7 @@ if (!function_exists('premium_calculation_manager')) foreach ($temp_slab_rates as $skey => $slab_value) { - if($slab_value['grade'] == $employee_received_band && $slab_value['si'] == $employee_received_si && (($slab_value['premium_type'] == 1 && (strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) )) + if($slab_value['grade'] == $employee_received_band && $slab_value['si'] == $employee_received_si && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) )) { // $emp_data['policy_details']['basic_cover_si'] = $slab_value['si']; $emp_data['policy_details']['basic_cover_si'] = $slab_value['si']; @@ -1143,7 +1159,7 @@ if (!function_exists('premium_calculation_manager')) foreach ($temp_slab_rates as $skey => $slab_value) { - if($slab_value['si'] == $employee_received_si && (($slab_value['premium_type'] == 1 && (strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['additional_rack_rate_acting_self'])) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) )) + if($slab_value['si'] == $employee_received_si && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self'])) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) )) { $emp_data['policy_details']['basic_cover_si'] = $slab_value['si']; $emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']); @@ -1170,7 +1186,7 @@ if (!function_exists('premium_calculation_manager')) if( $slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $max_age && $slab_value['age_to'] >= $max_age) && (($slab_value['premium_type'] == 1 && - ( (strtolower($emp_data['relationship']) == 'self') || ($emp_data['temp']['additional_rack_rate_acting_self']) )) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ) ) + ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self'])) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ) ) { $emp_data['policy_details']['basic_cover_si'] = $employee_received_si; $emp_data['policy_details']['date_coverage'] = isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']; @@ -1195,7 +1211,7 @@ if (!function_exists('premium_calculation_manager')) { if($slab_value['si'] == $employee_received_si && $slab_value['grade'] == $employee_received_band && (($slab_value['premium_type'] == 1 && - ( (strtolower($emp_data['relationship']) == 'self') || ($emp_data['temp']['additional_rack_rate_acting_self']) )) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) )) + ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self'])) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) )) { //calculate premium based on count // echo $emp_data['name']; @@ -1224,7 +1240,7 @@ if (!function_exists('premium_calculation_manager')) $emp_data['policy_details']['basic_cover_si'] = null; foreach ($temp_slab_rates as $skey => $slab_value) { - if( $slab_value['si'] == $employee_received_si && ((($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) && $slab_value['relationship'] == $employee_relationship) || ($slab_value['premium_type'] == 1 && (strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['additional_rack_rate_acting_self'] ) )) ) + if( $slab_value['si'] == $employee_received_si && ((($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) && $slab_value['relationship'] == $employee_relationship) || ($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self']) )) ) { $emp_data['policy_details']['basic_cover_si'] = $employee_received_si; @@ -1249,7 +1265,7 @@ if (!function_exists('premium_calculation_manager')) $age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y; foreach ($temp_slab_rates as $skey => $slab_value) { - if( $slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && ((($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) && $slab_value['relationship'] == $employee_relationship) || ($slab_value['premium_type'] == 1 && (strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['additional_rack_rate_acting_self']) )) ) + if( $slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && ((($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) && $slab_value['relationship'] == $employee_relationship) || ($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self']) )) ) { $emp_data['policy_details']['basic_cover_si'] = $employee_received_si;