MERGE_TEST_DISPLAY_PRE_SUMMARY_ENABLED

This commit is contained in:
Ubuntu 2025-05-07 20:16:56 +05:30
commit 91709c0657
9 changed files with 244 additions and 88 deletions

View File

@ -500,3 +500,6 @@ $routes->cli("cli/sendCroneRemainderMail", "DashboardController::sendCroneRemain
$routes->get('enrollOpendAndClose', 'DashboardController::updatePolicyEnrollmentStatus'); $routes->get('enrollOpendAndClose', 'DashboardController::updatePolicyEnrollmentStatus');
$routes->get("sendCroneRemainderMail", "DashboardController::sendCroneRemainderMail"); $routes->get("sendCroneRemainderMail", "DashboardController::sendCroneRemainderMail");
$routes->get("getEmployeePolicy", "EmployeeRestController::getEmployeePolicy");
$routes->get("getAddOnPolicy", "EmployeeRestController::getAddOnPolicy");

View File

@ -1069,6 +1069,7 @@ class ClientController extends AdminController
$data['is_member_modify_allowed'] = $this->request->getPost('is_member_modify_allowed') ? 1 : 0; $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['enrolment_visibility'] = $this->request->getPost('enrolment_visibility') ? 1 : 0;
$data['is_lgbtq'] = $this->request->getPost('is_lgbtq') ? 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) { 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['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_member_modify_allowed'] = $this->request->getPost('is_member_modify_allowed') ? 1 : 0;
$data['is_lgbtq'] = $this->request->getPost('is_lgbtq') ? 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) { if ($data['inception_type'] == 2) {
$data['open_date'] = change_date_format($this->request->getPost('open_date'), 'd-m-Y', 'Y-m-d'); $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 $emp_count = $this->employeePolicyModel
->join('client_policy cp', "cp.id = employee_polices.client_policy_id") ->join('client_policy cp', "cp.id = employee_polices.client_policy_id")
->where("employee_polices.client_policy_id", $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) ->where("employee_polices.is_active", 1)
->countAllResults(); ->countAllResults();
@ -2455,7 +2457,7 @@ class ClientController extends AdminController
$emp_count_by_policy = $this->employeePolicyModel $emp_count_by_policy = $this->employeePolicyModel
->where('client_policy_id', $client_policy_id) ->where('client_policy_id', $client_policy_id)
->where("status", 'active') ->whereIn("status", ['draft', 'enrolled'])
->where('is_active', 1) ->where('is_active', 1)
->countAllResults(); ->countAllResults();
@ -4571,7 +4573,8 @@ class ClientController extends AdminController
// $empRest = new EmployeeRestController(); // $empRest = new EmployeeRestController();
// $empRest->calculatePremium(393, 'ARCPO7010', 500000, 27); // // $empRest->calculatePremium(399, 'ZOHO7105', 500000, 145);
// $empRest->updatePremiumAmount(399, 'ZOHO7105', 145);
} }
// ------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------

View File

