diff --git a/app/Config/Routes.php b/app/Config/Routes.php index a6529b4..998369a 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -500,3 +500,6 @@ $routes->cli("cli/sendCroneRemainderMail", "DashboardController::sendCroneRemain $routes->get('enrollOpendAndClose', 'DashboardController::updatePolicyEnrollmentStatus'); $routes->get("sendCroneRemainderMail", "DashboardController::sendCroneRemainderMail"); +$routes->get("getEmployeePolicy", "EmployeeRestController::getEmployeePolicy"); +$routes->get("getAddOnPolicy", "EmployeeRestController::getAddOnPolicy"); + diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index f013e9f..eb1a2be 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -1069,6 +1069,7 @@ class ClientController extends AdminController $data['is_member_modify_allowed'] = $this->request->getPost('is_member_modify_allowed') ? 1 : 0; $data['enrolment_visibility'] = $this->request->getPost('enrolment_visibility') ? 1 : 0; $data['is_lgbtq'] = $this->request->getPost('is_lgbtq') ? 1 : 0; + $data['is_premium_summery'] = $this->request->getPost('is_premium_summery') ? 1 : 0; if ($policy_type_id == 1 || $policy_type_id == 2 || $policy_type_id == 6 || $policy_type_id == 7) { @@ -1201,6 +1202,7 @@ class ClientController extends AdminController $data['policy_end_date'] = change_date_format($this->request->getPost('policy_end_date'), 'd-m-Y', 'Y-m-d'); // $data['is_member_modify_allowed'] = $this->request->getPost('is_member_modify_allowed') ? 1 : 0; $data['is_lgbtq'] = $this->request->getPost('is_lgbtq') ? 1 : 0; + $data['is_premium_summery'] = $this->request->getPost('is_premium_summery') ? 1 : 0; if ($data['inception_type'] == 2) { $data['open_date'] = change_date_format($this->request->getPost('open_date'), 'd-m-Y', 'Y-m-d'); @@ -1913,7 +1915,7 @@ class ClientController extends AdminController $emp_count = $this->employeePolicyModel ->join('client_policy cp', "cp.id = employee_polices.client_policy_id") ->where("employee_polices.client_policy_id", $client_policy_id) - ->where("employee_polices.status", 'active') + ->whereIn("employee_polices.status", ['draft', 'enrolled']) ->where("employee_polices.is_active", 1) ->countAllResults(); @@ -2455,7 +2457,7 @@ class ClientController extends AdminController $emp_count_by_policy = $this->employeePolicyModel ->where('client_policy_id', $client_policy_id) - ->where("status", 'active') + ->whereIn("status", ['draft', 'enrolled']) ->where('is_active', 1) ->countAllResults(); @@ -4571,7 +4573,8 @@ class ClientController extends AdminController // $empRest = new EmployeeRestController(); - // $empRest->calculatePremium(393, 'ARCPO7010', 500000, 27); + // // $empRest->calculatePremium(399, 'ZOHO7105', 500000, 145); + // $empRest->updatePremiumAmount(399, 'ZOHO7105', 145); } // ------------------------------------------------------------------------------------------------------- diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 7b655b1..f13f66e 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -380,7 +380,7 @@ class EmployeeRestController extends AdminController ->where('client_policy_id',$value['policy_details']['client_policy_id'] ) ->where('employee_id' , $value['temp']['emp_id'] ) ->where('is_active', 1 ) - ->set(array('basic_cover_si' => $value['policy_details']['basic_cover_si'],'premium'=> $value['policy_details']['premium'] , 'rata_premimum'=> $value['policy_details']['rata_premimum'] , 'gst'=> $value['policy_details']['gst'] )) + ->set(array('basic_cover_si' => $value['policy_details']['basic_cover_si'],'premium'=> $value['policy_details']['premium'] , 'rata_premimum'=> $value['policy_details']['rata_premimum'] , 'gst'=> $value['policy_details']['gst'], 'payable_employee'=> $value['policy_details']['payable_employee'] ?? 0 )) ->update(); } @@ -1094,7 +1094,7 @@ class EmployeeRestController extends AdminController $keysToRemove = ["removable_keys"]; // Retrieve employee policy data by passing the employee primary key $empPolicy = $this->employeeModel->getEmployeePolicy($id); -// dd($empPolicy); + // dd($empPolicy); // Retrieve employee and dependents data by passing the employee code $employeeData = $this->employeeModel->where('emp_code',$emp_code) ->where('client_id',$client_id) @@ -1158,8 +1158,14 @@ 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_premium_value = $si_premium_value; + $array->si_gst_value = $si_gst_value; + }else{ + $array->si_premium_value = 0; + $array->si_gst_value = 0; + } + @@ -1300,8 +1306,13 @@ 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_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_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') @@ -1500,8 +1511,13 @@ 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_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_premium_value = 0; + $array->family_floaters_of_dependent_and_gst_value = 0; + } return $array; @@ -1512,7 +1528,7 @@ class EmployeeRestController extends AdminController public function getAdditionalGPAPolicy($empData,$policy_type,$emp_code,$client_id,$client_branch_id,$login_by_hr) { - $checkPolicyExist = $this->clientPolicyModel->select('client_policy.id as ClientPolicyId , client_policy.client_id as ClientId, client_policy.policy_type_id as policy_type_id, 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 , client_policy.enrolment_visibility') + $checkPolicyExist = $this->clientPolicyModel->select('client_policy.id as ClientPolicyId , client_policy.client_id as ClientId, client_policy.policy_type_id as policy_type_id, 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 , client_policy.enrolment_visibility,client_policy.is_premium_summery') ->where('client_policy.policy_type_id', $policy_type ) ->where('client_policy.is_addon', 1 ) ->where('client_policy.client_id', $client_id ) @@ -1545,8 +1561,13 @@ 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_premium_value = round($si_premium_value); + $array->si_gst_value = round($si_gst_value); + }else{ + $array->si_premium_value = 0; + $array->si_gst_value = 0; + } if($employee_policy){ @@ -1812,6 +1833,7 @@ class EmployeeRestController extends AdminController $responce['policy_type_id'] = $array['policy_type_id']; //$responce['is_member_modify_allowed'] = $array['is_member_modify_allowed']; $responce['disclaimer'] = $array['disclaimer']; + $responce['is_premium_summery'] = $array['is_premium_summery']; $tpaArray = $this->employeeModel->select('employees.name as name , employee_polices.tpa_id as tpa_id , employee_polices.rand_string as rand_string') ->join('employee_polices', 'employee_polices.employee_id = employees.id') @@ -1953,8 +1975,14 @@ 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_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_premium_value'] = 0; + $responce['family_floaters_of_dependent_and_gst_value'] = 0; + } + @@ -2015,8 +2043,14 @@ 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_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_premium_value'] = 0; + $responce['family_floaters_of_only_si_gst_value'] = 0; + } + if($this->request->getGet('policy') == 'GMC-SI-TOPUP'){ @@ -2071,8 +2105,14 @@ 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_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_premium_value'] = 0; + $responce['family_floaters_of_only_si_gst_value'] = 0; + } + if($this->request->getGet('policy') == 'GMC-SI-PARENT-TOPUP'){ @@ -2234,14 +2274,12 @@ class EmployeeRestController extends AdminController helper('excel_util_helper'); if($this->request){ // - echo 'request'; $client_policy_id = $this->request->getVar('client_policy_id') ?? $clientPolicyId; $emp_code = $this->request->getVar('emp_code') ?? $empCode; $default_si = $this->request->getVar('si') ?? $default_si;// si amt which choosed in add on policy $client_branch_id = $this->request->getVar('client_branch_id') ?? $client_branch_id; }else{ //Cli and enrollment - echo 'internal'; $client_policy_id = $clientPolicyId; $emp_code = $empCode; $default_si = $default_si;// si amt which choosed in add on policy @@ -2335,24 +2373,66 @@ class EmployeeRestController extends AdminController $value['policy_details']['rata_premimum'] = 0; $value['policy_details']['premium'] = 0; $value['policy_details']['gst'] = 0; + $value['policy_details']['payable_employee'] = $policyTermsJson['is_payable_employee']['self']; + + }else if(strtolower($value['relationship']) == 'self' && $policyTermsJson['is_payable_employee']['self'] == 1){ + $value['policy_details']['payable_employee'] = $policyTermsJson['is_payable_employee']['self']; } if(strtolower($value['relationship']) == 'spouse' && $policyTermsJson['is_payable_employee']['spouse'] == 0){ $value['policy_details']['rata_premimum'] = 0; $value['policy_details']['premium'] = 0; - $value['policy_details']['gst'] = 0; + $value['policy_details']['gst'] = 0; + $value['policy_details']['payable_employee'] = $policyTermsJson['is_payable_employee']['spouse']; + + }else if(strtolower($value['relationship']) == 'spouse' && $policyTermsJson['is_payable_employee']['spouse'] == 1){ + $value['policy_details']['payable_employee'] = $policyTermsJson['is_payable_employee']['spouse']; } if((strtolower($value['relationship']) == 'son' || strtolower($value['relationship']) == 'daughter') && $policyTermsJson['is_payable_employee']['childern'] == 0){ $value['policy_details']['rata_premimum'] = 0; $value['policy_details']['premium'] = 0; - $value['policy_details']['gst'] = 0; + $value['policy_details']['gst'] = 0; + $value['policy_details']['payable_employee'] = $policyTermsJson['is_payable_employee']['childern']; + + }else if((strtolower($value['relationship']) == 'son' || strtolower($value['relationship']) == 'daughter') && $policyTermsJson['is_payable_employee']['childern'] == 1){ + $value['policy_details']['payable_employee'] = $policyTermsJson['is_payable_employee']['childern']; } if((strtolower($value['relationship']) == 'father in law' || strtolower($value['relationship']) == 'mother in law' || strtolower($value['relationship']) == 'father' || strtolower($value['relationship']) == 'mother' ) && $policyTermsJson['is_payable_employee']['elders'] == 0){ $value['policy_details']['rata_premimum'] = 0; $value['policy_details']['premium'] = 0; - $value['policy_details']['gst'] = 0; + $value['policy_details']['gst'] = 0; + $value['policy_details']['payable_employee'] = $policyTermsJson['is_payable_employee']['elders']; + + }else if((strtolower($value['relationship']) == 'father in law' || strtolower($value['relationship']) == 'mother in law' || strtolower($value['relationship']) == 'father' || strtolower($value['relationship']) == 'mother' ) && $policyTermsJson['is_payable_employee']['elders'] == 1){ + $value['policy_details']['payable_employee'] = $policyTermsJson['is_payable_employee']['elders']; + } + + } + unset($value); + } + }else{ + if(isset($policy_terms['policy_terms'])){ + + $policyTermsJson = json_decode($policy_terms['policy_terms'], true); + + foreach ($employee_data_group_by_family[$emp_code] as $key => &$value) { + + if(strtolower($value['relationship']) == 'self'){ + $value['policy_details']['payable_employee'] = $policyTermsJson['is_payable_employee']['self']; + } + + if(strtolower($value['relationship']) == 'spouse'){ + $value['policy_details']['payable_employee'] = $policyTermsJson['is_payable_employee']['spouse']; + } + + if((strtolower($value['relationship']) == 'son' || strtolower($value['relationship']) == 'daughter')){ + $value['policy_details']['payable_employee'] = $policyTermsJson['is_payable_employee']['childern']; + } + + if((strtolower($value['relationship']) == 'father in law' || strtolower($value['relationship']) == 'mother in law' || strtolower($value['relationship']) == 'father' || strtolower($value['relationship']) == 'mother' )){ + $value['policy_details']['payable_employee'] = $policyTermsJson['is_payable_employee']['elders']; } } @@ -2364,7 +2444,8 @@ class EmployeeRestController extends AdminController } // die(); if($clientPolicyId != null && $empCode != null) - { // dd ($employee_data_group_by_family); + { + // dd ($employee_data_group_by_family); return $employee_data_group_by_family; }else{ // dd ($employee_data_group_by_family); diff --git a/app/Controllers/EmployeeServiceController.php b/app/Controllers/EmployeeServiceController.php index a6c146f..b76510b 100755 --- a/app/Controllers/EmployeeServiceController.php +++ b/app/Controllers/EmployeeServiceController.php @@ -1035,7 +1035,14 @@ class EmployeeServiceController extends AdminController $family = data_group_by_family($family)[ $emp_id ];// reason to call this again bring self to first index of the array } // kint::dump($family);//die(); - + $firstNonTemp = null; + + foreach ($family as $fam) { + if (!isset($fam['temp'])) { + $firstNonTemp = $fam; + break; + } + } //check name dup within a family if($file['action'] == 'inception' || $file['action'] == 'missed_inception' || $file['action'] == 'addition' || $file['action'] == 'dependent_addition' || $file['action'] == 'enrollment') { @@ -1069,7 +1076,7 @@ class EmployeeServiceController extends AdminController if(!count($self_details)) { array_push($result['error_summary'],14); // Self not found - $result['error_data'][ $family[0][0] ]['sno']['error'][] = "Self not found in Database"; + $result['error_data'][ $firstNonTemp[0] ]['sno']['error'][] = "Self not found in Database"; } } diff --git a/app/Helpers/excel_util_helper.php b/app/Helpers/excel_util_helper.php index 108174f..7a59f25 100755 --- a/app/Helpers/excel_util_helper.php +++ b/app/Helpers/excel_util_helper.php @@ -444,6 +444,18 @@ if (!function_exists('name_dup_check_within_family')) if(in_array($row[2],$temp)) { array_push($result,$row[0]); + $emp_code = $row[1]; + $tempFam = null; + foreach ($family_data as $family) { + if ($family[1] == $emp_code &&!isset($family['temp'])) { + $tempFam = $family; + break; // Stop at the first match + } + } + // Kint::dump($tempFam); + // die(); + + array_push($result,$tempFam[0]); } else { @@ -521,7 +533,16 @@ if (!function_exists('name_and_empid_check_in_db')) } if(($current_action == 'inception' || $current_action == 'dependent_addition' || $current_action == 'addition' || $current_action == 'enrollment') && count($res)) { - array_push($result['i'],$row[0]); + $emp_code = $row[1]; + $tempFam = null; + foreach ($family_data as $family) { + if ($family[1] == $emp_code &&!isset($family['temp'])) { + $tempFam = $family; + break; // Stop at the first match + } + } + array_push($result['i'],$tempFam[0]); + // array_push($result['i'],$row[0]); } } @@ -566,6 +587,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 +610,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 +643,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 +659,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 +686,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 } diff --git a/app/Helpers/sendMailNotification.php b/app/Helpers/sendMailNotification.php index bea00db..743ca23 100755 --- a/app/Helpers/sendMailNotification.php +++ b/app/Helpers/sendMailNotification.php @@ -239,22 +239,22 @@ class sendMailNotification $premium = ''; $gst_forself = ''; - // if(checkFamilyFloaters($policy_premium_data, $client_policy_data, $inner_item)){ - - if($policy_premium_data['premium_type'] == 2){ - $si = '₹ ' .format_indian_number($inner_item['basic_cover_si']); - }else{ - if ($inner_item['relationship'] == 'Self') { - $payable_employee_array['si_amount'] = $inner_item['basic_cover_si']; - $payable_employee_array['self_premium'] = $inner_item['rata_premimum']; - $payable_employee_array['self_gst'] = $inner_item['gst']; - } - empty($inner_item['basic_cover_si']) ? $si = 0 : $si = '₹ ' .format_indian_number($inner_item['basic_cover_si']); + if($policy_premium_data['premium_type'] == 2){ + $si = '₹ ' .format_indian_number($inner_item['basic_cover_si']); + }else{ + if ($inner_item['relationship'] == 'Self') { + $payable_employee_array['si_amount'] = $inner_item['basic_cover_si']; + $payable_employee_array['self_premium'] = $inner_item['rata_premimum']; + $payable_employee_array['self_gst'] = $inner_item['gst']; } + empty($inner_item['basic_cover_si']) ? $si = 0 : $si = '₹ ' .format_indian_number($inner_item['basic_cover_si']); + } + // Premium summery for show and hide the Additional premium data + if($client_policy_data['is_premium_summery'] == 1){ $premium = '₹ ' .format_indian_number(round($inner_item['rata_premimum'])); - $gst_forself = '₹ ' .format_indian_number(round($inner_item['gst'])); - // } + $gst_forself = '₹ ' .format_indian_number(round($inner_item['gst'])); + } $temp_data .= ''; $temp_data .= '' . $inner_item['name'] . ($inner_item['relationship'] == 'Self' ? ' (' . $inner_item['emp_code'] . ')' : '') . ''; @@ -268,7 +268,7 @@ class sendMailNotification if ($si != 0 && count($item) != 1 && $is_si_set == 0) { - $temp_data .= '' . $si . ''; + $temp_data .= '' . $si . ''; $is_si_set = 1; } else { @@ -284,7 +284,7 @@ class sendMailNotification } // Only Display SI Topup and Dependent Addon - if ($inner_item['is_addon'] == 2 || $inner_item['is_addon'] == 3) { + if (($inner_item['is_addon'] == 2 || $inner_item['is_addon'] == 3) && $client_policy_data['is_premium_summery'] == 1) { $temp_data .= '' . $premium . ''; $temp_data .= '' . $gst_forself . ''; } @@ -316,7 +316,7 @@ class sendMailNotification $table_content .= 'Sum Insured'; // Only Display SI Topup and Dependent Addon - if ($is_addon == 2 || $is_addon == 3) { + if (($is_addon == 2 || $is_addon == 3) && $client_policy_data['is_premium_summery'] == 1) { $table_content .= 'Premium'; $table_content .= 'GST'; } @@ -328,7 +328,7 @@ class sendMailNotification $table_content .= '' . $temp_data . ''; $table_content .= ''; - if ($is_addon == 2 || $is_addon == 3) { + if (($is_addon == 2 || $is_addon == 3) && $client_policy_data['is_premium_summery'] == 1) { $addon_list_array = [ 'policy_name' => $policy_name_for_policy_type, 'addtional_premium' => round($addtional_premium), @@ -345,7 +345,7 @@ class sendMailNotification // dd($payable_employee_array); // dd(count($payable_employee_array['emp_data'])); - if(isset($payable_employee_array['emp_data']) && count($payable_employee_array['emp_data']) > 0){ + if(isset($payable_employee_array['emp_data']) && count($payable_employee_array['emp_data']) > 0 && $client_policy_data['is_premium_summery'] == 1){ $table_content .= '

Policy Type :'; $temp_data = ''; @@ -401,30 +401,35 @@ class sendMailNotification // dd($si); - if($policy_premium_data['premium_type'] == 2){ + // Premium summery for show and hide the Additional premium data + if($client_policy_data['is_premium_summery'] == 1){ + if($policy_premium_data['premium_type'] == 2){ - $temp_data .= '' . $si . ''; - $temp_data .= '' . $premium . ''; - $temp_data .= '' . $gst_forself . ''; + $temp_data .= '' . $si . ''; + $temp_data .= '' . $premium . ''; + $temp_data .= '' . $gst_forself . ''; - }else{ - - if($policy_premium_data['premium_type'] == 1){ - - $temp_data .= (($si != 0 && count($item) != 1) ? ('' . $si . '') : ($si == 0 ? "" : '' . $si . '') ); - $temp_data .= (($premium != 0 && count($item) != 1) ? ('' . $premium . '') : ($premium == 0 ? "" : '' . $premium . '') ); - $temp_data .= (($gst_forself != 0 && count($item) != 1) ? ('' . $gst_forself . '') : ($gst_forself == 0 ? "" : '' . $gst_forself . '') ); - }else{ - $temp_data .= (($si != 0 && count($item) != 1) ? ('' . $si . '') : ($si == 0 ? "" : '' . $si . '') ); - $temp_data .= '' . $premium . ''; - $temp_data .= '' . $gst_forself . ''; - } + if($policy_premium_data['premium_type'] == 1){ - $self_si_amount = 0; - $self_premium = 0; - $self_gst = 0; + $temp_data .= (($si != 0 && count($item) != 1) ? ('' . $si . '') : ($si == 0 ? "" : '' . $si . '') ); + $temp_data .= (($premium != 0 && count($item) != 1) ? ('' . $premium . '') : ($premium == 0 ? "" : '' . $premium . '') ); + $temp_data .= (($gst_forself != 0 && count($item) != 1) ? ('' . $gst_forself . '') : ($gst_forself == 0 ? "" : '' . $gst_forself . '') ); + + }else{ + + $temp_data .= (($si != 0 && count($item) != 1) ? ('' . $si . '') : ($si == 0 ? "" : '' . $si . '') ); + $temp_data .= '' . $premium . ''; + $temp_data .= '' . $gst_forself . ''; + } + + $self_si_amount = 0; + $self_premium = 0; + $self_gst = 0; + } + }else{ + $temp_data .= '' . $si . ''; } @@ -451,8 +456,12 @@ class sendMailNotification $table_content .= 'Relation'; $table_content .= 'Date Of Birth'; $table_content .= 'Sum Insured'; - $table_content .= 'Premium'; - $table_content .= 'GST'; + + // Premium summery for show and hide the Additional premium data + if($client_policy_data['is_premium_summery'] == 1){ + $table_content .= 'Premium'; + $table_content .= 'GST'; + } $table_content .= ''; $table_content .= ''; @@ -461,13 +470,15 @@ class sendMailNotification $table_content .= '' . $temp_data . ''; $table_content .= '

'; - - $addon_list_array = [ - 'policy_name' => $policy_name_for_policy_type . '( Payable By Employee )', - 'addtional_premium' => round($addtional_premium), - 'gst' => round($gst) - ]; - $Addon_list[] = $addon_list_array; + // Premium summery for show and hide the Additional premium data + if($client_policy_data['is_premium_summery'] == 1){ + $addon_list_array = [ + 'policy_name' => $policy_name_for_policy_type . '( Payable By Employee )', + 'addtional_premium' => round($addtional_premium), + 'gst' => round($gst) + ]; + $Addon_list[] = $addon_list_array; + } $temp_data = ''; @@ -525,10 +536,7 @@ class sendMailNotification // print_r($mail_content); die; - // $mail = "aadhavanvalli@gmail.com"; - // if (isset($mail) && !empty($mail)) { - $wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to'], 'common' => $common]; - // } + $wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to'], 'common' => $common]; return $wholeData; diff --git a/app/Models/ClientPolicyModel.php b/app/Models/ClientPolicyModel.php index 552b3f9..22b8921 100755 --- a/app/Models/ClientPolicyModel.php +++ b/app/Models/ClientPolicyModel.php @@ -55,6 +55,7 @@ class ClientPolicyModel extends Model "cd_ac_pk", "is_auto_si", "is_lgbtq", + "is_premium_summery", ]; // Callbacks 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 diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php index c3bc46d..a337d23 100755 --- a/app/Views/client_policy.php +++ b/app/Views/client_policy.php @@ -184,14 +184,14 @@ id="disclaimer">
- +