Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
aad0be5912
@ -271,6 +271,8 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
|||||||
$routes->get("removeEmpAndEmpPolicyData", "EmployeeRestController::removeEmpAndEmpPolicyData");
|
$routes->get("removeEmpAndEmpPolicyData", "EmployeeRestController::removeEmpAndEmpPolicyData");
|
||||||
|
|
||||||
$routes->post("calculatePremium", "EmployeeRestController::calculatePremium");
|
$routes->post("calculatePremium", "EmployeeRestController::calculatePremium");
|
||||||
|
|
||||||
|
$routes->get("getEmployeeOldPolicy", "EmployeeRestController::getEmployeeOldPolicy");
|
||||||
});
|
});
|
||||||
|
|
||||||
$routes->post("sendEmail", "EmployeeRestController::send_email");
|
$routes->post("sendEmail", "EmployeeRestController::send_email");
|
||||||
|
|||||||
@ -19,6 +19,7 @@ use App\Models\FileModel;
|
|||||||
use App\Models\ClientPolicyModel;
|
use App\Models\ClientPolicyModel;
|
||||||
use App\Models\PolicyPremium1Model;
|
use App\Models\PolicyPremium1Model;
|
||||||
use App\Models\PolicyPremium2Model;
|
use App\Models\PolicyPremium2Model;
|
||||||
|
use App\Models\PolicyTypeModel;
|
||||||
|
|
||||||
use App\Controllers\Jobs ;
|
use App\Controllers\Jobs ;
|
||||||
use App\Controllers\JobWorker ;
|
use App\Controllers\JobWorker ;
|
||||||
@ -47,6 +48,7 @@ class EmployeeRestController extends AdminController
|
|||||||
protected $clientPolicyModel;
|
protected $clientPolicyModel;
|
||||||
protected $policyPremium1Model;
|
protected $policyPremium1Model;
|
||||||
protected $policyPremium2Model;
|
protected $policyPremium2Model;
|
||||||
|
protected $policyTypeModel;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@ -62,6 +64,7 @@ class EmployeeRestController extends AdminController
|
|||||||
$this->clientPolicyModel = new ClientPolicyModel();
|
$this->clientPolicyModel = new ClientPolicyModel();
|
||||||
$this->policyPremium1Model = new PolicyPremium1Model();
|
$this->policyPremium1Model = new PolicyPremium1Model();
|
||||||
$this->policyPremium2Model = new PolicyPremium2Model();
|
$this->policyPremium2Model = new PolicyPremium2Model();
|
||||||
|
$this->policyTypeModel = new PolicyTypeModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -518,134 +521,7 @@ class EmployeeRestController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// public function getEmployeePolicy()
|
|
||||||
// {
|
|
||||||
// try {
|
|
||||||
// $id = $this->request->getGet('id');
|
|
||||||
// $emp_code = $this->request->getGet('emp_code');
|
|
||||||
|
|
||||||
// $keysToRemove = ["removable_keys"];
|
|
||||||
|
|
||||||
// $empPolicy = $this->employeeModel->getEmployeePolicy($id);
|
|
||||||
|
|
||||||
// $empData = $this->employeeModel->where('emp_code',$emp_code)->findAll();
|
|
||||||
// if ($empPolicy) {
|
|
||||||
|
|
||||||
// $result = [];
|
|
||||||
// foreach ($empPolicy as $array) {
|
|
||||||
|
|
||||||
// $decodedArray = json_decode($array->Policy_Terms);
|
|
||||||
// $refusingData = (object) array_diff_key((array) $decodedArray, array_flip($keysToRemove));
|
|
||||||
|
|
||||||
|
|
||||||
// $array->Policy_Terms = $refusingData;
|
|
||||||
// $getSlabAndGridData = $this->policesModel->getPolicySlabRatesForEmpOnboard($array->ClientPolicyId,$array->ClientId);
|
|
||||||
// $array->SlabRates = $getSlabAndGridData['slab_rates'];
|
|
||||||
// $array->GridMaster = $getSlabAndGridData['grid_master'];
|
|
||||||
|
|
||||||
// if($getSlabAndGridData['grid_master']['policy_type'] == "GPA"){
|
|
||||||
// $default_si = $array->Policy_Terms->sumInsured2;
|
|
||||||
// $index = -1;
|
|
||||||
// foreach ($array->SlabRates as $key => $value) {
|
|
||||||
// if ($value['si'] == $default_si) {
|
|
||||||
// $index = $key;
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// if ($index >= 0) {
|
|
||||||
// $element =$array->SlabRates[$index];
|
|
||||||
// array_splice($array->SlabRates, $index, 1);
|
|
||||||
// array_unshift($array->SlabRates, $element);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// $employee_policy = $this->employeePolicyModel->where('employee_id',$id)->where('client_policy_id',$array->ClientPolicyId)->get()->getRow();
|
|
||||||
// if($employee_policy){
|
|
||||||
// $gpaSI['family_floater_key'] = 'self';
|
|
||||||
// $gpaSI['label'] = 'Self';
|
|
||||||
// $gpaSI['employee_id'] = $employee_policy->employee_id;
|
|
||||||
// $gpaSI['basic_cover_si'] = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : null;
|
|
||||||
// $gpaSI['premium'] = isset($employee_policy->premium) ? $employee_policy->premium : null;
|
|
||||||
// $gpaSI['client_policy_id'] = $array->ClientPolicyId;
|
|
||||||
|
|
||||||
// $array->mapped_family_floaters = $gpaSI;
|
|
||||||
// }else{
|
|
||||||
// $gpaSI['family_floater_key'] = 'self';
|
|
||||||
// $gpaSI['label'] = 'Self';
|
|
||||||
// $gpaSI['employee_id'] = $id;
|
|
||||||
// $gpaSI['basic_cover_si'] = null;
|
|
||||||
// $gpaSI['premium'] = null;
|
|
||||||
// $gpaSI['client_policy_id'] = $array->ClientPolicyId;
|
|
||||||
|
|
||||||
// $array->mapped_family_floaters = $gpaSI;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// }else if($getSlabAndGridData['grid_master']['policy_type'] == "GMC"){
|
|
||||||
|
|
||||||
// // re-arranging order of si
|
|
||||||
// $default_si = $array->Policy_Terms->sum_insured;
|
|
||||||
// // Filter the array using the callback function
|
|
||||||
// $getPremium = array_filter($array->SlabRates , function ($value) use ($default_si) { return $value['si'] == $default_si; } );
|
|
||||||
// $default_premium = $getPremium[0]['premium'];
|
|
||||||
|
|
||||||
// $index = -1;
|
|
||||||
// foreach ($array->SlabRates as $key => $value) {
|
|
||||||
// if ($value['si'] == $default_si) {
|
|
||||||
// $index = $key;
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// if ($index >= 0) {
|
|
||||||
// $element =$array->SlabRates[$index];
|
|
||||||
// array_splice($array->SlabRates, $index, 1);
|
|
||||||
// array_unshift($array->SlabRates, $element);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// //map family floates array to employee and dependent
|
|
||||||
// $familyFloates = $array->Policy_Terms->family_floaters;
|
|
||||||
// $data = [];
|
|
||||||
// foreach ($familyFloates as $familyFloatesValue) {
|
|
||||||
// $dependent = preg_replace('/\d/', '', $familyFloatesValue);
|
|
||||||
// if(count($empData)){
|
|
||||||
// foreach ($empData as $key => $value) {
|
|
||||||
// if ($value['family_floater_key'] === $dependent) {
|
|
||||||
// $employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array->ClientPolicyId)->get()->getRow();
|
|
||||||
// $temp['family_floater_key'] = $familyFloatesValue;
|
|
||||||
// $temp['label'] = $value['relationship'];
|
|
||||||
// $temp['name'] = $value['name'];
|
|
||||||
// $temp['employee_id'] = $value['id'];
|
|
||||||
// $temp['basic_cover_si'] = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : null;
|
|
||||||
// $temp['premium'] = isset($employee_policy->premium) ? $employee_policy->premium : null;
|
|
||||||
// $temp['client_policy_id'] = $array->ClientPolicyId;
|
|
||||||
// array_push($data,$temp);
|
|
||||||
// unset($empData[$key]);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// $array->mapped_family_floaters = $data;
|
|
||||||
|
|
||||||
// $temp2=[];
|
|
||||||
// foreach ($array->SlabRates as $key => $value) {
|
|
||||||
// $value['additional_premium'] = $value['premium'] - $default_premium;
|
|
||||||
// array_push($temp2,$value);
|
|
||||||
// }
|
|
||||||
// $array->SlabRates = $temp2;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
// $result[] = $array;
|
|
||||||
// }
|
|
||||||
// return $this->respond(['status' => 'success','code' => 200,'data' => $result], 200);
|
|
||||||
// }else{
|
|
||||||
// return $this->respond(['status' => 'failed','code' => 404,'data' => []], 404);
|
|
||||||
// }
|
|
||||||
// } catch (\Exception $e) {
|
|
||||||
// return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Get the RelationShip list
|
// Get the RelationShip list
|
||||||
|
|
||||||
@ -1029,7 +905,7 @@ class EmployeeRestController extends AdminController
|
|||||||
|
|
||||||
public function getEmployeePolicy()
|
public function getEmployeePolicy()
|
||||||
{
|
{
|
||||||
// try {
|
try {
|
||||||
|
|
||||||
$id = $this->request->getGet('id');
|
$id = $this->request->getGet('id');
|
||||||
$emp_code = $this->request->getGet('emp_code');
|
$emp_code = $this->request->getGet('emp_code');
|
||||||
@ -1170,11 +1046,25 @@ public function getEmployeePolicy()
|
|||||||
}
|
}
|
||||||
|
|
||||||
$array->mapped_family_floaters = $data;
|
$array->mapped_family_floaters = $data;
|
||||||
|
$array->type = "Group Medical Coverage";
|
||||||
|
|
||||||
|
$checkGmcParentsPolicyExist = $this->clientPolicyModel->select('client_policy.id as ClientPolicyId , client_policy.client_id as ClientId, policies.id as PolicyId , 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 , client_policy.policy_terms as Policy_Terms')
|
||||||
|
->join('policies', 'client_policy.policy_id = policies.id', 'left')
|
||||||
|
->where('client_policy.policy_type_id', 3 )
|
||||||
|
->where('client_policy.is_addon', 1 )
|
||||||
|
->where('client_policy.client_id', $this->request->getGet('client_id') )
|
||||||
|
->where('client_policy.is_active', 1 )
|
||||||
|
->get()
|
||||||
|
->getResult();
|
||||||
|
if($checkGmcParentsPolicyExist)
|
||||||
|
{
|
||||||
|
$GmcParrentsData = $this->getGmcParrentsPolicy($checkGmcParentsPolicyExist,$emp_code,$client_id);
|
||||||
|
return $this->respond(['status' => 'success','code' => 200,'data' => [$array,$GmcParrentsData]], 200);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if($this->request->getGet('policy') == 'GMC'){
|
if($this->request->getGet('policy') == 'GMC'){
|
||||||
return $this->respond(['status' => 'success','code' => 200,'data' => $array], 200);
|
return $this->respond(['status' => 'success','code' => 200,'data' => [$array]], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1188,11 +1078,139 @@ public function getEmployeePolicy()
|
|||||||
}else{
|
}else{
|
||||||
return $this->respond(['status' => 'failed','code' => 404,'data' => []], 200);
|
return $this->respond(['status' => 'failed','code' => 404,'data' => []], 200);
|
||||||
}
|
}
|
||||||
// } catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
// return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
|
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getGmcParrentsPolicy($GmcParrentsPolicy,$emp_code,$client_id)
|
||||||
|
{
|
||||||
|
|
||||||
|
$employeeData = $this->employeeModel->where('emp_code',$emp_code)->where('client_id',$client_id)
|
||||||
|
->where('is_active', 1 )->where('is_addon_value',0)->findAll();
|
||||||
|
foreach ($GmcParrentsPolicy as $key => $array) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Reset employee array
|
||||||
|
$empData = $employeeData;
|
||||||
|
|
||||||
|
|
||||||
|
$array->Policy_Terms = json_decode($array->Policy_Terms);
|
||||||
|
|
||||||
|
|
||||||
|
// Retrieve slab rate and grid master data by passing the ClientPolicyId and ClientId
|
||||||
|
$getSlabAndGridData = $this->policesModel->getPolicySlabRatesForEmpOnboard($array->ClientPolicyId,$array->ClientId);
|
||||||
|
$array->SlabRates = $getSlabAndGridData['slab_rates'];
|
||||||
|
$array->GridMaster = $getSlabAndGridData['grid_master'];
|
||||||
|
|
||||||
|
$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')
|
||||||
|
->where('employees.emp_code',$emp_code)
|
||||||
|
->where('employees.is_active',1)
|
||||||
|
->where('employee_polices.client_policy_id',$array->ClientPolicyId)
|
||||||
|
->get()
|
||||||
|
->getResult();
|
||||||
|
|
||||||
|
if(count($tpaArray))
|
||||||
|
{
|
||||||
|
|
||||||
|
if($tpaArray[0]->tpa_id != null)
|
||||||
|
$array->eCardDownload = base_url('download-e-card/') . $tpaArray[0]->rand_string;
|
||||||
|
else
|
||||||
|
$array->eCardDownload = null;
|
||||||
|
|
||||||
|
}else{
|
||||||
|
$array->eCardDownload = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if($array->tpa_id != null){
|
||||||
|
// $array->eCardDownload = base_url('download-e-card/') . $array->rand_string;
|
||||||
|
// }else{ $array->eCardDownload = null; }
|
||||||
|
$array->eCardDownload = null;
|
||||||
|
|
||||||
|
// Map family floaters that already exist in the employee table
|
||||||
|
$familyFloates = $array->Policy_Terms->family_floaters;
|
||||||
|
|
||||||
|
// Generate Notes string based on familyFloates terms
|
||||||
|
$array->notes = $this->FloterNotesConvertion($familyFloates);
|
||||||
|
|
||||||
|
if($getSlabAndGridData['slab_rates'][0]['premium_type'] == 1)
|
||||||
|
{
|
||||||
|
$array->floter_text_heading = 'Floater Sum Insured';
|
||||||
|
$array->floter_text_description = 'This is a floater sum insured. A floater is a type of sum insured that provides coverage to more than one member ot a family at the same time. Simply put, its a single insurance cover for the entire family.';
|
||||||
|
}else{
|
||||||
|
$array->floter_text_heading = 'Sum Insured';
|
||||||
|
$array->floter_text_description = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert familyFloaters terms data to plain array
|
||||||
|
$floters = $this->FloterConvertion($familyFloates);
|
||||||
|
|
||||||
|
$data = [];
|
||||||
|
foreach ($floters as $familyFloatesValue) {
|
||||||
|
$dependent = preg_replace('/\d/', '', $familyFloatesValue);
|
||||||
|
if(count($empData)){
|
||||||
|
foreach ($empData as $key => $value) {
|
||||||
|
if ($value['family_floater_key'] === $dependent) {
|
||||||
|
$temp['is_value_exist'] = true;
|
||||||
|
$temp['data']['family_floater_key'] = $familyFloatesValue;
|
||||||
|
$temp['data']['employee_id'] = $value['id'];
|
||||||
|
$temp['data']['relationship'] = $value['relationship'];
|
||||||
|
$temp['data']['name'] = $value['name'];
|
||||||
|
$temp['data']['dob'] = $this->convertDateFormatDMY($value['dob']);
|
||||||
|
$temp['data']['client_policy_id'] = $array->ClientPolicyId;
|
||||||
|
$temp['data']['form_type'] = $dependent;
|
||||||
|
array_push($data,$temp);
|
||||||
|
unset($empData[$key]);
|
||||||
|
$floters = array_diff($floters, [$familyFloatesValue]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove Unwanted floter key from floters array based on either-parents-pil term value
|
||||||
|
if($familyFloates->{'either-parents-pil'} == 1 && count($floters))
|
||||||
|
{
|
||||||
|
$count_parent = 0;
|
||||||
|
$count_parent_in_law = 0;
|
||||||
|
foreach ($floters as $value) {
|
||||||
|
if (preg_replace('/\d/', '', $value) == 'parent') { $count_parent++; }
|
||||||
|
if (preg_replace('/\d/', '', $value) == 'parent_in_law') {$count_parent_in_law++;}
|
||||||
|
}
|
||||||
|
if($count_parent != 2) {
|
||||||
|
$floters = array_filter($floters, fn($value) => strpos($value, 'parent_in_law') === false);
|
||||||
|
}
|
||||||
|
if($count_parent_in_law != 2) {
|
||||||
|
$floters = array_filter($floters, fn($value) => strpos($value, 'parent') === false || strpos($value, 'parent_in_law') !== false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add family floter buttons placement data for FE validation
|
||||||
|
if(count($floters)){
|
||||||
|
foreach ($floters as $familyFloatesValue) {
|
||||||
|
|
||||||
|
$temp2['is_value_exist'] = false;
|
||||||
|
$temp2['data']['family_floater_key'] = $familyFloatesValue;
|
||||||
|
$temp2['data']['client_policy_id'] = $array->ClientPolicyId;
|
||||||
|
$temp2['data']['button_name'] = 'Add '.ucfirst(str_replace('_', ' ', preg_replace('/\d/', '', $familyFloatesValue)));
|
||||||
|
$temp2['data']['form_type'] = preg_replace('/\d/', '', $familyFloatesValue);
|
||||||
|
|
||||||
|
array_push($data,$temp2);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$array->mapped_family_floaters = $data;
|
||||||
|
$array->type = "Group Medical Coverage - Parents";
|
||||||
|
|
||||||
|
return $array;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
public function FloterConvertion($array){
|
public function FloterConvertion($array){
|
||||||
|
|
||||||
$result = [];
|
$result = [];
|
||||||
@ -1226,7 +1244,7 @@ public function FloterConvertion($array){
|
|||||||
|
|
||||||
public function FloterNotesConvertion($array){
|
public function FloterNotesConvertion($array){
|
||||||
|
|
||||||
$result = 'Can Add Self ';
|
$result = ' ';
|
||||||
foreach ($array as $key => $value) {
|
foreach ($array as $key => $value) {
|
||||||
if ($value > 0) {
|
if ($value > 0) {
|
||||||
if($value != 0 && $key ==='either-parents-pil') {
|
if($value != 0 && $key ==='either-parents-pil') {
|
||||||
@ -1236,6 +1254,7 @@ public function FloterNotesConvertion($array){
|
|||||||
$string = ucwords($string);
|
$string = ucwords($string);
|
||||||
$result .= ' + '.$string;
|
$result .= ' + '.$string;
|
||||||
}else if($value != 0 && $key ==='self') {
|
}else if($value != 0 && $key ==='self') {
|
||||||
|
$result = 'Can Add Self ';
|
||||||
}else if($value != 0 && $key ==='childrens') {
|
}else if($value != 0 && $key ==='childrens') {
|
||||||
if($value > 1){ $result .= ' + '.$value.' Children'; }else{ $result .= ' + '.$value.' Child'; }
|
if($value > 1){ $result .= ' + '.$value.' Children'; }else{ $result .= ' + '.$value.' Child'; }
|
||||||
}else{
|
}else{
|
||||||
@ -1278,7 +1297,7 @@ public function getAddOnPolicy()
|
|||||||
$clientPolicy = $this->clientPolicyModel->where('client_id',$this->request->getGet('client_id'))
|
$clientPolicy = $this->clientPolicyModel->where('client_id',$this->request->getGet('client_id'))
|
||||||
->where('policy_status', 1)
|
->where('policy_status', 1)
|
||||||
->findAll();
|
->findAll();
|
||||||
// dd( $clientPolicy);
|
|
||||||
if(count($clientPolicy))
|
if(count($clientPolicy))
|
||||||
{
|
{
|
||||||
$PolicyData = [];
|
$PolicyData = [];
|
||||||
@ -1297,6 +1316,7 @@ public function getAddOnPolicy()
|
|||||||
$responce['is_addon'] = $array['is_addon'];
|
$responce['is_addon'] = $array['is_addon'];
|
||||||
$responce['OpenForEnrollment'] = $array['open_for_enrollment'];
|
$responce['OpenForEnrollment'] = $array['open_for_enrollment'];
|
||||||
$responce['policy_terms'] = $decodedArray;
|
$responce['policy_terms'] = $decodedArray;
|
||||||
|
$responce['policy_type_id'] = $array['policy_type_id'];
|
||||||
|
|
||||||
$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')
|
||||||
@ -1327,7 +1347,7 @@ public function getAddOnPolicy()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if($array['is_addon'] == 3)//dependent add on policy
|
if($array['is_addon'] == 3 && $array['policy_type_id'] == 3)//dependent add on policy
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
@ -1438,9 +1458,17 @@ public function getAddOnPolicy()
|
|||||||
|
|
||||||
//array_push($PolicyData, $responce);
|
//array_push($PolicyData, $responce);
|
||||||
|
|
||||||
}else if($array['is_addon'] == 2)//Topup policy
|
}else if($array['is_addon'] == 2 && $array['policy_type_id'] == 4)//Topup policy
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$whereArray = [];
|
||||||
|
foreach ( $decodedArray->family_floaters as $key => $value) {
|
||||||
|
if($value != 0){
|
||||||
|
if($key == 'parents'){ $text = 'parent'; }else if($key == 'childrens'){ $text = 'child'; }else{ $text = $key; }
|
||||||
|
array_push($whereArray,$text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$getAddOnType = $this->clientPolicyModel->where('id',$array['base_policy'])->where('policy_status', 1)->get()->getRow();
|
$getAddOnType = $this->clientPolicyModel->where('id',$array['base_policy'])->where('policy_status', 1)->get()->getRow();
|
||||||
$basePolicyAddOnType = $getAddOnType->is_addon;
|
$basePolicyAddOnType = $getAddOnType->is_addon;
|
||||||
@ -1450,7 +1478,7 @@ public function getAddOnPolicy()
|
|||||||
$only_si_value = 0;
|
$only_si_value = 0;
|
||||||
$only_si_premium_value = 0;
|
$only_si_premium_value = 0;
|
||||||
$only_si_gst_value = 0;
|
$only_si_gst_value = 0;
|
||||||
$BasePolicyEmployeeData = $this->employeeModel->where('is_active', 1 )->where('emp_code',$this->request->getGet('emp_code'))->where('client_id',$this->request->getGet('client_id'))->where('is_addon_value',$is_addon_value)->findAll();
|
$BasePolicyEmployeeData = $this->employeeModel->where('is_active', 1 )->where('emp_code',$this->request->getGet('emp_code'))->where('client_id',$this->request->getGet('client_id'))->where('is_addon_value',$is_addon_value)->whereIn('family_floater_key',$whereArray)->findAll();
|
||||||
foreach ($BasePolicyEmployeeData as $key => $value) {
|
foreach ($BasePolicyEmployeeData as $key => $value) {
|
||||||
|
|
||||||
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array['id'])->where('is_active', 1 )->get()->getRow();
|
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array['id'])->where('is_active', 1 )->get()->getRow();
|
||||||
@ -1473,12 +1501,62 @@ public function getAddOnPolicy()
|
|||||||
$responce['family_floaters_of_only_si_value'] = $only_si_value;
|
$responce['family_floaters_of_only_si_value'] = $only_si_value;
|
||||||
$responce['family_floaters_of_only_si_premium_value'] = $only_si_premium_value;
|
$responce['family_floaters_of_only_si_premium_value'] = $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;
|
||||||
|
$responce['type'] = "Group Medical Coverage - Top Up";
|
||||||
|
|
||||||
if($this->request->getGet('policy') == 'GMC-SI-TOPUP'){
|
if($this->request->getGet('policy') == 'GMC-SI-TOPUP'){
|
||||||
return $this->respond(['status' => 'success','code' => 200,'data' => ['gmc_si_topup'=>$responce]], 200);
|
return $this->respond(['status' => 'success','code' => 200,'data' => ['gmc_si_topup'=>$responce]], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}else if($array['is_addon'] == 2 && $array['policy_type_id'] == 5)//Parents Topup policy
|
||||||
|
{
|
||||||
|
|
||||||
|
$whereArray = [];
|
||||||
|
foreach ( $decodedArray->family_floaters as $key => $value) {
|
||||||
|
if($value != 0){
|
||||||
|
if($key == 'parents'){ $text = 'parent'; }else if($key == 'childrens'){ $text = 'child'; }else{ $text = $key; }
|
||||||
|
array_push($whereArray,$text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$getAddOnType = $this->clientPolicyModel->where('id',$array['base_policy'])->where('policy_status', 1)->get()->getRow();
|
||||||
|
$basePolicyAddOnType = $getAddOnType->is_addon;
|
||||||
|
// if is_addon value is 1 it is GMC if not it is one of the Add On policy
|
||||||
|
if($basePolicyAddOnType == 1){ $is_addon_value = 0; }else{ $is_addon_value = 1; }
|
||||||
|
$only_si_array = [];
|
||||||
|
$only_si_value = 0;
|
||||||
|
$only_si_premium_value = 0;
|
||||||
|
$only_si_gst_value = 0;
|
||||||
|
$BasePolicyEmployeeData = $this->employeeModel->where('is_active', 1 )->where('emp_code',$this->request->getGet('emp_code'))->where('client_id',$this->request->getGet('client_id'))->where('is_addon_value',$is_addon_value)->whereIn('family_floater_key',$whereArray)->findAll();
|
||||||
|
foreach ($BasePolicyEmployeeData as $key => $value) {
|
||||||
|
|
||||||
|
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array['id'])->where('is_active', 1 )->get()->getRow();
|
||||||
|
if(isset($employee_policy->basic_cover_si)){ $only_si_value = $employee_policy->basic_cover_si; }
|
||||||
|
if(isset($employee_policy->premium)){ $only_si_premium_value = $only_si_premium_value + $employee_policy->premium;}
|
||||||
|
if(isset($employee_policy->gst)){ $only_si_gst_value = $only_si_gst_value + $employee_policy->gst;}
|
||||||
|
$temp3['is_value_exist'] = true;
|
||||||
|
$temp3['data']['employee_id'] = $value['id'];
|
||||||
|
$temp3['data']['relationship'] = $value['relationship'];
|
||||||
|
$temp3['data']['name'] = $value['name'];
|
||||||
|
$temp3['data']['dob'] = $this->convertDateFormatDMY($value['dob']);
|
||||||
|
$temp3['data']['client_policy_id'] = $array['id'];
|
||||||
|
$temp3['data']['basic_cover_si'] = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : null;
|
||||||
|
$temp3['data']['premium'] = isset($employee_policy->premium) ? $employee_policy->premium : null;
|
||||||
|
array_push($only_si_array,$temp3);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$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'] = $only_si_premium_value;
|
||||||
|
$responce['family_floaters_of_only_si_gst_value'] = $only_si_gst_value;
|
||||||
|
$responce['type'] = "Group Medical Coverage - Parents Top Up";
|
||||||
|
|
||||||
|
if($this->request->getGet('policy') == 'GMC-SI-PARENT-TOPUP'){
|
||||||
|
return $this->respond(['status' => 'success','code' => 200,'data' => ['gmc_si_parent_topup'=>$responce]], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1590,6 +1668,7 @@ public function getCashDepositData()
|
|||||||
->join('insurers', 'client_policy.insurer_id = insurers.id', 'left')
|
->join('insurers', 'client_policy.insurer_id = insurers.id', 'left')
|
||||||
->where('client_policy.client_id', $this->request->getGet('client_id') )
|
->where('client_policy.client_id', $this->request->getGet('client_id') )
|
||||||
->where('client_policy.is_active', 1 )
|
->where('client_policy.is_active', 1 )
|
||||||
|
->where('client_policy.policy_status', 1)
|
||||||
->groupBy('client_policy.insurer_id')
|
->groupBy('client_policy.insurer_id')
|
||||||
->findAll();
|
->findAll();
|
||||||
$result = [];
|
$result = [];
|
||||||
@ -1605,17 +1684,18 @@ public function getCashDepositData()
|
|||||||
$data['balance'] = count($data['depositData']) ? $data['depositData'][0]->balance : 0;
|
$data['balance'] = count($data['depositData']) ? $data['depositData'][0]->balance : 0;
|
||||||
|
|
||||||
$data['policyDetails'] = [];
|
$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,policies.policy_type_id as policy_type_id, policies.name as policy_name , client_policy.is_addon as is_addon')
|
$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')
|
->join('policies', 'client_policy.policy_id = policies.id', 'left')
|
||||||
->where('client_policy.insurer_id', $value['insurerId'] )
|
->where('client_policy.insurer_id', $value['insurerId'] )
|
||||||
->where('client_policy.client_id', $this->request->getGet('client_id') )
|
->where('client_policy.client_id', $this->request->getGet('client_id') )
|
||||||
->where('client_policy.is_active', 1 )
|
->where('client_policy.is_active', 1 )
|
||||||
|
->where('client_policy.policy_status', 1)
|
||||||
->findAll();
|
->findAll();
|
||||||
|
// dd( $ClientPolicyData);
|
||||||
foreach ($ClientPolicyData as $key => $value)
|
foreach ($ClientPolicyData as $key => $value)
|
||||||
{
|
{
|
||||||
echo $value['client_policy_id'];
|
|
||||||
$getSlabAndGridData = $this->policesModel->getPolicySlabRatesForEmpOnboard( $value['client_policy_id'],$value['client_id']);
|
$value['type'] = $this->policyTypeModel->where('id',$value['policy_type_id'])->get()->getRow()->policy_type;
|
||||||
if($value['is_addon'] == "2"){ $value['type'] = 'SI TopUp'; }else if($value['is_addon'] == "3"){ $value['type'] = 'Dependent AddOn'; }else{ $value['type'] = $getSlabAndGridData['grid_master']['policy_type']; }
|
|
||||||
$employeeDetails = $this->employeePolicyModel->getEmployeePolicy( client_id:$value['client_id'],policy_id: $value['client_policy_id'],status:0);
|
$employeeDetails = $this->employeePolicyModel->getEmployeePolicy( client_id:$value['client_id'],policy_id: $value['client_policy_id'],status:0);
|
||||||
$enrolledCount = 0;
|
$enrolledCount = 0;
|
||||||
$draftCount = 0;
|
$draftCount = 0;
|
||||||
@ -1778,7 +1858,7 @@ public function removeEmpAndEmpPolicyData()
|
|||||||
return $this->respond(['status' => 'success','code' => 200,'data' =>[] ], 200);
|
return $this->respond(['status' => 'success','code' => 200,'data' =>[] ], 200);
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
return $this->respond(['status' => 'failed','code' => 404,'data' => [] ], 404);
|
return $this->respond(['status' => 'failed','code' => 404,'data' => [] ], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1790,4 +1870,64 @@ public function removeEmpAndEmpPolicyData()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function getEmployeeOldPolicy()
|
||||||
|
{
|
||||||
|
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.* , policies.name as policy_name , policy_type.policy_type as policy_type')
|
||||||
|
->join('policies', 'client_policy.policy_id = policies.id', 'left')
|
||||||
|
->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left')
|
||||||
|
->where('client_policy.client_id', $this->request->getGet('client_id') )
|
||||||
|
->where('client_policy.is_active', 1 )
|
||||||
|
->where('client_policy.policy_status', 0)
|
||||||
|
->orderby('client_policy.id' , 'ASC')
|
||||||
|
->findAll();
|
||||||
|
|
||||||
|
// Retrieve employee and dependents data by passing the employee code
|
||||||
|
$employeeData = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code'))
|
||||||
|
->where('client_id',$this->request->getGet('client_id'))
|
||||||
|
->where('is_active', 1 )->findAll();
|
||||||
|
$whereArrayForId = [];
|
||||||
|
foreach ( $employeeData as $key => $value) { array_push($whereArrayForId, $value['id']); }
|
||||||
|
|
||||||
|
if(count($ClientPolicyData) > 0 && count($employeeData) > 0)
|
||||||
|
{
|
||||||
|
$result = [];
|
||||||
|
foreach ($ClientPolicyData as $key => $ClientPolicyValue) {
|
||||||
|
|
||||||
|
$data['client_id'] = $ClientPolicyValue['client_id'];
|
||||||
|
$data['client_policy_id'] = $ClientPolicyValue['id'];
|
||||||
|
$data['policy_name'] = $ClientPolicyValue['policy_name'];
|
||||||
|
$data['policy_type'] = $ClientPolicyValue['policy_type'];
|
||||||
|
$data['policy_type'] = $ClientPolicyValue['policy_type'];
|
||||||
|
|
||||||
|
$employee_policy = $this->employeePolicyModel->select('employees.*,employee_polices.employee_id , employee_polices.basic_cover_si , employee_polices.premium , employee_polices.gst , employee_polices.tpa_id , employee_polices.rand_string')
|
||||||
|
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
|
||||||
|
->whereIn('employee_polices.employee_id',$whereArrayForId)
|
||||||
|
->where('employee_polices.client_policy_id',$ClientPolicyValue['id'])
|
||||||
|
->where('employee_polices.is_active', 1 )->findAll();
|
||||||
|
$si_value = 0;
|
||||||
|
$si_premium_value = 0;
|
||||||
|
$si_gst_value = 0;
|
||||||
|
foreach ($employee_policy as $key => $value) {
|
||||||
|
if(isset($value['basic_cover_si'])){ $si_value = $value['basic_cover_si']; }
|
||||||
|
if(isset($value['premium'])){ $si_premium_value = $si_premium_value + $value['premium'];}
|
||||||
|
if(isset($value['gst'])){ $si_gst_value = $si_gst_value + $value['gst'];}
|
||||||
|
}
|
||||||
|
|
||||||
|
$data['si_value'] = $si_value;
|
||||||
|
$data['si_premium_value'] = ($ClientPolicyValue['policy_type_id'] == 1 || $ClientPolicyValue['policy_type_id'] == 2) ? 0 : $si_premium_value;
|
||||||
|
$data['si_gst_value'] = ($ClientPolicyValue['policy_type_id'] == 1 || $ClientPolicyValue['policy_type_id'] == 2) ? 0 : $si_gst_value;
|
||||||
|
|
||||||
|
$data['EmployeePolicy'] = $employee_policy;
|
||||||
|
array_push($result, $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->respond(['status' => 'success','code' => 200,'data' => $result ], 200);
|
||||||
|
|
||||||
|
}else{
|
||||||
|
return $this->respond(['status' => 'failed','code' => 404,'data' => [] ], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -36,7 +36,8 @@ class EmployeeModel extends Model
|
|||||||
"updated_at",
|
"updated_at",
|
||||||
"is_active",
|
"is_active",
|
||||||
"file_id",
|
"file_id",
|
||||||
"is_addon_value"
|
"is_addon_value",
|
||||||
|
"is_createdby_hr"
|
||||||
];
|
];
|
||||||
|
|
||||||
// Callbacks
|
// Callbacks
|
||||||
|
|||||||
@ -607,7 +607,7 @@
|
|||||||
$currentUrl = base_url();
|
$currentUrl = base_url();
|
||||||
$parsedUrl = parse_url($currentUrl);
|
$parsedUrl = parse_url($currentUrl);
|
||||||
$baseUrl = $parsedUrl['scheme'] . '://' . $parsedUrl['host'] . '/';
|
$baseUrl = $parsedUrl['scheme'] . '://' . $parsedUrl['host'] . '/';
|
||||||
$redirectUrl = $baseUrl . 'Ticketing/nhance_login?' . http_build_query(['token' => $sessionData]);
|
$redirectUrl = $baseUrl . 'Ticketing/staff/login?' . http_build_query(['token' => $sessionData]);
|
||||||
?>
|
?>
|
||||||
<a href="<?php echo $redirectUrl; ?>" target="_blank">
|
<a href="<?php echo $redirectUrl; ?>" target="_blank">
|
||||||
<i class="mdi mdi-lifebuoy"></i>
|
<i class="mdi mdi-lifebuoy"></i>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user