@ -380,7 +380,7 @@ class EmployeeRestController extends AdminController
->where('client_policy_id',$value['policy_details']['client_policy_id'] ) ->where('client_policy_id',$value['policy_details']['client_policy_id'] )
->where('employee_id' , $value['temp']['emp_id'] ) ->where('employee_id' , $value['temp']['emp_id'] )
->where('is_active', 1 ) ->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(); ->update();
} }
@ -1158,8 +1158,14 @@ class EmployeeRestController extends AdminController
$array->mapped_family_floaters = $self; $array->mapped_family_floaters = $self;
$array->type = 'GPA'; $array->type = 'GPA';
$array->si_value = $si_value; $array->si_value = $si_value;
if($array->is_premium_summery == 1){
$array->si_premium_value = $si_premium_value; $array->si_premium_value = $si_premium_value;
$array->si_gst_value = $si_gst_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->mapped_family_floaters = $data;
$array->type = "GMC"; $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_value = $dependent_and_si_value > 0 ? $dependent_and_si_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_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; $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') $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') ->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->mapped_family_floaters = $data;
$array->type = "GMC - Parents"; $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_value = $dependent_and_si_value > 0 ? $dependent_and_si_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_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; $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; 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) 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.policy_type_id', $policy_type )
->where('client_policy.is_addon', 1 ) ->where('client_policy.is_addon', 1 )
->where('client_policy.client_id', $client_id ) ->where('client_policy.client_id', $client_id )
@ -1545,8 +1561,13 @@ class EmployeeRestController extends AdminController
$array->type = $policyTypeData->policy_type; $array->type = $policyTypeData->policy_type;
$array->Policy_Name = $policyTypeData->long_name; $array->Policy_Name = $policyTypeData->long_name;
$array->si_value = $si_value; $array->si_value = $si_value;
$array->si_premium_value = $si_premium_value; if($array->is_premium_summery == 1){
$array->si_gst_value = $si_gst_value; $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){ if($employee_policy){
@ -1812,6 +1833,7 @@ class EmployeeRestController extends AdminController
$responce['policy_type_id'] = $array['policy_type_id']; $responce['policy_type_id'] = $array['policy_type_id'];
//$responce['is_member_modify_allowed'] = $array['is_member_modify_allowed']; //$responce['is_member_modify_allowed'] = $array['is_member_modify_allowed'];
$responce['disclaimer'] = $array['disclaimer']; $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') $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') ->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_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_value'] = $dependent_and_si_value > 0 ? $dependent_and_si_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_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; $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_array'] = $only_si_array;
$responce['family_floaters_of_only_si_value'] = $only_si_value; $responce['family_floaters_of_only_si_value'] = $only_si_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_premium_value'] = round($only_si_premium_value);
$responce['family_floaters_of_only_si_gst_value'] = $only_si_gst_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'){ 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_array'] = $only_si_array;
$responce['family_floaters_of_only_si_value'] = $only_si_value; $responce['family_floaters_of_only_si_value'] = $only_si_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_premium_value'] = round($only_si_premium_value);
$responce['family_floaters_of_only_si_gst_value'] = round($only_si_gst_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'){ if($this->request->getGet('policy') == 'GMC-SI-PARENT-TOPUP'){
@ -2234,14 +2274,12 @@ class EmployeeRestController extends AdminController
helper('excel_util_helper'); helper('excel_util_helper');
if($this->request){ // if($this->request){ //
echo 'request';
$client_policy_id = $this->request->getVar('client_policy_id') ?? $clientPolicyId; $client_policy_id = $this->request->getVar('client_policy_id') ?? $clientPolicyId;
$emp_code = $this->request->getVar('emp_code') ?? $empCode; $emp_code = $this->request->getVar('emp_code') ?? $empCode;
$default_si = $this->request->getVar('si') ?? $default_si;// si amt which choosed in add on policy $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; $client_branch_id = $this->request->getVar('client_branch_id') ?? $client_branch_id;
}else{ }else{
//Cli and enrollment //Cli and enrollment
echo 'internal';
$client_policy_id = $clientPolicyId; $client_policy_id = $clientPolicyId;
$emp_code = $empCode; $emp_code = $empCode;
$default_si = $default_si;// si amt which choosed in add on policy $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']['rata_premimum'] = 0;
$value['policy_details']['premium'] = 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']['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){ if(strtolower($value['relationship']) == 'spouse' && $policyTermsJson['is_payable_employee']['spouse'] == 0){
$value['policy_details']['rata_premimum'] = 0; $value['policy_details']['rata_premimum'] = 0;
$value['policy_details']['premium'] = 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){ if((strtolower($value['relationship']) == 'son' || strtolower($value['relationship']) == 'daughter') && $policyTermsJson['is_payable_employee']['childern'] == 0){
$value['policy_details']['rata_premimum'] = 0; $value['policy_details']['rata_premimum'] = 0;
$value['policy_details']['premium'] = 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){ 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']['rata_premimum'] = 0;
$value['policy_details']['premium'] = 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(); // die();
if($clientPolicyId != null && $empCode != null) if($clientPolicyId != null && $empCode != null)
{ // dd ($employee_data_group_by_family); {
// dd ($employee_data_group_by_family);
return $employee_data_group_by_family; return $employee_data_group_by_family;
}else{ }else{
// dd ($employee_data_group_by_family); // dd ($employee_data_group_by_family);

View File

@ -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 $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(); // kint::dump($family);//die();
$firstNonTemp = null;
foreach ($family as $fam) {
if (!isset($fam['temp'])) {
$firstNonTemp = $fam;
break;
}
}
//check name dup within a family //check name dup within a family
if($file['action'] == 'inception' || $file['action'] == 'missed_inception' || $file['action'] == 'addition' || $file['action'] == 'dependent_addition' || $file['action'] == 'enrollment') 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)) if(!count($self_details))
{ {
array_push($result['error_summary'],14); // Self not found 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";
} }
} }

View File

@ -444,6 +444,18 @@ if (!function_exists('name_dup_check_within_family'))
if(in_array($row[2],$temp)) if(in_array($row[2],$temp))
{ {
array_push($result,$row[0]); 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 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)) 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_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; $allowed_parent_in_laws_count = $temp['either-parents-pil'] == 0 ? $temp['parents-in-law'] : 0;
// dd($allowed_adults == 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) foreach ($family_data as $key => $row)
{ {
// dd($family_data[0][0]); // dd($family_data[0][0]);
@ -580,7 +610,7 @@ if (!function_exists('check_dependent_conflict'))
if($relationship == 'self') if($relationship == 'self')
{ {
$self_gender = $row[4]; $self_gender = $row[4];
$self_emp_row_id = $row[0]; $self_emp_row_id = isset($row['temp']) ? null : $row[0];
} }
if($relationship == 'spouse') if($relationship == 'spouse')
{ {
@ -613,7 +643,7 @@ if (!function_exists('check_dependent_conflict'))
if(is_array($repeated_count) && count($repeated_count)) if(is_array($repeated_count) && count($repeated_count))
{ {
$result['status'] = false; $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); // print_r($repeated_count);
@ -629,26 +659,26 @@ if (!function_exists('check_dependent_conflict'))
if($self_gender && $spouse_gender && $self_gender == $spouse_gender) if($self_gender && $spouse_gender && $self_gender == $spouse_gender)
{ {
$result['status'] = false; $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) ) if(($allowed_spouse_count < $received_spouse_count) || ($allowed_child_count < $received_child_count) )
{ {
$result['status'] = false; $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) // || ($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 ) if($allowed_adults == 1 && $received_parents_count && $received_parent_in_laws_count )
{ {
$result['status'] = false; $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)) if((2 < $received_parents_count) || (2 < $received_parent_in_laws_count))
{ {
$result['status'] = false; $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 //check for any cross parents but not more than two
@ -656,7 +686,7 @@ if (!function_exists('check_dependent_conflict'))
{ {
// dd($allowed_adults); // dd($allowed_adults);
$result['status'] = false; $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
} }

View File

@ -239,8 +239,6 @@ class sendMailNotification
$premium = ''; $premium = '';
$gst_forself = ''; $gst_forself = '';
// if(checkFamilyFloaters($policy_premium_data, $client_policy_data, $inner_item)){
if($policy_premium_data['premium_type'] == 2){ if($policy_premium_data['premium_type'] == 2){
$si = '₹ ' .format_indian_number($inner_item['basic_cover_si']); $si = '₹ ' .format_indian_number($inner_item['basic_cover_si']);
}else{ }else{
@ -252,9 +250,11 @@ class sendMailNotification
empty($inner_item['basic_cover_si']) ? $si = 0 : $si = '₹ ' .format_indian_number($inner_item['basic_cover_si']); 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'])); $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 .= '<tr>'; $temp_data .= '<tr>';
$temp_data .= '<td>' . $inner_item['name'] . ($inner_item['relationship'] == 'Self' ? ' (' . $inner_item['emp_code'] . ')' : '') . '</td>'; $temp_data .= '<td>' . $inner_item['name'] . ($inner_item['relationship'] == 'Self' ? ' (' . $inner_item['emp_code'] . ')' : '') . '</td>';
@ -268,7 +268,7 @@ class sendMailNotification
if ($si != 0 && count($item) != 1 && $is_si_set == 0) { if ($si != 0 && count($item) != 1 && $is_si_set == 0) {
$temp_data .= '<td rowspan=' . $rowspan . '>' . $si . '</td>'; $temp_data .= '<td style="vertical-align: middle !important;" rowspan=' . $rowspan . '>' . $si . '</td>';
$is_si_set = 1; $is_si_set = 1;
} else { } else {
@ -284,7 +284,7 @@ class sendMailNotification
} }
// Only Display SI Topup and Dependent Addon // 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 .= '<td>' . $premium . '</td>'; $temp_data .= '<td>' . $premium . '</td>';
$temp_data .= '<td>' . $gst_forself . '</td>'; $temp_data .= '<td>' . $gst_forself . '</td>';
} }
@ -316,7 +316,7 @@ class sendMailNotification
$table_content .= '<th>Sum Insured</th>'; $table_content .= '<th>Sum Insured</th>';
// Only Display SI Topup and Dependent Addon // 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 .= '<th>Premium</th>'; $table_content .= '<th>Premium</th>';
$table_content .= '<th>GST</th>'; $table_content .= '<th>GST</th>';
} }
@ -328,7 +328,7 @@ class sendMailNotification
$table_content .= '<tbody style="text-align: center;">' . $temp_data . '</tbody>'; $table_content .= '<tbody style="text-align: center;">' . $temp_data . '</tbody>';
$table_content .= '</table></div>'; $table_content .= '</table></div>';
if ($is_addon == 2 || $is_addon == 3) { if (($is_addon == 2 || $is_addon == 3) && $client_policy_data['is_premium_summery'] == 1) {
$addon_list_array = [ $addon_list_array = [
'policy_name' => $policy_name_for_policy_type, 'policy_name' => $policy_name_for_policy_type,
'addtional_premium' => round($addtional_premium), 'addtional_premium' => round($addtional_premium),
@ -345,7 +345,7 @@ class sendMailNotification
// dd($payable_employee_array); // dd($payable_employee_array);
// dd(count($payable_employee_array['emp_data'])); // 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 .= '<div style="text-align: left; font-size: 12px;"><div style="text-align:left;"><h4>Policy Type :'; $table_content .= '<div style="text-align: left; font-size: 12px;"><div style="text-align:left;"><h4>Policy Type :';
$temp_data = ''; $temp_data = '';
@ -401,6 +401,8 @@ class sendMailNotification
// dd($si); // dd($si);
// 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){ if($policy_premium_data['premium_type'] == 2){
$temp_data .= '<td>' . $si . '</td>'; $temp_data .= '<td>' . $si . '</td>';
@ -411,13 +413,13 @@ class sendMailNotification
if($policy_premium_data['premium_type'] == 1){ if($policy_premium_data['premium_type'] == 1){
$temp_data .= (($si != 0 && count($item) != 1) ? ('<td rowspan='.$rowspan.'>' . $si . '</td>') : ($si == 0 ? "" : '<td>' . $si . '</td>') ); $temp_data .= (($si != 0 && count($item) != 1) ? ('<td style="vertical-align: middle !important;" rowspan='.$rowspan.'>' . $si . '</td>') : ($si == 0 ? "" : '<td>' . $si . '</td>') );
$temp_data .= (($premium != 0 && count($item) != 1) ? ('<td rowspan='.$rowspan.'>' . $premium . '</td>') : ($premium == 0 ? "" : '<td>' . $premium . '</td>') ); $temp_data .= (($premium != 0 && count($item) != 1) ? ('<td style="vertical-align: middle !important;" rowspan='.$rowspan.'>' . $premium . '</td>') : ($premium == 0 ? "" : '<td>' . $premium . '</td>') );
$temp_data .= (($gst_forself != 0 && count($item) != 1) ? ('<td rowspan='.$rowspan.'>' . $gst_forself . '</td>') : ($gst_forself == 0 ? "" : '<td>' . $gst_forself . '</td>') ); $temp_data .= (($gst_forself != 0 && count($item) != 1) ? ('<td style="vertical-align: middle !important;" rowspan='.$rowspan.'>' . $gst_forself . '</td>') : ($gst_forself == 0 ? "" : '<td>' . $gst_forself . '</td>') );
}else{ }else{
$temp_data .= (($si != 0 && count($item) != 1) ? ('<td rowspan='.$rowspan.'>' . $si . '</td>') : ($si == 0 ? "" : '<td>' . $si . '</td>') ); $temp_data .= (($si != 0 && count($item) != 1) ? ('<td style="vertical-align: middle !important;" rowspan='.$rowspan.'>' . $si . '</td>') : ($si == 0 ? "" : '<td>' . $si . '</td>') );
$temp_data .= '<td>' . $premium . '</td>'; $temp_data .= '<td>' . $premium . '</td>';
$temp_data .= '<td>' . $gst_forself . '</td>'; $temp_data .= '<td>' . $gst_forself . '</td>';
} }
@ -426,6 +428,9 @@ class sendMailNotification
$self_premium = 0; $self_premium = 0;
$self_gst = 0; $self_gst = 0;
} }
}else{
$temp_data .= '<td>' . $si . '</td>';
}
$temp_data .= '</tr>'; $temp_data .= '</tr>';
@ -451,8 +456,12 @@ class sendMailNotification
$table_content .= '<th>Relation</th>'; $table_content .= '<th>Relation</th>';
$table_content .= '<th style="width:15%">Date Of Birth</th>'; $table_content .= '<th style="width:15%">Date Of Birth</th>';
$table_content .= '<th>Sum Insured</th>'; $table_content .= '<th>Sum Insured</th>';
// Premium summery for show and hide the Additional premium data
if($client_policy_data['is_premium_summery'] == 1){
$table_content .= '<th>Premium</th>'; $table_content .= '<th>Premium</th>';
$table_content .= '<th>GST</th>'; $table_content .= '<th>GST</th>';
}
$table_content .= '</tr>'; $table_content .= '</tr>';
$table_content .= '</thead>'; $table_content .= '</thead>';
@ -461,13 +470,15 @@ class sendMailNotification
$table_content .= '<tbody style="text-align: center;">' . $temp_data . '</tbody>'; $table_content .= '<tbody style="text-align: center;">' . $temp_data . '</tbody>';
$table_content .= '</table></div>'; $table_content .= '</table></div>';
// Premium summery for show and hide the Additional premium data
if($client_policy_data['is_premium_summery'] == 1){
$addon_list_array = [ $addon_list_array = [
'policy_name' => $policy_name_for_policy_type . '( Payable By Employee )', 'policy_name' => $policy_name_for_policy_type . '( Payable By Employee )',
'addtional_premium' => round($addtional_premium), 'addtional_premium' => round($addtional_premium),
'gst' => round($gst) 'gst' => round($gst)
]; ];
$Addon_list[] = $addon_list_array; $Addon_list[] = $addon_list_array;
}
$temp_data = ''; $temp_data = '';
@ -525,10 +536,7 @@ class sendMailNotification
// print_r($mail_content); die; // 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; return $wholeData;

View File

@ -55,6 +55,7 @@ class ClientPolicyModel extends Model
"cd_ac_pk", "cd_ac_pk",
"is_auto_si", "is_auto_si",
"is_lgbtq", "is_lgbtq",
"is_premium_summery",
]; ];
// Callbacks // Callbacks

View File

@ -155,6 +155,7 @@ class EmployeeModel extends Model
client_policy.client_id as ClientId, client_policy.client_id as ClientId,
client_policy.policy_id as PolicyId, client_policy.policy_id as PolicyId,
client_policy.id as ClientPolicyId, client_policy.id as ClientPolicyId,
client_policy.is_premium_summery,
CASE CASE
WHEN client_policy.open_for_enrollment IS NULL THEN 0 WHEN client_policy.open_for_enrollment IS NULL THEN 0
ELSE client_policy.open_for_enrollment ELSE client_policy.open_for_enrollment

View File

@ -184,14 +184,14 @@
id="disclaimer"></textarea> id="disclaimer"></textarea>
</div> </div>
<!-- <div class="form-group col-md-4"> <div class="form-group col-md-4">
<label class="switch" style="position: relative;top: 43px;left: 20px;"> <label class="switch" style="position: relative;top: 43px;left: 20px;">
<input id="policy_visibility" type="checkbox" name="enrolment_visibility" checked> <input id="policy_visibility" type="checkbox" name="enrolment_visibility" checked>
<span class="slider round" style="height: 27px;"></span> <span class="slider round" style="height: 27px;"></span>
</label> </label>
<label for="policy_visibility" style="position: relative;bottom: 5px;left: 85px;">Policy Visibilty in Enrollment App</label> <label for="policy_visibility" style="position: relative;bottom: 5px;left: 85px;">Policy Visibilty in Enrollment App</label>
</div> --> </div>
<!-- <div class="form-group col-md-4"> <!-- <div class="form-group col-md-4">
<label class="switch" style="position: relative;top: 43px;left: 20px;"> <label class="switch" style="position: relative;top: 43px;left: 20px;">
@ -210,6 +210,16 @@
<label for="is_lgbtq" style="position: relative;bottom: 5px;left: 85px;"> Is LGBTQ Enable</label> <label for="is_lgbtq" style="position: relative;bottom: 5px;left: 85px;"> Is LGBTQ Enable</label>
</div> </div>
<div class="form-group col-md-4">
<label class="switch" style="position: relative;top: 43px;left: 20px;">
<input id="is_premium_summery" type="checkbox" name="is_premium_summery">
<span class="slider round" style="height: 27px;"></span>
</label>
<label for="is_premium_summery" style="position: relative;bottom: 5px;left: 85px;"> Is Premium Summery Enable</label>
</div>
</div> </div>
<div id="policy_fields"></div> <div id="policy_fields"></div>
@ -889,6 +899,12 @@ $('body').on('click', '.btnPolicyEdit', function() {
$('#is_lgbtq').prop('checked', false); $('#is_lgbtq').prop('checked', false);
} }
if (res.data.is_premium_summery == 1) {
$('#is_premium_summery').prop('checked', true);
} else {
$('#is_premium_summery').prop('checked', false);
}
// Member Modify Data Enable or Disable // Member Modify Data Enable or Disable
// if (res.data.is_member_modify_allowed == 1) { // if (res.data.is_member_modify_allowed == 1) {
// $('#is_member_modify_allowed').prop('checked', true); // $('#is_member_modify_allowed').prop('checked', true);
@ -1956,6 +1972,12 @@ function getClientPolicyDataForEdit(client_policy_id) {
$('#is_lgbtq').prop('checked', false); $('#is_lgbtq').prop('checked', false);
} }
if (res.data.is_premium_summery == 1) {
$('#is_premium_summery').prop('checked', true);
} else {
$('#is_premium_summery').prop('checked', false);
}
if (res.data.policy_type_id == '4' || res.data.policy_type_id == '5') { if (res.data.policy_type_id == '4' || res.data.policy_type_id == '5') {
$('#base_policy_id').show(); $('#base_policy_id').show();