CHANGES_in GPA attached EDLIPolicy and GTLIPolicy : GWM

This commit is contained in:
bitbucket 2024-08-02 11:21:45 +05:30
parent 5063b86fc5
commit f5be85a3fa

View File

@ -1003,6 +1003,10 @@ class EmployeeRestController extends AdminController
// Filter employee data where the family_floater_key is 'self'
$selfData = array_filter($empData, fn($arr) => trim(strtolower($arr['family_floater_key'])) === 'self');
$employee_policy = $this->employeePolicyModel->where('employee_id',$selfData[0]['id'])->where('client_policy_id',$array->ClientPolicyId)->where('is_active', 1 )->get()->getRow();
$policyTypeData = $this->policyTypeModel->where('id',$array->ClientPolicyId)->get()->getRow();
$array->type = $policyTypeData->policy_type;
$array->Policy_Name = $policyTypeData->long_name;
$self['is_value_exist'] = true;
$self['data']['family_floater_key'] = 'self';
@ -1015,6 +1019,17 @@ class EmployeeRestController extends AdminController
$self['data']['basic_cover_si'] = $employee_policy->basic_cover_si;
$array->mapped_family_floaters = $self;
$res = [];
array_push($res,$array);
$EDLIPolicy = $this->getAdditionalGPAPolicy($employeeData,6,$emp_code,$client_id,$client_branch_id);
if($EDLIPolicy){ array_push($res,$EDLIPolicy); }
$GTLIPolicy = $this->getAdditionalGPAPolicy($employeeData,7,$emp_code,$client_id,$client_branch_id);
if($GTLIPolicy){ array_push($res,$GTLIPolicy); }
return $this->respond(['status' => 'success','code' => 200,'data' => $res ], 200);
// Return result
if($this->request->getGet('policy') == 'GPA')
@ -1328,6 +1343,70 @@ class EmployeeRestController extends AdminController
}
public function getAdditionalGPAPolicy($empData,$policy_type,$emp_code,$client_id,$client_branch_id)
{
$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')
->where('client_policy.policy_type_id', $policy_type )
->where('client_policy.is_addon', 1 )
->where('client_policy.client_id', $client_id )
->where('client_policy.client_branch_id', $client_branch_id )
->where('client_policy.is_active', 1 )
->get()
->getResult();
if($checkPolicyExist){
foreach ($checkPolicyExist as $key => $array) {
$decodedArray = json_decode($array->Policy_Terms);
$array->Policy_Terms = $decodedArray;
// Filter employee data where the family_floater_key is 'self'
$selfData = array_filter($empData, fn($arr) => trim(strtolower($arr['family_floater_key'])) === 'self');
$employee_policy = $this->employeePolicyModel->where('employee_id',$selfData[0]['id'])->where('client_policy_id',$array->ClientPolicyId)->where('is_active', 1 )->get()->getRow();
$policyTypeData = $this->policyTypeModel->where('id',$policy_type)->get()->getRow();
$array->type = $policyTypeData->policy_type;
$array->Policy_Name = $policyTypeData->long_name;
if($employee_policy){
if($employee_policy->tpa_id != null){
$array->eCardDownload = base_url('download-e-card/') . $employee_policy->rand_string;
}else{ $array->eCardDownload = null; }
$self['is_value_exist'] = true;
$self['data']['family_floater_key'] = 'self';
$self['data']['employee_id'] = $selfData[0]['id'];
$self['data']['relationship'] = 'Self';
$self['data']['name'] = $selfData[0]['name'];
$self['data']['dob'] = $this->convertDateFormatDMY($selfData[0]['dob']);
$self['data']['mobile'] = $selfData[0]['mobile'];
$self['data']['client_policy_id'] = $array->ClientPolicyId;
$self['data']['basic_cover_si'] = $employee_policy->basic_cover_si;
$array->mapped_family_floaters = $self;
if($array->enrolment_visibility == 1)
return $array;
else
return false;
}else{
return false;
}
}
}
}
public function getGTLIPolicy($empData,$emp_code,$client_id,$client_branch_id)
{
}
public function FloterConvertion($array){
$result = [];
@ -1934,8 +2013,8 @@ class EmployeeRestController extends AdminController
$data['balance'] = count($data['depositData']) ? $data['depositData'][0]->balance : 0;
$data['policyDetails'] = [];
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.id as client_policy_id , client_policy.client_id as client_id, policies.id as policy_id , client_policy.policy_type_id as policy_type_id, policies.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 ')
->join('policies', 'client_policy.policy_id = policies.id', 'left')
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.id as client_policy_id , client_policy.client_id as client_id, 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 ')
->where('client_policy.insurer_id', $value['insurerId'] )
->where('client_policy.client_id', $this->request->getGet('client_id') )
->where('client_policy.client_branch_id', $this->request->getGet('client_branch_id') )
@ -1945,8 +2024,9 @@ class EmployeeRestController extends AdminController
// dd( $ClientPolicyData);
foreach ($ClientPolicyData as $key => $value)
{
$value['type'] = $this->policyTypeModel->where('id',$value['policy_type_id'])->get()->getRow()->policy_type;
$policyTypeData = $this->policyTypeModel->where('id',$value['policy_type_id'])->get()->getRow();
$value['type'] = $policyTypeData->policy_type;
$value['policy_name'] = $policyTypeData->long_name;
$employeeDetails = $this->employeePolicyModel->getEmployeePolicy( client_id:$value['client_id'],policy_id: $value['client_policy_id'],status:0,branch_id:$this->request->getGet('client_branch_id'));
$enrolledCount = 0;
$draftCount = 0;