MERGE_CODE_MERGE : RV
This commit is contained in:
commit
953283d3f4
@ -223,7 +223,7 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
||||
|
||||
$routes->cli('cli/processjob', 'JobWorker::processJob');
|
||||
$routes->cli('cli/processjobs', 'JobWorker::processJobs');
|
||||
|
||||
$routes->get("processjob", "JobWorker::processJob");
|
||||
|
||||
|
||||
//Employee login api's
|
||||
@ -270,6 +270,10 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
||||
$routes->get("exportCashDepositData", "EmployeeRestController::exportCashDepositData");
|
||||
|
||||
$routes->get("removeEmpAndEmpPolicyData", "EmployeeRestController::removeEmpAndEmpPolicyData");
|
||||
|
||||
$routes->post("calculatePremium", "EmployeeRestController::calculatePremium");
|
||||
|
||||
$routes->get("getEmployeeOldPolicy", "EmployeeRestController::getEmployeeOldPolicy");
|
||||
});
|
||||
|
||||
$routes->post("sendEmail", "EmployeeRestController::send_email");
|
||||
|
||||
@ -1221,7 +1221,8 @@ class ClientController extends AdminController
|
||||
public function policyGMCTerms()
|
||||
{
|
||||
try {
|
||||
// print_r($this->request->getPost('family_floaters'));die;
|
||||
// echo "<pre>";
|
||||
// print_r($this->request->getPost());die;
|
||||
$this->myLogger->logme('error','Terms CREATE function called');
|
||||
|
||||
/*** Client Policy Table Primary Key(ID) ***/
|
||||
@ -1230,7 +1231,19 @@ class ClientController extends AdminController
|
||||
$data['sum_insured'] =str_replace(',', '',$this->request->getPost("sum_insured"));
|
||||
$data['family_floater'] =$this->request->getPost("family_floater");
|
||||
$data['corporatebuffer'] = $this->request->getPost("corporatebuffer");
|
||||
$data['family_floaters'] = $this->request->getPost("family_floaters") ?? [];
|
||||
$data['family_floaters'] = $this->request->getPost("family_floaters") ?? [];
|
||||
|
||||
// print_r($this->request->getPost());die;
|
||||
$data['age_ratio']['self']['min'] = $this->request->getPost("self_min_age");
|
||||
$data['age_ratio']['self']['max'] = $this->request->getPost("self_max_age");
|
||||
$data['age_ratio']['spouse']['min'] = $this->request->getPost("spouse_min_age");
|
||||
$data['age_ratio']['spouse']['max'] = $this->request->getPost("spouse_max_age");
|
||||
$data['age_ratio']['child']['min'] = $this->request->getPost("child_min_age");
|
||||
$data['age_ratio']['child']['max'] = $this->request->getPost("child_max_age");
|
||||
$data['age_ratio']['elders']['min'] = $this->request->getPost("other_member_min_age");
|
||||
$data['age_ratio']['elders']['max'] = $this->request->getPost("other_member_max_age");
|
||||
|
||||
|
||||
|
||||
// if (!in_array("self", $data['family_floaters'])) {
|
||||
// array_unshift($data['family_floaters'], "self");
|
||||
@ -1301,7 +1314,8 @@ class ClientController extends AdminController
|
||||
$data['family_floaters']['either-parents-pil'] =0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$data['family_floaters']['elders_count'] =$this->request->getPost("member_count");
|
||||
|
||||
$data['waiverofpreexistingdiseases'] =$this->request->getPost("waiverofpreexistingdiseases");
|
||||
if ($data['waiverofpreexistingdiseases'] == 1) {
|
||||
@ -1419,6 +1433,8 @@ class ClientController extends AdminController
|
||||
|
||||
$data['sumInsured2'] =str_replace(',', '', $this->request->getPost("sumInsured2"));
|
||||
$data['totalSumInsured'] =str_replace(',', '',$this->request->getPost("totalSumInsured"));
|
||||
$data['age_ratio']['self']['min'] = $this->request->getPost("self_min_age");
|
||||
$data['age_ratio']['self']['max'] = $this->request->getPost("self_max_age");
|
||||
$data['accidentalDeathBenefit'] =str_replace(',', '',$this->request->getPost("accidentalDeathBenefit"));
|
||||
$data['permanentTotalDisablement'] =str_replace(',', '',$this->request->getPost("permanentTotalDisablement"));
|
||||
$data['permanentPartialDisablement'] =$this->request->getPost("permanentPartialDisablement");
|
||||
|
||||
@ -19,6 +19,7 @@ use App\Models\FileModel;
|
||||
use App\Models\ClientPolicyModel;
|
||||
use App\Models\PolicyPremium1Model;
|
||||
use App\Models\PolicyPremium2Model;
|
||||
use App\Models\PolicyTypeModel;
|
||||
|
||||
use App\Controllers\Jobs ;
|
||||
use App\Controllers\JobWorker ;
|
||||
@ -47,6 +48,7 @@ class EmployeeRestController extends AdminController
|
||||
protected $clientPolicyModel;
|
||||
protected $policyPremium1Model;
|
||||
protected $policyPremium2Model;
|
||||
protected $policyTypeModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -62,6 +64,7 @@ class EmployeeRestController extends AdminController
|
||||
$this->clientPolicyModel = new ClientPolicyModel();
|
||||
$this->policyPremium1Model = new PolicyPremium1Model();
|
||||
$this->policyPremium2Model = new PolicyPremium2Model();
|
||||
$this->policyTypeModel = new PolicyTypeModel();
|
||||
}
|
||||
|
||||
|
||||
@ -209,13 +212,26 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
if ($Count > 0) {
|
||||
|
||||
if(!isset($data[0]->is_addon_value))
|
||||
if(isset($data[0]->id))
|
||||
{
|
||||
$this->createEmployeePolicyData($employee , $data[0]->emp_code , $data[0]->client_id , $data[0]->client_policy_id);
|
||||
if(!isset($data[0]->is_addon_value))
|
||||
{
|
||||
$this->createEmployeePolicyData($data[0]->id , $data[0]->emp_code , $data[0]->client_id , $data[0]->client_policy_id);
|
||||
}else{
|
||||
$this->createEmployeePolicyData($data[0]->id , $data[0]->emp_code , $data[0]->client_id , $data[0]->client_policy_id , $data[0]->basic_cover_si);
|
||||
}
|
||||
|
||||
}else{
|
||||
$this->createEmployeePolicyData($data[0]->id , $data[0]->emp_code , $data[0]->client_id , $data[0]->client_policy_id , $data[0]->basic_cover_si);
|
||||
if(!isset($data[0]->is_addon_value))
|
||||
{
|
||||
$this->createEmployeePolicyData($employee , $data[0]->emp_code , $data[0]->client_id , $data[0]->client_policy_id);
|
||||
}else{
|
||||
$this->createEmployeePolicyData($employee , $data[0]->emp_code , $data[0]->client_id , $data[0]->client_policy_id , $data[0]->basic_cover_si);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$this->updatePremiumAmount($data[0]->client_policy_id , $data[0]->emp_code);
|
||||
|
||||
@ -505,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
|
||||
|
||||
@ -970,6 +859,7 @@ class EmployeeRestController extends AdminController
|
||||
// $message = 'Dear ' . $dataToInsert[$a]['name'] . ",<br> We are glad to welcome you to the employee benefit program ," .$policy_name['name'] ."offered by your employer, <br><br><br> Click on the link below to review your personal and family details:<br><a href='https://venbait.in/nhance/app/dev'>Review Details</a>" ;
|
||||
$data['employee_name']=$dataToInsert[$a]['name'];
|
||||
$data['policy_name']=$policy['name'];
|
||||
$data['App_Url'] = $_ENV['App_Url'];
|
||||
|
||||
$message = view('mail_welcome', $data);
|
||||
|
||||
@ -1025,10 +915,11 @@ public function getEmployeePolicy()
|
||||
$keysToRemove = ["removable_keys"];
|
||||
// Retrieve employee policy data by passing the employee primary key
|
||||
$empPolicy = $this->employeeModel->getEmployeePolicy($id);
|
||||
|
||||
// Retrieve employee and dependents data by passing the employee code
|
||||
$employeeData = $this->employeeModel->where('emp_code',$emp_code)->where('client_id',$client_id)
|
||||
->where('is_active', 1 )->where('is_addon_value',0)->findAll();
|
||||
// dd($empPolicy);
|
||||
|
||||
|
||||
if ($empPolicy) {
|
||||
|
||||
@ -1036,8 +927,8 @@ public function getEmployeePolicy()
|
||||
foreach ($empPolicy as $array) {
|
||||
// Reset employee array
|
||||
$empData = $employeeData;
|
||||
|
||||
|
||||
|
||||
// Removes specific keys from the decoded array and assigns the result to $refusingData
|
||||
$decodedArray = json_decode($array->Policy_Terms);
|
||||
$refusingData = (object) array_diff_key((array) $decodedArray, array_flip($keysToRemove));
|
||||
@ -1048,12 +939,17 @@ public function getEmployeePolicy()
|
||||
$array->SlabRates = $getSlabAndGridData['slab_rates'];
|
||||
$array->GridMaster = $getSlabAndGridData['grid_master'];
|
||||
|
||||
if($array->tpa_id != null){
|
||||
$array->eCardDownload = base_url('download-e-card/') . $array->rand_string;
|
||||
}else{ $array->eCardDownload = null; }
|
||||
|
||||
|
||||
// Construct value for policy type GPA
|
||||
if($getSlabAndGridData['grid_master']['policy_type'] == "GPA"){
|
||||
|
||||
|
||||
// Filter employee data where the family_floater_key is 'self'
|
||||
$selfData = array_filter($empData, fn($arr) => trim(strtolower($arr['family_floater_key'])) === 'self');
|
||||
|
||||
|
||||
$self['is_value_exist'] = true;
|
||||
$self['data']['family_floater_key'] = 'self';
|
||||
$self['data']['employee_id'] = $id;
|
||||
@ -1075,7 +971,7 @@ public function getEmployeePolicy()
|
||||
}else if($getSlabAndGridData['grid_master']['policy_type'] == "GMC"){
|
||||
|
||||
|
||||
|
||||
|
||||
// Map family floaters that already exist in the employee table
|
||||
$familyFloates = $array->Policy_Terms->family_floaters;
|
||||
|
||||
@ -1150,28 +1046,171 @@ public function getEmployeePolicy()
|
||||
}
|
||||
|
||||
$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'){
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $array], 200);
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => [$array]], 200);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// $result[] = $array;
|
||||
}
|
||||
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => []], 200);
|
||||
|
||||
|
||||
}else{
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => []], 404);
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => []], 200);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
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){
|
||||
|
||||
$result = [];
|
||||
@ -1205,7 +1244,7 @@ public function FloterConvertion($array){
|
||||
|
||||
public function FloterNotesConvertion($array){
|
||||
|
||||
$result = 'Can Add Self ';
|
||||
$result = ' ';
|
||||
foreach ($array as $key => $value) {
|
||||
if ($value > 0) {
|
||||
if($value != 0 && $key ==='either-parents-pil') {
|
||||
@ -1215,6 +1254,7 @@ public function FloterNotesConvertion($array){
|
||||
$string = ucwords($string);
|
||||
$result .= ' + '.$string;
|
||||
}else if($value != 0 && $key ==='self') {
|
||||
$result = 'Can Add Self ';
|
||||
}else if($value != 0 && $key ==='childrens') {
|
||||
if($value > 1){ $result .= ' + '.$value.' Children'; }else{ $result .= ' + '.$value.' Child'; }
|
||||
}else{
|
||||
@ -1251,17 +1291,19 @@ public function getAddOnPolicy()
|
||||
try {
|
||||
|
||||
$addOnEmployeeData = $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',1)->findAll();
|
||||
$GMCEmployeeData = $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',0)->findAll();
|
||||
|
||||
|
||||
|
||||
$clientPolicy = $this->clientPolicyModel->where('client_id',$this->request->getGet('client_id'))->findAll();
|
||||
// dd($clientPolicy);
|
||||
$clientPolicy = $this->clientPolicyModel->where('client_id',$this->request->getGet('client_id'))
|
||||
->where('policy_status', 1)
|
||||
->findAll();
|
||||
|
||||
if(count($clientPolicy))
|
||||
{
|
||||
$PolicyData = [];
|
||||
foreach ($clientPolicy as $key => $array) {
|
||||
$responce = [];
|
||||
|
||||
|
||||
$decodedArray = json_decode($array['policy_terms']);
|
||||
$policy_terms = $decodedArray;
|
||||
$getSlabAndGridData = $this->policesModel->getPolicySlabRatesForEmpOnboard($array['id'],$array['client_id']);
|
||||
@ -1272,8 +1314,28 @@ public function getAddOnPolicy()
|
||||
$responce['client_id'] = $array['client_id'];
|
||||
$responce['client_policy_id'] = $array['id'];
|
||||
$responce['is_addon'] = $array['is_addon'];
|
||||
$responce['open_for_enrollment'] = $array['open_for_enrollment'];
|
||||
$responce['OpenForEnrollment'] = $array['open_for_enrollment'];
|
||||
$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')
|
||||
->join('employee_polices', 'employee_polices.employee_id = employees.id')
|
||||
->where('employees.emp_code',$this->request->getGet('emp_code'))
|
||||
->where('employees.is_active',1)
|
||||
->where('employee_polices.client_policy_id',$array['id'])
|
||||
->get()
|
||||
->getResult();
|
||||
|
||||
if(count($tpaArray))
|
||||
{
|
||||
if($tpaArray[0]->tpa_id != null)
|
||||
$responce['eCardDownload'] = base_url('download-e-card/') . $tpaArray[0]->rand_string;
|
||||
else
|
||||
$responce['eCardDownload'] = null;
|
||||
|
||||
}else{
|
||||
$responce['eCardDownload'] = null;
|
||||
}
|
||||
|
||||
if(count($getSlabAndGridData['slab_rates'])){
|
||||
if($getSlabAndGridData['slab_rates'][0]['premium_type'] == 1)
|
||||
@ -1285,7 +1347,7 @@ public function getAddOnPolicy()
|
||||
}
|
||||
|
||||
|
||||
if($array['is_addon'] == 3)
|
||||
if($array['is_addon'] == 3 && $array['policy_type_id'] == 3)//dependent add on policy
|
||||
{
|
||||
|
||||
|
||||
@ -1395,14 +1457,29 @@ public function getAddOnPolicy()
|
||||
}
|
||||
|
||||
//array_push($PolicyData, $responce);
|
||||
}else if($array['is_addon'] == 2){
|
||||
|
||||
}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();
|
||||
$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;
|
||||
foreach ($GMCEmployeeData as $key => $value) {
|
||||
$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; }
|
||||
@ -1424,12 +1501,62 @@ public function getAddOnPolicy()
|
||||
$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 - Top Up";
|
||||
|
||||
if($this->request->getGet('policy') == 'GMC-SI-TOPUP'){
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -1438,7 +1565,7 @@ public function getAddOnPolicy()
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => []], 200);
|
||||
|
||||
}else{
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => []], 404);
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => []], 200);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
|
||||
@ -1540,6 +1667,8 @@ public function getCashDepositData()
|
||||
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.client_id as clientId , client_policy.insurer_id as insurerId,insurers.name as insurer_name')
|
||||
->join('insurers', 'client_policy.insurer_id = insurers.id', 'left')
|
||||
->where('client_policy.client_id', $this->request->getGet('client_id') )
|
||||
->where('client_policy.is_active', 1 )
|
||||
->where('client_policy.policy_status', 1)
|
||||
->groupBy('client_policy.insurer_id')
|
||||
->findAll();
|
||||
$result = [];
|
||||
@ -1555,15 +1684,18 @@ public function getCashDepositData()
|
||||
$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,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')
|
||||
->where('client_policy.insurer_id', $value['insurerId'] )
|
||||
->where('client_policy.client_id', $this->request->getGet('client_id') )
|
||||
->where('client_policy.is_active', 1 )
|
||||
->where('client_policy.policy_status', 1)
|
||||
->findAll();
|
||||
// dd( $ClientPolicyData);
|
||||
foreach ($ClientPolicyData as $key => $value)
|
||||
{
|
||||
$getSlabAndGridData = $this->policesModel->getPolicySlabRatesForEmpOnboard( $value['client_policy_id'],$value['client_id']);
|
||||
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']; }
|
||||
|
||||
$value['type'] = $this->policyTypeModel->where('id',$value['policy_type_id'])->get()->getRow()->policy_type;
|
||||
$employeeDetails = $this->employeePolicyModel->getEmployeePolicy( client_id:$value['client_id'],policy_id: $value['client_policy_id'],status:0);
|
||||
$enrolledCount = 0;
|
||||
$draftCount = 0;
|
||||
@ -1726,7 +1858,7 @@ public function removeEmpAndEmpPolicyData()
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' =>[] ], 200);
|
||||
|
||||
}else{
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => [] ], 404);
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => [] ], 200);
|
||||
}
|
||||
|
||||
|
||||
@ -1738,4 +1870,93 @@ 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) {
|
||||
|
||||
$terms = json_decode($ClientPolicyValue['policy_terms']);
|
||||
// dd($terms);
|
||||
$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'];
|
||||
$data['policy_start_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['policy_start_date']);
|
||||
$data['policy_end_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['policy_end_date']);
|
||||
|
||||
if($ClientPolicyValue['policy_type_id'] == 1){ $data['heading'] = 'Group Personal Accident Coverage'; }else
|
||||
if($ClientPolicyValue['policy_type_id'] == 2){ $data['heading'] = 'Group Medical Coverage'; }else
|
||||
if($ClientPolicyValue['policy_type_id'] == 3){ $data['heading'] = 'Group Medical Coverage - Parents'; }else
|
||||
if($ClientPolicyValue['policy_type_id'] == 4){ $data['heading'] = 'Group Medical Coverage - Top Up'; }else
|
||||
if($ClientPolicyValue['policy_type_id'] == 5){ $data['heading'] = 'Group Medical Coverage - Parents (Top Up)'; }
|
||||
|
||||
if($ClientPolicyValue['policy_type_id'] == 1){ $data['floter_text_heading'] = 'Sum Insured'; }
|
||||
else
|
||||
{
|
||||
if($terms->family_floater == 1){ $data['floter_text_heading'] = 'Floter Sum Insured'; }else{ $data['floter_text_heading'] = 'Sum Insured'; }
|
||||
}
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private function convertDateFormatDisplay($dateString)
|
||||
{
|
||||
// Attempt to create a DateTime object from the provided date string
|
||||
$dateTime = \DateTime::createFromFormat('Y-m-d', $dateString);
|
||||
|
||||
if ($dateTime instanceof \DateTime) {
|
||||
return $dateTime->format('d-M-Y');
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -34,8 +34,7 @@ class EmployeeServiceController extends AdminController
|
||||
protected $policiesModel;
|
||||
protected $empEndorsementModel;
|
||||
protected $general_relationships = ['self' => ['name' => 'Self', 'gender' => 'M','age_min' => 18,'age_max' => null], 'spouse' => ['name' => 'Spouse', 'gender' => 'F','age_min' => 18,'age_max' => null], 'son' => ['name' => 'Son', 'gender' => 'M','age_min' => null,'age_max' => 25], 'daughter' => ['name' => 'Daughter', 'gender' => 'F','age_min' => null,'age_max' => 25], 'father' => ['name' => 'Father', 'gender' => 'M','age_min' => 18,'age_max' => null], 'mother' => ['name' => 'Mother', 'gender' => 'F','age_min' => 18,'age_max' => null], 'father-in-law' => ['name' => 'Father in Law', 'gender' => 'M','age_min' => 18,'age_max' => null], 'mother-in-law' => ['name' => 'Mother in Law', 'gender' => 'F','age_min' => 18,'age_max' => null]];
|
||||
|
||||
protected $inception_excel_columns = ['sno'=>['col_idx'=>0,'col_cell_name'=>'A','col_name'=>'S.No','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'emp_id'=>['col_idx'=>1,'col_cell_name'=>'B','col_name'=>'EMP ID','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'name_of_emp_dep'=>['col_idx'=>2,'col_cell_name'=>'C','col_name'=>'NAME OF EMP/DEP','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'dob'=>['col_idx'=>3,'col_cell_name'=>'D','col_name'=>'DOB','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null,'custom'=>'check_dob_diff','params'=>['row','relationship']],'gender'=>['col_idx'=>4,'col_cell_name'=>'E','col_name'=>'Gender','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>['M','F']],'relationship'=>['col_idx'=>5,'col_cell_name'=>'F','col_name'=>'RELATIONSHIP','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom'=>'check_relationship','params'=>['row','relationship','policy_terms']],'basic_cover_si'=>['col_idx'=>6,'col_cell_name'=>'G','col_name'=>'BASIC COVER SI','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom' => 'check_si','params' => ['row','policy_terms','slab_details']],'doc'=>['col_idx'=>7,'col_cell_name'=>'H','col_name'=>'Date of Coverage','is_mandatory'=>['A','DA'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null,'params'=>['row']],'doj'=>['col_idx'=>8,'col_cell_name'=>'I','col_name'=>'DOJ','is_mandatory'=>false,'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null,'custom'=>'check_doj','params'=>['row']],'basic_pay'=>['col_idx'=>9,'col_cell_name'=>'J','col_name'=>'Basic Pay','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom'=>'check_basic_pay','params'=>['row','policy_terms','slab_details']],'band_grade'=>['col_idx'=>10,'col_cell_name'=>'K','col_name'=>'Band/Grade','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom'=>'check_employee_band','params'=>['row','policy_terms','slab_details']],'designation'=>['col_idx'=>11,'col_cell_name'=>'L','col_name'=>'Designation','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null],'phone'=>['col_idx'=>12,'col_cell_name'=>'M','col_name'=>'Phone','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null],'email'=>['col_idx'=>13,'col_cell_name'=>'N','col_name'=>'Email','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null],'pre_existing_ailments'=>['col_idx'=>14,'col_cell_name'=>'O','col_name'=>'PRE EXISTING AILMENTS','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>['0','1']],'change_event'=>['col_idx'=>15,'col_cell_name'=>'P','col_name'=>'Change event','is_mandatory'=>['A','DA','D'],'data_type'=>'str','format'=>null,'allowed_values'=>null]];
|
||||
protected $inception_excel_columns = ['sno'=>['col_idx'=>0,'col_cell_name'=>'A','col_name'=>'S.No','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'emp_id'=>['col_idx'=>1,'col_cell_name'=>'B','col_name'=>'EMP ID','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'name_of_emp_dep'=>['col_idx'=>2,'col_cell_name'=>'C','col_name'=>'NAME OF EMP/DEP','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'dob'=>['col_idx'=>3,'col_cell_name'=>'D','col_name'=>'DOB','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null,'custom'=>'check_dob_diff','params'=>['row','relationship','default_age_ratio']],'gender'=>['col_idx'=>4,'col_cell_name'=>'E','col_name'=>'Gender','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>['M','F']],'relationship'=>['col_idx'=>5,'col_cell_name'=>'F','col_name'=>'RELATIONSHIP','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom'=>'check_relationship','params'=>['row','relationship','policy_terms']],'basic_cover_si'=>['col_idx'=>6,'col_cell_name'=>'G','col_name'=>'BASIC COVER SI','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom' => 'check_si','params' => ['row','policy_terms','slab_details']],'doc'=>['col_idx'=>7,'col_cell_name'=>'H','col_name'=>'Date of Coverage','is_mandatory'=>['A','DA'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null,'params'=>['row']],'doj'=>['col_idx'=>8,'col_cell_name'=>'I','col_name'=>'DOJ','is_mandatory'=>false,'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null,'custom'=>'check_doj','params'=>['row']],'basic_pay'=>['col_idx'=>9,'col_cell_name'=>'J','col_name'=>'Basic Pay','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom'=>'check_basic_pay','params'=>['row','policy_terms','slab_details']],'band_grade'=>['col_idx'=>10,'col_cell_name'=>'K','col_name'=>'Band/Grade','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom'=>'check_employee_band','params'=>['row','policy_terms','slab_details']],'designation'=>['col_idx'=>11,'col_cell_name'=>'L','col_name'=>'Designation','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null],'phone'=>['col_idx'=>12,'col_cell_name'=>'M','col_name'=>'Phone','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null],'email'=>['col_idx'=>13,'col_cell_name'=>'N','col_name'=>'Email','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null],'pre_existing_ailments'=>['col_idx'=>14,'col_cell_name'=>'O','col_name'=>'PRE EXISTING AILMENTS','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>['0','1']],'change_event'=>['col_idx'=>15,'col_cell_name'=>'P','col_name'=>'Change event','is_mandatory'=>['A','DA','D'],'data_type'=>'str','format'=>null,'allowed_values'=>null],'date_of_exit'=>['col_idx'=>16,'col_cell_name'=>'Q','col_name'=>'Date of exit','is_mandatory'=>['D'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null],'reason_for_exit'=>['col_idx'=>17,'col_cell_name'=>'R','col_name'=>'Reason for exit','is_mandatory'=>['D'],'data_type'=>'str','format'=>null,'allowed_values'=>null]];
|
||||
|
||||
protected $deletion_excel_columns = ['sno'=>['col_idx'=>0,'col_cell_name'=>'A','col_name'=>'S.No','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'emp_id'=>['col_idx'=>1,'col_cell_name'=>'B','col_name'=>'EMP ID','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'name_of_emp_dep'=>['col_idx'=>2,'col_cell_name'=>'C','col_name'=>'NAME OF EMP/DEP','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'change_event'=>['col_idx'=>3,'col_cell_name'=>'D','col_name'=>'Change event','is_mandatory'=>['D'],'data_type'=>'str','format'=>null,'allowed_values'=>null],'date_of_exit'=>['col_idx'=>4,'col_cell_name'=>'E','col_name'=>'Date of exit','is_mandatory'=>['D'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null],'reason_for_exit'=>['col_idx'=>5,'col_cell_name'=>'F','col_name'=>'Reason for exit','is_mandatory'=>['D'],'data_type'=>'str','format'=>null,'allowed_values'=>null]];
|
||||
|
||||
@ -141,11 +140,12 @@ class EmployeeServiceController extends AdminController
|
||||
// dd($columns_to_check);die();
|
||||
|
||||
// get policy and rack details
|
||||
$policy_terms = $this->clientPolicyModel->getPolicyDetails($file['client_id'],$file['policy_id']);
|
||||
$policy_terms = json_decode($policy_terms[0]->policy_terms);
|
||||
$policy_details = $this->clientPolicyModel->getPolicyDetails($file['client_id'],$file['policy_id']);
|
||||
$policy_terms = json_decode($policy_details[0]->policy_terms);
|
||||
$policy_terms = (array) $policy_terms;// convert obj to array
|
||||
$default_age_ratio = isset($policy_details[0]->age_ratio) ? json_decode($policy_details[0]->age_ratio) : [];
|
||||
//
|
||||
// dd($policy_terms);
|
||||
// dd($default_age_ratio);
|
||||
|
||||
//get policy slab rates
|
||||
$slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($file['policy_id'],$file['client_id']);
|
||||
@ -170,10 +170,12 @@ class EmployeeServiceController extends AdminController
|
||||
{
|
||||
break;
|
||||
}
|
||||
//iterate each row
|
||||
|
||||
//iterate each row for columns validations
|
||||
foreach ($row as $col_key => $col)
|
||||
{
|
||||
|
||||
|
||||
$is_mandatory = $columns_to_check[$keys[$col_key]]['is_mandatory'];
|
||||
$format = $columns_to_check[$keys[$col_key]]['format'];
|
||||
$allowed_values = $columns_to_check[$keys[$col_key]]['allowed_values'];
|
||||
@ -264,19 +266,14 @@ class EmployeeServiceController extends AdminController
|
||||
$result['error_summary'] = array_count_values($result['error_summary']);
|
||||
$status = 'failed';
|
||||
$failure_reason = ((json_encode($result)));
|
||||
$this->fileModel->where('id', $file_id)->set(['status' => $status,'reason' => $failure_reason])->update();
|
||||
$this->fileModel->where('id', $file_id)->set(['status' => $status,'reason' => $failure_reason])->update();
|
||||
$this->myLogger->logme("error",'{file_id} uploaded failed',['file_id' => $file_id]);
|
||||
//return $this->respond(['dataStatus' => true,'code' => 404,'data' => 'file upload failed with errors'], 200);
|
||||
// dd($failure_reason);
|
||||
|
||||
|
||||
//print_r($r);
|
||||
}
|
||||
else //trigger next data validation via job queue server
|
||||
{
|
||||
//proceed next data level validation in JOB queue
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'excelFileDataValidation','payload' => ['file_id' => $file_id]]);
|
||||
$r = Jobs::addJob(['job_name' => 'excelFileDataValidation','payload' => ['file_id' => $file_id]]);
|
||||
// $jobWorker = new JobWorker();
|
||||
// JobWorker::processJob($r);
|
||||
}
|
||||
@ -351,13 +348,15 @@ class EmployeeServiceController extends AdminController
|
||||
if($file['action'] == 'dependent_addition')
|
||||
{
|
||||
$existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(emp_code: $emp_id,client_id: $file['client_id'],client_policy_id: $file ['policy_id'],emp_status: ['active'],policy_status:['active']);
|
||||
// dd($existing_famility_details);
|
||||
// dd(($existing_famility_details));
|
||||
//transsform familiy details from db columns to exxcel row with column indexs for checking remaining functionalitites
|
||||
$existing_famility_details = transform_db_data_to_excel($existing_famility_details,$file);
|
||||
// dd($existing_famility_details);
|
||||
// dd(array_keys($existing_famility_details[0]));
|
||||
$family = array_merge($family,$existing_famility_details);
|
||||
// kint::dump($family);
|
||||
$family = data_group_by_family($family)[ $emp_id ];// reason to call this again is bring self to first index of the array
|
||||
}
|
||||
// kint::dump($family);die();
|
||||
// kint::dump($family);//die();
|
||||
//check name dup within a family
|
||||
|
||||
if($file['action'] == 'inception' || $file['action'] == 'addition' || $file['action'] == 'dependent_addition')
|
||||
@ -374,14 +373,26 @@ class EmployeeServiceController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
if(($file['action'] == 'inception' || $file['action'] == 'addition') && ($policy_details['is_addon'] != 3)) // 3 is depent addon
|
||||
if(($file['action'] == 'inception' || $file['action'] == 'addition' || $file['action'] == 'dependent_addition') && ($policy_details['policy_type_id'] != 3)) // 3 is GMC parents (base policy or dep addon)
|
||||
{
|
||||
$res = check_self_available_in_family($family,$file['action']);
|
||||
// dd($res);
|
||||
if(!$res['is_self_found'])
|
||||
{
|
||||
array_push($result['error_summary'],14); // Self not found
|
||||
$result['error_data'][ $res['emp_code'] ]['name_of_emp_dep']['error'][] = "Self not found ";
|
||||
$result['error_data'][ $res['row_id'] ]['sno']['error'][] = "Self not found ";
|
||||
}
|
||||
}
|
||||
|
||||
//check self avaialbe where self data is not available either in excel or same policy (i.e.) gMC parents
|
||||
if($policy_details['policy_type_id'] == 3) // 3 is GMC parents (base policy or dep addon)
|
||||
{
|
||||
$self_details = $this->employeeModel->getEmpFamilybyEmpCode(emp_code: $emp_id,client_id: $file['client_id'],emp_status: ['active'],policy_status:['active']);
|
||||
// dd($self_details);
|
||||
if(!count($self_details))
|
||||
{
|
||||
array_push($result['error_summary'],14); // Self not found
|
||||
$result['error_data'][ $family[0][0] ]['sno']['error'][] = "Self not found ";
|
||||
}
|
||||
}
|
||||
|
||||
@ -459,9 +470,8 @@ class EmployeeServiceController extends AdminController
|
||||
else //inception OR addition OR dependent addition
|
||||
{
|
||||
//proceed next data level validation in JOB queue
|
||||
$job_details = new Jobs();
|
||||
|
||||
$r = Jobs::addJob(['job_name' => 'employeesOnboardPreprocess','payload' => ['file_id' => $file_id]]);
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'employeesOnboardPreprocess','payload' => ['file_id' => $file_id]]);
|
||||
// $jobWorker = new JobWorker();
|
||||
// JobWorker::processJob($r);
|
||||
}
|
||||
@ -502,7 +512,12 @@ class EmployeeServiceController extends AdminController
|
||||
}
|
||||
|
||||
$columns_to_check = [];
|
||||
if($file['action'] == 'inception'){ $columns_to_check = $this->inception_excel_columns; }
|
||||
if($file['action'] == 'inception'){ $columns_to_check = $this->inception_excel_columns; }
|
||||
if($file['action'] == 'addition'){ $columns_to_check = $this->inception_excel_columns; }
|
||||
if($file['action'] == 'dependent_addition'){ $columns_to_check = $this->inception_excel_columns; }
|
||||
if($file['action'] == 'deletion'){ $columns_to_check = $this->deletion_excel_columns; }
|
||||
if($file['action'] == 'correction'){ $columns_to_check = $this->correction_excel_columns; }
|
||||
if($file['action'] == 'si_enhancement'){ $columns_to_check = $this->si_enhance_excel_columns; }
|
||||
|
||||
// get policy and rack details
|
||||
$policy_terms = $this->clientPolicyModel->getPolicyDetails($file['client_id'],$file['policy_id']);
|
||||
@ -516,6 +531,7 @@ class EmployeeServiceController extends AdminController
|
||||
|
||||
$highestRowAndColumn = $sheet->getHighestRowAndColumn();
|
||||
$allowedHighestColumn = end($columns_to_check);
|
||||
// dd($allowedHighestColumn);
|
||||
$excel_data = $sheet->rangeToArray('A1:' . $allowedHighestColumn['col_cell_name'] . $highestRowAndColumn['row']);
|
||||
unset($excel_data[0]);
|
||||
|
||||
@ -538,6 +554,7 @@ class EmployeeServiceController extends AdminController
|
||||
$existing_famility_details = transform_db_data_to_excel($existing_famility_details,$file);
|
||||
// Kint::dump($existing_famility_details);
|
||||
$family = array_merge($family,$existing_famility_details);
|
||||
$family = data_group_by_family($family)[ $emp_id ];// reason to call this again is bring self to first index of the array
|
||||
// dd($family);
|
||||
}
|
||||
|
||||
@ -827,15 +844,10 @@ class EmployeeServiceController extends AdminController
|
||||
{
|
||||
$familiy_data = $params['familiy_data'];
|
||||
$file = $params['file'];
|
||||
// dd($file);
|
||||
// print_r($familiy_data);
|
||||
// echo '------------------------------------------------------';
|
||||
|
||||
|
||||
|
||||
$slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($file['policy_id'],$file['client_id']);
|
||||
foreach($familiy_data as $fkey => $value)
|
||||
{
|
||||
if($file['id'] == null || $value['temp']['source'] == 'excel') //insert data come from excel and from db i.e. ( $file['id'] == null for enrollment data)
|
||||
if($file['id'] == null || $value['temp']['source'] == 'excel' || (($file['action'] == 'dependent_addition' && in_array($value['temp']['source'],[10,11]) && ($slab_details['slab_rates'][0]['premium_type'] == 1 && strtolower($value['relationship']) == 'self') || ($slab_details['slab_rates'][0]['premium_type'] == 1 || $slab_details['slab_rates'][0]['premium_type'] == null)))) //insert data come from excel and from db i.e. ( $file['id'] == null for enrollment data)
|
||||
{
|
||||
|
||||
$employee = $this->employeeModel->checkExistingEmp($value);
|
||||
@ -843,11 +855,25 @@ class EmployeeServiceController extends AdminController
|
||||
$temp = $value['temp'];
|
||||
unset($value['policy_details']);
|
||||
unset($value['temp']);
|
||||
|
||||
//start implemet of si enhancement of grid type 10,11
|
||||
if(count($employee) && (($file['action'] == 'dependent_addition' && in_array($value['temp']['source'],[10,11]) && ($slab_details['slab_rates'][0]['premium_type'] == 1 && strtolower($value['relationship']) == 'self') || ($slab_details['slab_rates'][0]['premium_type'] == 1 || $slab_details['slab_rates'][0]['premium_type'] == null))))
|
||||
{
|
||||
$res = $this->employeesSIEnhanceProcessWhileOnbboard(employee:$employee[0],policy_data: $policy_data,file:$file);// where employee holds existing emp data and policy_data holds new si enhancement
|
||||
if(!$res)
|
||||
{
|
||||
//if endorsement not happend no need to update emp/policy details in DB.
|
||||
break;
|
||||
}
|
||||
}
|
||||
//end implemet of si enhancement of grid type 10,11
|
||||
|
||||
//save employee table
|
||||
if(count($employee))
|
||||
{
|
||||
$value['updated_by'] = $file['created_by'];
|
||||
$value['id'] = $employee[0]['id'];
|
||||
$value['emp_status'] = 'active';
|
||||
$log_message = 'Update Employee - '.$employee[0]['name'].'('.$employee[0]['emp_code'].') with PK '.$employee[0]['id'];
|
||||
// $this->myLogger->logme('error',('Update - ' . $employee[0]['id'].' - '. $employee[0]['emp_code'] .' - '.$employee[0]['name']));
|
||||
}
|
||||
@ -896,7 +922,50 @@ class EmployeeServiceController extends AdminController
|
||||
}// for end
|
||||
}//function end
|
||||
|
||||
// $employee -> holds existing emp model obj and $policy_data holds new policy changes as array
|
||||
public function employeesSIEnhanceProcessWhileOnbboard(array $employee,array $policy_data,array $file)
|
||||
{
|
||||
$employee = $this->employeeModel->where('emp_code', $employee['emp_code'])->where('name',$employee['name'])->where('client_id',$employee['client_id'])->where('is_active',1)->first();
|
||||
|
||||
$employee_policy = $this->employeePolicyModel->where('employee_id',$employee['id'])->where('client_policy_id',$file['policy_id'])->first();
|
||||
|
||||
$slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($employee_policy['policy_id'],$employee['client_id']);
|
||||
|
||||
//check si has changed in normal case OR check premium only changed, still treat as SI enhancement in grid type 10
|
||||
if($employee_policy['basic_cover_si'] != $policy_data['basic_cover_si'] || ($slab_details['grid_master']['ui_type'] == 10 && $policy_data['premimum'] != null && $policy_data['premimum'] != "" && $employee_policy['premimum'] != $policy_data['premimum']))
|
||||
{
|
||||
$existing_endorsements = $this->empEndorsementModel->where('actions','si')
|
||||
->where('table_name','employee_polices')
|
||||
->where('endorsement_id is null')
|
||||
->where('emp_code',$employee['emp_code'])
|
||||
->where('name',$employee['name'])
|
||||
->where('field_name','basic_cover_si')
|
||||
->findAll();
|
||||
// dd($existing_endorsements);
|
||||
//make entry in endorsement table
|
||||
if(!count($existing_endorsements))
|
||||
{
|
||||
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
{
|
||||
if($slab_value['si'] == $policy_data['basic_cover_si'])
|
||||
{
|
||||
$group_key = rand(100000, 999999);
|
||||
$this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'basic_cover_si','old_value' => $employee_policy['basic_cover_si'],'new_value' => $policy_data['basic_cover_si'],'created_by' => $file['created_by'],'remarks' => 'general si enhancement via DA','group_key' => $group_key,'file_id' => $file['id']]);
|
||||
$this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'premium','old_value' => $employee_policy['premium'],'new_value' => $slab_value['premium'],'created_by' => $file['created_by'],'remarks' => 'general si enhancement via DA','group_key' => $group_key,'file_id' => $file['id']]);
|
||||
$this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'si_enhancement_date','old_value' => null,'new_value' => date('Y-m-d'),'created_by' => $file['created_by'],'remarks' => 'general si enhancement via DA','group_key' => $group_key,'file_id' => $file['id']]);
|
||||
$this->myLogger->logme('error',($employee['emp_code'].' - '.$employee['name'].'- ( NEW/OLD SI - '.$employee_policy['basic_cover_si'].'/'.$policy_data['basic_cover_si'].')'. '( NEW/OLD PREMIUM - '.$employee_policy['premium'].'/'.$policy_data['premimum'].') '.' - si enhancement via DA'));
|
||||
return true; //retun true when endorsement inserted
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return false; //retun false when endorsement not happend
|
||||
}
|
||||
return false; //retun false when endorsement not happend
|
||||
|
||||
|
||||
}
|
||||
// ---------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
@ -96,7 +96,7 @@ class RestAuthenticationController extends AdminController
|
||||
$mobile_number = $this->request->getJSON()->mobile_number;
|
||||
$otp = $this->request->getJSON()->otp;
|
||||
|
||||
$employeeData = $this->employeeModel->where('mobile', $mobile_number)->first();
|
||||
$employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->first();
|
||||
if ($employeeData && $otp == $employeeData["otp"] || $employeeData && isset($this->request->getJSON()->login_by_hr)) {
|
||||
$auth = HttpRequestHelper::getRequestInfo();
|
||||
if ($auth) {
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use App\Models\EmployeeModel;
|
||||
use Kint\Kint;
|
||||
|
||||
|
||||
if(!function_exists('calculate_days_bw_dates'))
|
||||
@ -78,8 +79,8 @@ if(!function_exists('check_relationship'))
|
||||
$slug = \Config\Services::slug();
|
||||
$col = $slug->slugify($row[5]);
|
||||
// echo $col;//die();
|
||||
// if($col != 'self' && $col != 'spouse')
|
||||
// {
|
||||
if($col != 'self' && $col != 'spouse')
|
||||
{
|
||||
if(!isset($relationship[ $col ]))
|
||||
{
|
||||
return array('status' => false,'error' => 'Rule Conflict: Unknown Relationship');
|
||||
@ -104,7 +105,7 @@ if(!function_exists('check_relationship'))
|
||||
}
|
||||
|
||||
|
||||
// }
|
||||
}
|
||||
return array('status' => true);
|
||||
}
|
||||
else
|
||||
@ -142,6 +143,13 @@ if(!function_exists('check_employee_band'))
|
||||
if($row['current_action'] != null && in_array(strtoupper($row['current_action']), ['I','A','DA']))// check rule only of action column data available
|
||||
{
|
||||
$is_emp_band_needed = $slab_details['grid_master']['emp_band'];
|
||||
if($slab_details['grid_master']['ui_type'] == 1) //gpa rack rate 1
|
||||
{
|
||||
if($slab_details['slab_rates'][0]['si_or_bp'] == 3)
|
||||
{
|
||||
$is_emp_band_needed = true;
|
||||
}
|
||||
}
|
||||
$slug = \Config\Services::slug();
|
||||
$relationship = $slug->slugify($row[5]);
|
||||
// echo $relationship;echo $row[7];
|
||||
@ -170,21 +178,65 @@ if(!function_exists('check_si'))
|
||||
{
|
||||
function check_si($row,$policy_terms,$slab_details)
|
||||
{
|
||||
$return_array = array('status' => true,'error' => '');
|
||||
$is_si_found = false;
|
||||
$is_age_slab_found = false;
|
||||
if($row['current_action'] != null && in_array(strtoupper($row['current_action']), ['I','A','DA','SI']))// check rule only of action column data available
|
||||
{
|
||||
$received_si = $row['current_action'] == 'SI' ? $row[3] : $row[6];
|
||||
$found = false;
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
{
|
||||
if($slab_value['si'] == $received_si)
|
||||
if($is_si_found && $is_age_slab_found)
|
||||
{
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if(!$is_si_found && $slab_value['si'] == $received_si) //match si amount
|
||||
{
|
||||
$is_si_found = true;
|
||||
}
|
||||
|
||||
// check age slab
|
||||
if($row[3] != null && DateTime::createFromFormat('d-M-Y', $row[3]) !== false)// dob
|
||||
{
|
||||
$dob = change_date_format($row[3],'d-M-Y','Y-m-d');
|
||||
// echo $row[3].' - '.$dob;echo '<br>';
|
||||
$currentDateTime = new DateTime();//die();
|
||||
$passedDateTime = new DateTime($dob);
|
||||
$interval = $currentDateTime->diff($passedDateTime);
|
||||
if(!$is_age_slab_found)
|
||||
{
|
||||
if(isset($slab_value['age_from']) && isset($slab_value['age_to']))
|
||||
{
|
||||
if($slab_value['age_from'] !== null && $slab_value['age_to'] !== null && $slab_value['age_from'] <= $interval->y && $slab_value['age_to'] >= $interval->y && $slab_value['si'] == $received_si)
|
||||
{
|
||||
$is_age_slab_found = true;// send true if age slab found
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$is_age_slab_found = true;// send true if age conditin is not applicable
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}//end of check age slab
|
||||
}
|
||||
if(!$found) { return array('status' => false,'error' => "Sum insured not found"); }
|
||||
return array('status' => true);
|
||||
}else { return array('status' => true); } // in else condition no need to check rule, just return true
|
||||
|
||||
}
|
||||
|
||||
if(!$is_si_found)
|
||||
{
|
||||
$return_array['status'] = false;
|
||||
$return_array['error'] = "Sum insured not found";
|
||||
}
|
||||
if(!$is_age_slab_found)
|
||||
{
|
||||
$return_array['status'] = false;
|
||||
$return_array['error'] = !empty($return_array['error']) ? ($return_array['error'].', '.'Sum insured not configured for this age slab') : 'Sum insured not configured for this age slab';
|
||||
}
|
||||
|
||||
return $return_array;
|
||||
}
|
||||
}
|
||||
|
||||
@ -207,18 +259,31 @@ if(!function_exists('check_basic_pay'))
|
||||
|
||||
if (!function_exists('check_dob_diff'))
|
||||
{
|
||||
function check_dob_diff($row,$relationships) {
|
||||
function check_dob_diff($row,$relationships,$default_age_ratio) {
|
||||
// echo 'called';
|
||||
if($row['current_action'] != null && in_array(strtoupper($row['current_action']), ['I','A','DA']))// check rule only of action column data available
|
||||
{
|
||||
if($row[3] != null && $row[5] != null)
|
||||
{
|
||||
if (DateTime::createFromFormat('d-M-Y', $row[3]) === false)
|
||||
{
|
||||
return array('status' => false,'error' => 'Not a valid Date');
|
||||
}
|
||||
// return array('status' => true);
|
||||
$dob = change_date_format($row[3],'d-M-Y','Y-m-d');
|
||||
// echo $row[3].' - '.$dob;echo '<br>';
|
||||
$currentDateTime = new DateTime();//die();
|
||||
// print_r($currentDateTime);
|
||||
// die();
|
||||
$passedDateTime = new DateTime($dob);
|
||||
// print_r($passedDateTime);
|
||||
|
||||
$interval = $currentDateTime->diff($passedDateTime);
|
||||
|
||||
//remap default age ratio data into relationship array
|
||||
if(count($default_age_ratio))
|
||||
{
|
||||
$relationships = remap_default_age_ratio_into_relationship($relationships,$default_age_ratio);
|
||||
}
|
||||
$slug = \Config\Services::slug();
|
||||
$relationship = $slug->slugify($row[5]);
|
||||
$age_min = isset($relationships[$relationship]['age_min']) ? $relationships[$relationship]['age_min'] : NULL;
|
||||
@ -247,7 +312,7 @@ if (!function_exists('data_group_by_family'))
|
||||
function data_group_by_family($emp_data,$data_source = 'excel')
|
||||
{
|
||||
$result = [];
|
||||
// dd($emp_data);
|
||||
// Kint::dump($emp_data);
|
||||
foreach ($emp_data as $rkey => $row)
|
||||
{
|
||||
if($data_source == 'excel')
|
||||
@ -305,8 +370,13 @@ if (!function_exists('check_self_available_in_family'))
|
||||
{
|
||||
function check_self_available_in_family($family_data)
|
||||
{
|
||||
|
||||
|
||||
$is_self_found = false;
|
||||
|
||||
$row_id_from_excel = array_filter($family_data,function($item){ return !isset($item['temp']);});
|
||||
// Kint::dump($row_id_from_excel);
|
||||
$row_id_from_excel = current($row_id_from_excel); // get excel sno/rowid of employee amoung familiy array where this array has both data from excel and db
|
||||
$row_id_from_excel = $row_id_from_excel[0];
|
||||
foreach ($family_data as $rkey => $row)
|
||||
{
|
||||
if($row[5] != null && strtolower($row[5]) == 'self')//$row[5] = relationship $row[4] = Gender
|
||||
@ -317,7 +387,7 @@ if (!function_exists('check_self_available_in_family'))
|
||||
|
||||
}
|
||||
|
||||
return ['is_self_found' => $is_self_found,'emp_code' => $family_data[0][1]];
|
||||
return ['is_self_found' => $is_self_found,'emp_code' => $family_data[0][1],'row_id' => $row_id_from_excel];
|
||||
}
|
||||
}
|
||||
|
||||
@ -335,28 +405,31 @@ if (!function_exists('name_and_empid_check_in_db'))
|
||||
|
||||
foreach ($family_data as $rkey => $row)
|
||||
{
|
||||
$res = $employeeModel
|
||||
->join('client_policy cp',"employees.client_id = cp.client_id")
|
||||
->join('employee_polices ep',"cp.id = ep.client_policy_id AND employees.id = ep.employee_id")
|
||||
// ->where("cp.id",$policy_id)
|
||||
->where("employees.client_id",$client_id)
|
||||
->where("employees.is_active",1)
|
||||
->where("ep.is_active",1)
|
||||
// ->where("ep.client_id",$client_id)
|
||||
->where('name',$row[2])->where('emp_code',$row[1])
|
||||
->findAll();
|
||||
|
||||
// dd($employeeModel->getLastQuery());
|
||||
|
||||
|
||||
if(($current_action == 'deletion' || $current_action == 'correction' || $current_action == 'si_enhancement') && !count($res))
|
||||
{
|
||||
array_push($result['del'],$row[0]);
|
||||
}
|
||||
if(($current_action == 'inception' || $current_action == 'dependent_addition' || $current_action == 'addition') && count($res))
|
||||
{
|
||||
array_push($result['i'],$row[0]);
|
||||
}
|
||||
if(isset($row['temp']) && $row['temp']['source'] != 'db')
|
||||
{
|
||||
$res = $employeeModel
|
||||
->join('client_policy cp',"employees.client_id = cp.client_id")
|
||||
->join('employee_polices ep',"cp.id = ep.client_policy_id AND employees.id = ep.employee_id")
|
||||
// ->where("cp.id",$policy_id)
|
||||
->where("employees.client_id",$client_id)
|
||||
->where("employees.is_active",1)
|
||||
->where("ep.is_active",1)
|
||||
// ->where("ep.client_id",$client_id)
|
||||
->where('name',$row[2])->where('emp_code',$row[1])
|
||||
->findAll();
|
||||
|
||||
// dd($employeeModel->getLastQuery());
|
||||
|
||||
|
||||
if(($current_action == 'deletion' || $current_action == 'correction' || $current_action == 'si_enhancement') && !count($res))
|
||||
{
|
||||
array_push($result['del'],$row[0]);
|
||||
}
|
||||
if(($current_action == 'inception' || $current_action == 'dependent_addition' || $current_action == 'addition') && count($res))
|
||||
{
|
||||
array_push($result['i'],$row[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -386,9 +459,9 @@ if (!function_exists('check_dependent_conflict'))
|
||||
$self_emp_row_id = null;
|
||||
$temp_counts = [2,3,4,5,6,7,8,9,10]; //temp variable for check relation repetaed count
|
||||
$slug = \Config\Services::slug();
|
||||
|
||||
// if($policy_terms['family_floater'] == true)
|
||||
// {
|
||||
// dd($policy_terms);
|
||||
if(isset($policy_terms['family_floater']) && !empty($policy_terms['family_floaters']))
|
||||
{
|
||||
|
||||
// $temp_string = implode(" ",$policy_terms['family_floaters']);
|
||||
$temp = $policy_terms['family_floaters'];
|
||||
@ -466,7 +539,7 @@ if (!function_exists('check_dependent_conflict'))
|
||||
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: Dependent count greater than allowed dependent 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 : $family_data[0][0])];//dependent count mismatch
|
||||
}
|
||||
|
||||
// || ($allowed_parents_count < $received_parents_count) || ($allowed_parent_in_laws_count < $received_parent_in_laws_count)
|
||||
@ -478,7 +551,7 @@ if (!function_exists('check_dependent_conflict'))
|
||||
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: Dependent count greater than allowed dependent 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 : $family_data[0][0])];//dependent count mismatch
|
||||
}
|
||||
}
|
||||
|
||||
@ -488,19 +561,16 @@ if (!function_exists('check_dependent_conflict'))
|
||||
{
|
||||
// dd($allowed_adults);
|
||||
$result['status'] = false;
|
||||
$result['error_data'][] = ['code' => 12,'col_name' => 'sno','msg' => 'Rule conflict: Dependent count greater than allowed dependent 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 : $family_data[0][0])];//dependent count mismatch
|
||||
}
|
||||
|
||||
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if(count($family_data) > 1)
|
||||
// {
|
||||
// $result['status'] = false;
|
||||
// $result['error_data'][] = ['code' => 11,'col_name' => 'sno','msg' => 'Rule conflict: Dependents not allowed','row_id' => $row[0]];//dependents not allowed
|
||||
// }
|
||||
// }
|
||||
}
|
||||
else
|
||||
{
|
||||
$result['status'] = true;
|
||||
}
|
||||
|
||||
|
||||
return $result;
|
||||
|
||||
@ -525,7 +595,7 @@ if (!function_exists('calculate_premimum'))
|
||||
function calculate_premimum($family_data,$policy_terms,$slab_details,$fileArr,$default_si = null)
|
||||
{
|
||||
//
|
||||
// dd($fileArr);
|
||||
// dd($slab_details);
|
||||
// grid type
|
||||
// 1 = premium => si
|
||||
$result = [];
|
||||
@ -574,7 +644,7 @@ if (!function_exists('calculate_premimum'))
|
||||
|
||||
$transformed_familiy_member_data['policy_details']['basic_cover_si'] = isset($emp_details_with_empband_max_age_max_count[ $transformed_familiy_member_data['emp_code'] ]['si']) ? $emp_details_with_empband_max_age_max_count[ $transformed_familiy_member_data['emp_code'] ]['si'] : $transformed_familiy_member_data['policy_details']['basic_cover_si'];
|
||||
|
||||
if( $fileArr['id'] == null || (in_array($grid_type,[10,11]) || $transformed_familiy_member_data['temp']['source'] == 'excel'))//if file id is null then data coming from enrollment (from DB) otherwise data coming from xcel, so calculate only data from excel (new entry) note: even data coming from excel for event dependet additon we fetch other dependts from db and calculate premium for whole family
|
||||
if( $fileArr['id'] == null || $transformed_familiy_member_data['temp']['source'] == 'excel' || ($fileArr['action'] == 'dependent_addition' && in_array($grid_type,[10,11]) && $slab_details['slab_rates'][0]['premium_type'] == 1 && strtolower($transformed_familiy_member_data['relationship']) == 'self'))//if file id is null then data coming from enrollment (from DB) otherwise data coming from xcel, so calculate only data from excel (new entry) note: even data coming from excel for event dependet additon we fetch other dependts from db and calculate premium for whole family
|
||||
{
|
||||
$transformed_familiy_member_data = premium_calculation_manager($transformed_familiy_member_data,$policy_terms,$slab_details,$default_si);
|
||||
|
||||
@ -652,6 +722,8 @@ if (!function_exists('premium_calculation_manager'))
|
||||
{
|
||||
function premium_calculation_manager($emp_data,$policy_terms,$slab_details,$default_si = null)
|
||||
{
|
||||
|
||||
$myLogger = \Config\Services::mylogger();
|
||||
// grid type
|
||||
// 1 = premium => si
|
||||
// dd($emp_data);
|
||||
@ -687,14 +759,15 @@ if (!function_exists('premium_calculation_manager'))
|
||||
//gird and calculation start
|
||||
$slug = \Config\Services::slug();
|
||||
$grid_type = $slab_details['grid_master']['ui_type'];
|
||||
|
||||
$is_match_found = false;
|
||||
switch ($grid_type) {
|
||||
case "1":
|
||||
//GPA - Sum Insured (SI) * Multiplier
|
||||
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
|
||||
$employee_received_band = $emp_data['temp']['band'];
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
{
|
||||
if($slab_value['si'] == $employee_received_si)
|
||||
if(($slab_value['si'] == $employee_received_si) || ($slab_value['grade'] != null && $slab_value['grade'] == $employee_received_band && $slab_value['si'] == $employee_received_si))
|
||||
{
|
||||
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
||||
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
||||
@ -703,7 +776,7 @@ if (!function_exists('premium_calculation_manager'))
|
||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($slab_value['premium'],$emp_data['policy_details']['days']);
|
||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.','');
|
||||
|
||||
$is_match_found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -723,7 +796,7 @@ if (!function_exists('premium_calculation_manager'))
|
||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($slab_value['premium'],$emp_data['policy_details']['days']);
|
||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.','');
|
||||
|
||||
$is_match_found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -742,7 +815,7 @@ if (!function_exists('premium_calculation_manager'))
|
||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($slab_value['premium'],$emp_data['policy_details']['days']);
|
||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.','');
|
||||
|
||||
$is_match_found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -766,7 +839,7 @@ if (!function_exists('premium_calculation_manager'))
|
||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($slab_value['premium'],$emp_data['policy_details']['days']);
|
||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.','');
|
||||
|
||||
$is_match_found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -786,7 +859,7 @@ if (!function_exists('premium_calculation_manager'))
|
||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($slab_value['premium'],$emp_data['policy_details']['days']);
|
||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.','');
|
||||
|
||||
$is_match_found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -795,6 +868,28 @@ if (!function_exists('premium_calculation_manager'))
|
||||
//GMC - Employees + Dependent Age band
|
||||
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
{
|
||||
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
|
||||
if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && strtolower($emp_data['relationship']) == 'self') || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
||||
{
|
||||
// echo $emp_data['name'];
|
||||
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
||||
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
||||
$emp_data['policy_details']['policy_end_date'] = $policy_terms['policy_end_date'];
|
||||
$emp_data['policy_details']['days'] = calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days;
|
||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($slab_value['premium'],$emp_data['policy_details']['days']);
|
||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.','');
|
||||
$is_match_found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case "7":
|
||||
//GMC - Employees + Dependent Age + SI
|
||||
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
{
|
||||
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
|
||||
if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && strtolower($emp_data['relationship']) == 'self') || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
||||
@ -807,27 +902,7 @@ if (!function_exists('premium_calculation_manager'))
|
||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($slab_value['premium'],$emp_data['policy_details']['days']);
|
||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.','');
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "7":
|
||||
//GMC - Employees + Dependent Age + SI
|
||||
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
{
|
||||
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
|
||||
if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && strtolower($emp_data['relationship']) == 'self') || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
||||
{
|
||||
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
||||
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
||||
$emp_data['policy_details']['policy_end_date'] = $policy_terms['policy_end_date'];
|
||||
$emp_data['policy_details']['days'] = calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days;
|
||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($slab_value['premium'],$emp_data['policy_details']['days']);
|
||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.','');
|
||||
|
||||
|
||||
$is_match_found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -845,11 +920,11 @@ if (!function_exists('premium_calculation_manager'))
|
||||
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
||||
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
||||
$emp_data['policy_details']['policy_end_date'] = $policy_terms['policy_end_date'];
|
||||
$emp_data['policy_details']['days'] = calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days;
|
||||
$emp_data['policy_details']['days'] = calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days;
|
||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($slab_value['premium'],$emp_data['policy_details']['days']);
|
||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.','');
|
||||
|
||||
$is_match_found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -866,11 +941,11 @@ if (!function_exists('premium_calculation_manager'))
|
||||
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
||||
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
||||
$emp_data['policy_details']['policy_end_date'] = $policy_terms['policy_end_date'];
|
||||
$emp_data['policy_details']['days'] = calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days;
|
||||
$emp_data['policy_details']['days'] = calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days;
|
||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($slab_value['premium'],$emp_data['policy_details']['days']);
|
||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.','');
|
||||
|
||||
$is_match_found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -888,11 +963,11 @@ if (!function_exists('premium_calculation_manager'))
|
||||
$emp_data['policy_details']['basic_cover_si'] = $employee_received_si;
|
||||
$emp_data['policy_details']['date_coverage'] = isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date'];
|
||||
$emp_data['policy_details']['policy_end_date'] = $policy_terms['policy_end_date'];
|
||||
$emp_data['policy_details']['days'] = calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days;
|
||||
$emp_data['policy_details']['days'] = calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days;
|
||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($slab_value['premium'],$emp_data['policy_details']['days']);
|
||||
$emp_data['policy_details']['gst'] = ((float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.',''));
|
||||
|
||||
$is_match_found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -917,11 +992,11 @@ if (!function_exists('premium_calculation_manager'))
|
||||
$emp_data['policy_details']['basic_cover_si'] = $familiy_si_covered;
|
||||
$emp_data['policy_details']['date_coverage'] = (empty($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
||||
$emp_data['policy_details']['policy_end_date'] = $policy_terms['policy_end_date'];
|
||||
$emp_data['policy_details']['days'] = calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days;
|
||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($slab_value['premium'],$emp_data['policy_details']['days']);
|
||||
$emp_data['policy_details']['days'] = calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days;
|
||||
$emp_data['policy_details']['premium'] = get_premium_for_si(slab_details: $slab_details,si_amount: $familiy_si_covered,band: $employee_received_band);
|
||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days']);
|
||||
$emp_data['policy_details']['gst'] = ((float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.',''));
|
||||
|
||||
$is_match_found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -942,11 +1017,11 @@ if (!function_exists('premium_calculation_manager'))
|
||||
$emp_data['policy_details']['basic_cover_si'] = $employee_received_si;
|
||||
$emp_data['policy_details']['date_coverage'] = (empty($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
||||
$emp_data['policy_details']['policy_end_date'] = $policy_terms['policy_end_date'];
|
||||
$emp_data['policy_details']['days'] = calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days;
|
||||
$emp_data['policy_details']['days'] = calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days;
|
||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($slab_value['premium'],$emp_data['policy_details']['days']);
|
||||
$emp_data['policy_details']['gst'] = ((float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.',''));
|
||||
|
||||
$is_match_found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -967,11 +1042,11 @@ if (!function_exists('premium_calculation_manager'))
|
||||
$emp_data['policy_details']['basic_cover_si'] = $employee_received_si;
|
||||
$emp_data['policy_details']['date_coverage'] = (empty($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
||||
$emp_data['policy_details']['policy_end_date'] = $policy_terms['policy_end_date'];
|
||||
$emp_data['policy_details']['days'] = calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days;
|
||||
$emp_data['policy_details']['days'] = calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days;
|
||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($slab_value['premium'],$emp_data['policy_details']['days']);
|
||||
$emp_data['policy_details']['gst'] = ((float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.',''));
|
||||
|
||||
$is_match_found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -980,10 +1055,28 @@ if (!function_exists('premium_calculation_manager'))
|
||||
|
||||
|
||||
default:
|
||||
echo "Not a valid grid";
|
||||
$this->myLogger->logme('error',($emp_data['emp_code'].'-'.$emp_data['name'].' - grid type not found'));
|
||||
}
|
||||
|
||||
// unset($emp_data['temp']);//remove temp data
|
||||
if(!$is_match_found)
|
||||
{
|
||||
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
|
||||
$log_message = '[ client_policy_id : ' .$emp_data['policy_details']['client_policy_id'].' - '. $emp_data['emp_code'].' - '.$emp_data['name'] .' - '. $emp_data['policy_details']['basic_cover_si'] . ', Age : '. $age.' ]';
|
||||
if($slab_details['slab_rates'][0]['premium_type'] == 1)
|
||||
{
|
||||
$log_message .= ' - skipping, calculating only self..!';
|
||||
//reset emp si and others policy level data if premium only for self
|
||||
$emp_data['policy_details']['policy_end_date'] = $policy_terms['policy_end_date'];
|
||||
$emp_data['policy_details']['basic_cover_si'] = 0;
|
||||
$emp_data['policy_details']['premium'] = 0;
|
||||
$emp_data['policy_details']['rata_premimum'] = 0;
|
||||
$emp_data['policy_details']['gst'] = 0;
|
||||
$emp_data['policy_details']['days'] = 0;
|
||||
}
|
||||
else { $log_message .= '- skipping, slab rate not found'; }
|
||||
$myLogger->logme('error',$log_message);
|
||||
// echo $log_message;
|
||||
|
||||
}
|
||||
return $emp_data;
|
||||
|
||||
}
|
||||
@ -1125,4 +1218,67 @@ if(!function_exists('replace_original_data'))
|
||||
}
|
||||
return $current_data;
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('get_premium_for_si'))
|
||||
{
|
||||
function get_premium_for_si(array $slab_details,string $si_amount,string $band)
|
||||
{
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
{
|
||||
if($slab_value['si'] == $si_amount && $slab_value['grade'] == $band)
|
||||
{
|
||||
return $slab_value['premium'];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('remap_default_age_ratio_into_relationship'))
|
||||
{
|
||||
function remap_default_age_ratio_into_relationship(array $general_relationships,array $default_age_ratio)
|
||||
{
|
||||
foreach ($default_age_ratio as $relationship => $age_ratio)
|
||||
{
|
||||
switch ($relationship) {
|
||||
case 'child':
|
||||
if (isset($general_relationships['son'])) {
|
||||
$general_relationships['son']['age_min'] = $age_ratio['min'];
|
||||
$general_relationships['son']['age_max'] = $age_ratio['max'];
|
||||
}
|
||||
if (isset($general_relationships['daughter'])) {
|
||||
$general_relationships['daughter']['age_min'] = $age_ratio['min'];
|
||||
$general_relationships['daughter']['age_max'] = $age_ratio['max'];
|
||||
}
|
||||
break;
|
||||
case 'elders':
|
||||
if (isset($general_relationships['father'])) {
|
||||
$general_relationships['father']['age_min'] = $age_ratio['min'];
|
||||
$general_relationships['father']['age_max'] = $age_ratio['max'];
|
||||
}
|
||||
if (isset($general_relationships['mother'])) {
|
||||
$general_relationships['mother']['age_min'] = $age_ratio['min'];
|
||||
$general_relationships['mother']['age_max'] = $age_ratio['max'];
|
||||
}
|
||||
if (isset($general_relationships['father-in-law'])) {
|
||||
$general_relationships['father-in-law']['age_min'] = $age_ratio['min'];
|
||||
$general_relationships['father-in-law']['age_max'] = $age_ratio['max'];
|
||||
}
|
||||
if (isset($general_relationships['mother-in-law'])) {
|
||||
$general_relationships['mother-in-law']['age_min'] = $age_ratio['min'];
|
||||
$general_relationships['mother-in-law']['age_max'] = $age_ratio['max'];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (isset($general_relationships[$relationship])) {
|
||||
$general_relationships[$relationship]['age_min'] = $age_ratio['min'];
|
||||
$general_relationships[$relationship]['age_max'] = $age_ratio['max'];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $general_relationships;
|
||||
}
|
||||
}
|
||||
@ -43,6 +43,7 @@ class ClientModel extends Model
|
||||
->join('policies p', 'p.id = client_policy.policy_id')
|
||||
->where('client_policy.client_id',$client['id'])
|
||||
->where('client_policy.is_active', 1)
|
||||
->where('client_policy.policy_status', 1)
|
||||
->findAll();
|
||||
|
||||
$client['policies'] = $clientPolicies;
|
||||
|
||||
@ -82,6 +82,7 @@ class ClientPolicyModel extends Model
|
||||
->join('policy_type', 'policy_type.id = policies.policy_type_id')
|
||||
->where('client_policy.client_id', $client_id)
|
||||
->where('client_policy.policy_status', 1)
|
||||
->where('client_policy.is_active', 1)
|
||||
->get()
|
||||
->getResult();
|
||||
|
||||
|
||||
@ -36,7 +36,8 @@ class EmployeeModel extends Model
|
||||
"updated_at",
|
||||
"is_active",
|
||||
"file_id",
|
||||
"is_addon_value"
|
||||
"is_addon_value",
|
||||
"is_createdby_hr"
|
||||
];
|
||||
|
||||
// Callbacks
|
||||
@ -95,7 +96,7 @@ class EmployeeModel extends Model
|
||||
}
|
||||
|
||||
|
||||
public function getEmpFamilybyEmpCode(string $client_policy_id = null,string $emp_code = null,string $client_id = null,array $emp_status = [],array $policy_status = [])
|
||||
public function getEmpFamilybyEmpCode(string $client_policy_id = null,string $emp_code = null,string $client_id = null,array $emp_status = [],array $policy_status = [],array $relationship = [])
|
||||
{
|
||||
$result = $this->select(['employees.id as emp_id', 'employees.client_id', 'employees.relationship', 'employees.relationship_code', 'employees.change_event', 'employees.emp_code', 'employees.name', 'employees.email_personal', 'employees.email_corporate', 'employees.mobile', 'employees.gender', 'employees.dob', 'employees.doj', 'employees.basic_pay', 'employees.band', 'employees.designation', 'employees.emp_status','employee_polices.id as emp_policy_id', 'employee_polices.employee_id', 'employee_polices.client_policy_id', 'employee_polices.tpa_id', 'employee_polices.uhid', 'employee_polices.batch_code', 'employee_polices.status', 'employee_polices.pre_existing_alignments', 'employee_polices.basic_cover_si', 'employee_polices.date_coverage', 'employee_polices.policy_end_date', 'employee_polices.days', 'employee_polices.premium', 'employee_polices.rata_premimum', 'employee_polices.gst', 'employee_polices.date_of_exit', 'employee_polices.reason_for_exit'])
|
||||
->join('employee_polices', 'employee_polices.employee_id = employees.id')
|
||||
@ -105,7 +106,7 @@ class EmployeeModel extends Model
|
||||
})
|
||||
|
||||
->where('employee_polices.is_active',1)
|
||||
// ->where('employees.emp_status', ($emp_status !== null ? $emp_status : 'active'))
|
||||
->where('employees.is_active',1)
|
||||
// ->where('employees.emp_code',$emp_code)
|
||||
->when($emp_code, function($query) use ($emp_code){
|
||||
return $query->where('employees.emp_code',$emp_code);
|
||||
@ -114,6 +115,9 @@ class EmployeeModel extends Model
|
||||
->when(count($emp_status), function($query) use ($emp_status){
|
||||
return $query->whereIn('employees.emp_status', $emp_status);
|
||||
})
|
||||
->when(count($relationship), function($query) use ($relationship){
|
||||
return $query->whereIn('employees.relationship', $relationship);
|
||||
})
|
||||
->when(count($policy_status), function($query) use ($policy_status){
|
||||
return $query->whereIn('employee_polices.status', $policy_status);
|
||||
})
|
||||
@ -132,9 +136,10 @@ class EmployeeModel extends Model
|
||||
{
|
||||
|
||||
return $this->db->table('employee_polices')
|
||||
->select(' policies.name as Policy_Name , client_policy.policy_terms as Policy_Terms, client_policy.client_id as ClientId, client_policy.policy_id as PolicyId,client_policy.id as ClientPolicyId, client_policy.open_for_enrollment as OpenForEnrollment') // Select all columns from both tables
|
||||
->select(' policies.name as Policy_Name , client_policy.policy_terms as Policy_Terms, client_policy.client_id as ClientId, client_policy.policy_id as PolicyId,client_policy.id as ClientPolicyId, client_policy.open_for_enrollment as OpenForEnrollment , employee_polices.tpa_id as tpa_id , employee_polices.rand_string as rand_string') // Select all columns from both tables
|
||||
->join('client_policy', 'client_policy.id = employee_polices.client_policy_id')
|
||||
->join('policies', 'policies.id = client_policy.policy_id')
|
||||
->where('client_policy.policy_status', 1)
|
||||
->where('employee_polices.employee_id', $id)
|
||||
->get()
|
||||
->getResult();
|
||||
|
||||
@ -34,6 +34,7 @@ body {
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
<div class="row" id="client_add">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
@ -95,8 +96,8 @@ body {
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
<script>
|
||||
// $(document).ready(function(){
|
||||
// var tabid = localStorage.getItem('tabId');
|
||||
// console.log(tabid)
|
||||
@ -210,3 +211,4 @@ body {
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@ -607,7 +607,7 @@
|
||||
$currentUrl = base_url();
|
||||
$parsedUrl = parse_url($currentUrl);
|
||||
$baseUrl = $parsedUrl['scheme'] . '://' . $parsedUrl['host'] . '/';
|
||||
$redirectUrl = $baseUrl . 'nhanceTicket/staff/login_done?' . http_build_query(['token' => $sessionData]);
|
||||
$redirectUrl = $baseUrl . 'Ticketing/staff/login?' . http_build_query(['token' => $sessionData]);
|
||||
?>
|
||||
<a href="<?php echo $redirectUrl; ?>" target="_blank">
|
||||
<i class="mdi mdi-lifebuoy"></i>
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
<p class="rad" style="margin: 0!important; text-align: center!important; font-size: 18px!important;">We are glad to welcome you to the employee benefit program, <?= isset($policy_name) ? $policy_name : '' ?> offered by your employer.</p>
|
||||
</div>
|
||||
<button class="explore" style="padding: 15px 25px; background: linear-gradient(to right, #0267C1, #0280EF); border-radius: 50px; border: 0; color: #fff; transition: all .2s ease-in-out; cursor: pointer; box-shadow: 0 5px 10px rgba(0, 0, 0, .1); margin-bottom: 15px;">
|
||||
<a href="https://venbait.in/nhance/app/dev" style="text-decoration: none; color: #fff;">Review Details</a>
|
||||
<a href="<?= $App_Url; ?>" style="text-decoration: none; color: #fff;">Review Details</a>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -1,5 +1,13 @@
|
||||
<!-- Modal content for the Large example -->
|
||||
<style>
|
||||
.underline-input {
|
||||
border: none;
|
||||
border-bottom: 1px solid grey; /* Underline style */
|
||||
outline: none; /* Remove default focus outline */
|
||||
padding: 2px 5px; /* Adjust padding (top/bottom right/left) */
|
||||
font-size: 16px; /* Adjust font size */
|
||||
}
|
||||
|
||||
.button-like {
|
||||
display: inline-block;
|
||||
padding: 8px 15px;
|
||||
@ -96,73 +104,108 @@
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="sumInsured">Sum Insured</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="sum_insured" id="sum_insured" class="form-control" onkeypress="return onlyNumbers(event)" onkeyup=" formatNumber(this)">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div id='numberToWordGMC' class="text-danger-2"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Family Floater</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="radio" name="family_floater" class="family_floater" value="1"> Yes
|
||||
<input type="radio" name="family_floater" class="family_floater" value="0" style="margin-left:10px"> No
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
</div>
|
||||
<div class="col-md-6" style="margin-bottom:10px">
|
||||
<div style="margin-top:10px">
|
||||
<span style="margin-right: 20px;">Self:</span>
|
||||
<input type="checkbox" style="margin-right: 70px;" name="family_floaters[]" value="self" id="self" checked>
|
||||
<span style="margin-right: 20px;">Spouse:</span>
|
||||
<input type="checkbox" style="margin-right: 70px;" name="family_floaters[]" value="spouse" id="spouse">
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="sumInsured">Sum Insured</label>
|
||||
</div>
|
||||
<div style="margin-top:10px">
|
||||
<span for="children">Children:</span>
|
||||
<select name="family_floaters[]" id="children" style="margin-left: 109px;">
|
||||
<option value="0">None</option>
|
||||
<option value="1">1</option>
|
||||
<option value="2">2</option>
|
||||
<option value="3">3</option>
|
||||
<option value="4">4</option>
|
||||
</select>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="sum_insured" id="sum_insured" class="form-control" onkeypress = "return onlyNumbers(event)" onkeyup=" formatNumber(this)">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
</div>
|
||||
<div style="margin-top:10px">
|
||||
<span for="family_floaters">Select Other Members:</span>
|
||||
<select name="family_floaters[]" id="family_floaters" style="margin-left: 10px;">
|
||||
<option value="0">None</option>
|
||||
<option value="1P">Only one parent (Either Father / Mother)</option>
|
||||
<option value="2P">Only two parents (Father+Mother)</option>
|
||||
<option value="1PIL">Only one parent in law (Either MIL / FIL)</option>
|
||||
<option value="2PIL">Only two parents in law (FIL + MIL)</option>
|
||||
<option value="2EPORPIL">Parents or PIL (Any two of Father, Mother, MIl, FIL)</option>
|
||||
<option value="EPORPIL">Either Parents or PIL (Parents or Parents In Law)</option>
|
||||
<option value="4EPORPIL">Parents + PIL (Father + Mother + MIL + FIL)</option>
|
||||
</select>
|
||||
<div class="col-md-6">
|
||||
<div id='numberToWordGMC' class="text-danger-2" ></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Family Floater</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="radio" name="family_floater" class="family_floater" value="1"> Yes
|
||||
<input type="radio" name="family_floater" class="family_floater" value="0" style="margin-left:10px"> No
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
</div>
|
||||
<div class="col-md-6" style="margin-bottom:10px">
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="width: 11%;"><span style="margin-right: 20px;">Self:</span></td>
|
||||
<td style="width: 11%;"><input type="checkbox" style="margin-right: 70px;" name="family_floaters[]" value="self" id="self" checked> </td>
|
||||
<td style="width: 28%;" ><div class="self-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($self_min_age) ? $self_min_age : '18'; ?>" style="width: 18%;" type="number" name="self_min_age" id="self_min_age"></div></td>
|
||||
<td style="width: 28%;" ><div class="self-age"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($self_max_age) ? $self_max_age : '60'; ?>" style="width: 18%;" type="number" name="self_max_age" id="self_max_age"></div></td>
|
||||
</tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr>
|
||||
<tr>
|
||||
<td style="width: 11%;"><span style="margin-right: 20px;">Spouse:</span></td>
|
||||
<td style="width: 11%;"><input type="checkbox" style="margin-right: 70px;"name="family_floaters[]" value="spouse" id="spouse"></td>
|
||||
<td style="width: 28%;" ><div class="spouse-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($spouse_min_age) ? $spouse_min_age : '18'; ?>" style="width: 18%;" type="number" name="spouse_min_age" id="spouse_min_age"></div></td>
|
||||
<td style="width: 28%;" ><div class="spouse-age"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($spouse_max_age) ? $spouse_max_age : '60'; ?>" style="width: 18%;" type="number" name="spouse_max_age" id="spouse_max_age"></div></td>
|
||||
</tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr>
|
||||
<tr>
|
||||
<td style="width: 11%;"><span for="children">Children:</span></td>
|
||||
<td style="width: 11%;"><select name="family_floaters[]" id="children">
|
||||
<option value="0">None</option>
|
||||
<option value="1">1</option>
|
||||
<option value="2">2</option>
|
||||
<option value="3">3</option>
|
||||
<option value="4">4</option>
|
||||
</select>
|
||||
</td>
|
||||
<td style="width: 28%;" ><div class="child-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($child_min_age) ? $child_min_age : '0'; ?>" style="width: 18%;" type="number" name="child_min_age" id="child_min_age"></div></td>
|
||||
<td style="width: 28%;" ><div class="child-age"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($child_max_age) ? $child_max_age : '25'; ?>" style="width: 18%;" type="number" name="child_max_age" id="child_max_age"></div></td>
|
||||
</tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div style="margin-top:10px">
|
||||
|
||||
</div>
|
||||
<div style="margin-top:10px">
|
||||
|
||||
|
||||
</div>
|
||||
<div style="margin-top:10px">
|
||||
<span for="family_floaters">Select Other Members:</span>
|
||||
<select name="family_floaters[]" id="family_floaters" style="margin-left: 10px;">
|
||||
<option value="0">None</option>
|
||||
<option value="1P">Only one parent (Either Father / Mother)</option>
|
||||
<option value="2P">Only two parents (Father+Mother)</option>
|
||||
<option value="1PIL">Only one parent in law (Either MIL / FIL)</option>
|
||||
<option value="2PIL">Only two parents in law (FIL + MIL)</option>
|
||||
<option value="2EPORPIL">Parents or PIL (Any two of Father, Mother, MIl, FIL)</option>
|
||||
<option value="EPORPIL">Either Parents or PIL (Parents or Parents In Law)</option>
|
||||
<option valueCONFLICT="4EPORPIL">Parents + PIL (Father + Mother + MIL + FIL)</option>
|
||||
</select>
|
||||
</div>
|
||||
<div style="margin-top:10px">
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="width: 22%;" ><div class="other-member-age"><span style="margin-right: 20px;">Elders Count:</span><input class="underline-input" id="member_count" style="width: 18%;" type="number" name="member_count" disabled id="member_count"></div></td>
|
||||
<td style="width: 28%;" ><div class="other-member-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($other_member_min_age) ? $other_member_min_age : '18'; ?>" style="width: 18%;" type="number" class="underline-input min_age" name="other_member_min_age" id="other_member_min_age"></div></td>
|
||||
<td style="width: 28%;" ><div class="other-member-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input max_age" value="<?php echo isset($other_member_max_age) ? $other_member_max_age : '60'; ?>" style="width: 18%;" type="number" class="underline-input max_age" name="other_member_max_age" id="other_member_max_age"></div></td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;display:none;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Corporate Buffer</label>
|
||||
<div class="row" style="margin-bottom: 10px;display:none;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Corporate Buffer</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="radio" name="corporatebuffer" value="1"> Yes
|
||||
<input type="radio" name="corporatebuffer" value="0" style="margin-left:10px"> No
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="radio" name="corporatebuffer" value="1"> Yes
|
||||
<input type="radio" name="corporatebuffer" value="0" style="margin-left:10px"> No
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
@ -526,6 +569,7 @@
|
||||
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
var policy_grid_id = $('#client_id').val();
|
||||
var grid_html = '';
|
||||
@ -581,6 +625,28 @@
|
||||
|
||||
$("#policyJsonForm").submit(function(event) {
|
||||
|
||||
|
||||
if (!$('#self').prop('checked')) {
|
||||
$('#self_min_age').removeAttr('name')
|
||||
$('#self_max_age').removeAttr('name')
|
||||
}
|
||||
|
||||
if (!$('#spouse').prop('checked')) {
|
||||
$('#spouse_min_age').removeAttr('name');
|
||||
$('#spouse_max_age').removeAttr('name');
|
||||
}
|
||||
|
||||
if ($('#children').val() == 0) {
|
||||
$('#child_min_age').removeAttr('name');
|
||||
$('#child_min_age').removeAttr('name');
|
||||
}
|
||||
|
||||
if ($('#family_floaters').val() == 0) {
|
||||
$('#member_count').removeAttr('name');
|
||||
$('#other_member_min_age').removeAttr('name');
|
||||
$('#other_member_max_age').removeAttr('name');
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
var isValid = $('#policyJsonForm').parsley().validate();
|
||||
|
||||
@ -716,6 +782,7 @@
|
||||
|
||||
let jsonObject = JSON.parse(response.data);
|
||||
Object.keys(jsonObject).forEach(function(key) {
|
||||
|
||||
if (key.includes("special_condition_label") || key.includes("special_condition_input")) {
|
||||
if (key.includes("special_condition_label")) {
|
||||
for (let index = 0; index < jsonObject[key].length; index++) {
|
||||
@ -734,7 +801,9 @@
|
||||
if (key.includes("family_floaters")) {
|
||||
let checkboxes = document.querySelectorAll(`input[name="${key}[]"]`);
|
||||
if (jsonObject[key]) {
|
||||
|
||||
console.log(jsonObject[key]);
|
||||
// console.log(jsonObject[key]);
|
||||
if (jsonObject[key].childrens) {
|
||||
$('#children').val(jsonObject[key].childrens);
|
||||
}
|
||||
@ -863,6 +932,22 @@
|
||||
element.value = jsonObject[key];
|
||||
}
|
||||
}
|
||||
|
||||
if (key.includes("age_ratio")) {
|
||||
|
||||
$('#self_min_age').val(jsonObject[key].self.min);
|
||||
$('#self_max_age').val(jsonObject[key].self.max);
|
||||
|
||||
$('#spouse_min_age').val(jsonObject[key].spouse.min);
|
||||
$('#spouse_max_age').val(jsonObject[key].spouse.max);
|
||||
|
||||
$('#child_min_age').val(jsonObject[key].child.min);
|
||||
$('#child_max_age').val(jsonObject[key].child.max);
|
||||
|
||||
$('#other_member_min_age').val(jsonObject[key].elders.min);
|
||||
$('#other_member_max_age').val(jsonObject[key].elders.max);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
$("#sum_insured").trigger("keyup");
|
||||
@ -871,6 +956,51 @@
|
||||
$(this).click();
|
||||
});
|
||||
|
||||
if ($('#self').prop('checked')) {
|
||||
$('.self-age').css('display','');
|
||||
} else {
|
||||
$('.self-age').css('display','none');
|
||||
}
|
||||
|
||||
if ($('#spouse').prop('checked')) {
|
||||
$('.spouse-age').css('display','');
|
||||
} else {
|
||||
$('.spouse-age').css('display','none');
|
||||
}
|
||||
|
||||
console.log("child ");
|
||||
console.log($('#children').val());
|
||||
|
||||
if($('#children').val() != 0){
|
||||
$('.child-age').css('display','');
|
||||
}else{
|
||||
$('.child-age').css('display','none');
|
||||
}
|
||||
|
||||
var family_floaters = $('#family_floaters').val();
|
||||
if(family_floaters != 0){
|
||||
$('.other-member-age').css('display','');
|
||||
}else{
|
||||
$('.other-member-age').css('display','none');
|
||||
}
|
||||
|
||||
if (family_floaters == '1P') {
|
||||
$('#member_count').val(1);
|
||||
}else if(family_floaters == '2P'){
|
||||
$('#member_count').val(2);
|
||||
}else if(family_floaters == '1PIL'){
|
||||
$('#member_count').val(1);
|
||||
}else if(family_floaters == '2PIL'){
|
||||
$('#member_count').val(2);
|
||||
}else if(family_floaters == '2EPORPIL'){
|
||||
$('#member_count').val(2);
|
||||
}else if(family_floaters == 'EPORPIL'){
|
||||
$('#member_count').val(2);
|
||||
}else if(family_floaters == '4EPORPIL'){
|
||||
$('#member_count').val(4);
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
|
||||
error: function(xhr, status, error) {
|
||||
@ -887,6 +1017,53 @@
|
||||
// toastr.warning('The terms has no data ', 'warning');
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
if ($('#self').prop('checked')) {
|
||||
$('.self-age').css('display','');
|
||||
} else {
|
||||
$('.self-age').css('display','none');
|
||||
}
|
||||
|
||||
if ($('#spouse').prop('checked')) {
|
||||
$('.spouse-age').css('display','');
|
||||
} else {
|
||||
$('.spouse-age').css('display','none');
|
||||
}
|
||||
|
||||
console.log("child ");
|
||||
console.log($('#children').val());
|
||||
|
||||
if($('#children').val() != 0){
|
||||
$('.child-age').css('display','');
|
||||
}else{
|
||||
$('.child-age').css('display','none');
|
||||
}
|
||||
|
||||
var family_floaters = $('#family_floaters').val();
|
||||
if(family_floaters != 0){
|
||||
$('.other-member-age').css('display','');
|
||||
}else{
|
||||
$('.other-member-age').css('display','none');
|
||||
}
|
||||
|
||||
if (family_floaters == '1P') {
|
||||
$('#member_count').val(1);
|
||||
}else if(family_floaters == '2P'){
|
||||
$('#member_count').val(2);
|
||||
}else if(family_floaters == '1PIL'){
|
||||
$('#member_count').val(1);
|
||||
}else if(family_floaters == '2PIL'){
|
||||
$('#member_count').val(2);
|
||||
}else if(family_floaters == '2EPORPIL'){
|
||||
$('#member_count').val(2);
|
||||
}else if(family_floaters == 'EPORPIL'){
|
||||
$('#member_count').val(2);
|
||||
}else if(family_floaters == '4EPORPIL'){
|
||||
$('#member_count').val(4);
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
$("#sum_insured").on("keyup", function() {
|
||||
@ -982,4 +1159,60 @@
|
||||
// // Update the input value
|
||||
// input.value = value;
|
||||
// }
|
||||
|
||||
|
||||
$('#self').change(function () {
|
||||
if ($(this).prop('checked')) {
|
||||
$('.self-age').css('display','');
|
||||
}else{
|
||||
$('.self-age').css('display','none');
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
$('#spouse').change(function () {
|
||||
if ($(this).prop('checked')) {
|
||||
$('.spouse-age').css('display','');
|
||||
}else{
|
||||
$('.spouse-age').css('display','none');
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
$('#children').change(function () {
|
||||
if ($(this).val() != 0) {
|
||||
$('.child-age').css('display','');
|
||||
}else{
|
||||
$('.child-age').css('display','none');
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
$('#family_floaters').change(function () {
|
||||
|
||||
var family_floaters = $(this).val();
|
||||
if($('#family_floaters').val() != 0){
|
||||
$('.other-member-age').css('display','');
|
||||
}else{
|
||||
$('.other-member-age').css('display','none');
|
||||
}
|
||||
|
||||
if (family_floaters == '1P') {
|
||||
$('#member_count').val(1);
|
||||
}else if(family_floaters == '2P'){
|
||||
$('#member_count').val(2);
|
||||
}else if(family_floaters == '1PIL'){
|
||||
$('#member_count').val(1);
|
||||
}else if(family_floaters == '2PIL'){
|
||||
$('#member_count').val(2);
|
||||
}else if(family_floaters == '2EPORPIL'){
|
||||
$('#member_count').val(2);
|
||||
}else if(family_floaters == 'EPORPIL'){
|
||||
$('#member_count').val(2);
|
||||
}else if(family_floaters == '4EPORPIL'){
|
||||
$('#member_count').val(4);
|
||||
}
|
||||
})
|
||||
|
||||
</script>
|
||||
@ -85,207 +85,247 @@
|
||||
<input type="hidden" id="emp_count" />
|
||||
<div class="form-group">
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="sumInsured">Sum Insured</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input class="form-control" type="text" name="sumInsured2" id="sumInsured2" onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this)" style="width: 100% !important;">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div id='numberToWordSumInsured' class="text-danger-2"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
|
||||
<div class="col-md-6">
|
||||
<label for="sumInsured">Sum Insured</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input class="form-control" type="text" name="sumInsured2" id="sumInsured2" onkeypress = "return onlyNumbers(event)" onkeyup="formatNumber(this)" style="width: 100% !important;">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div id='numberToWordSumInsured' class="text-danger-2" ></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Total Sum Insured</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" style="width: 100% !important;" class="form-control" name="totalSumInsured" id="totalSumInsured" onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this)">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div id='numberToWordTotalSumInsured' class="text-danger-2"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Accidental Death Benefit</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="radio" name="accidentalDeathBenefit" value="1"> Yes
|
||||
<input type="radio" name="accidentalDeathBenefit" value="0" style="margin-left:10px" checked> No
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Permanent Total Disablement</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="permanentTotalDisablement" id="permanentTotalDisablement" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Permanent Partial Disablement</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="permanentPartialDisablement" id="permanentPartialDisablement" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Temporary Total Disablement benefit</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="temporaryTotalDisablementBenefit" id="temporaryTotalDisablementBenefit" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Accidental Hospitalization Expenses</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<select name="accidentalHospitalizationExpenses" id="accidentalHospitalizationExpenses" class="form-control">
|
||||
<option value="">Select an option</option>
|
||||
<option value="No">No</option>
|
||||
<option value="10%-40%">Covered upto 10% of SI or 40% of actual which ever is less</option>
|
||||
<option value="20%-50%">Covered upto 20% of SI or 50% of actual which ever is less</option>
|
||||
<option value="50K-500k">INR 50K, to vary in multiples of 25K till 5 Lacs</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Children Education Welfare Fund</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<select name="childrenEducationWelfareFund" id="childrenEducationWelfareFund" class="form-control">
|
||||
<option value="">Select an option</option>
|
||||
<option value="No">No</option>
|
||||
<option value="10000">Covered upto 10,000/ per child ( Restricted to 2 children)</option>
|
||||
<option value="5000">Covered upto 5,000/ per child ( Restricted to 2 children)</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Compassionate Visit Expenses</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="radio" name="compassionateVisitExpenses" value="1"> Yes
|
||||
<input type="radio" name="compassionateVisitExpenses" value="0" style="margin-left:10px" checked> No
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;display:none;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Compassionate Visit Expenses Data</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="compassionateVisitExpensesData" id="compassionateVisitExpensesData" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Broken Bone Expenses</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="radio" name="brokenBoneExpenses" value="1"> Yes
|
||||
<input type="radio" name="brokenBoneExpenses" value="0" style="margin-left:10px" checked> No
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;display:none;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Broken Bone Expenses Data</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="brokenBoneExpensesData" id="brokenBoneExpensesData" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured"> Ambulance charges</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="radio" name="ambulanceCharges" value="1"> Yes
|
||||
<input type="radio" name="ambulanceCharges" value="0" style="margin-left:10px" checked> No
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;display:none;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Ambulance charges Data</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="ambulanceChargesData" id="ambulanceChargesData" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured"> Burn Expenses</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="radio" name="burnExpenses" value="1"> Yes
|
||||
<input type="radio" name="burnExpenses" value="0" style="margin-left:10px" checked> No
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;display:none;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Burn Expenses Data</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="burnExpensesData" id="burnExpensesData" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Carriage of Dead Body</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="radio" name="carriageOfDeadBody" value="1"> Yes
|
||||
<input type="radio" name="carriageOfDeadBody" value="0" style="margin-left:10px" checked> No
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;display:none;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Carriage of Dead Body Data</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="carriageOfDeadBodyData" id="carriageOfDeadBodyData" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Animal/Snake/Insect bite</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="radio" name="animalSnakeInsectBite" value="1"> Yes
|
||||
<input type="radio" name="animalSnakeInsectBite" value="0" style="margin-left:10px" checked> No
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Terrorism</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="radio" name="terrorism" value="1"> Yes
|
||||
<input type="radio" name="terrorism" value="0" style="margin-left:10px" checked> No
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Total Sum Insured</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" style="width: 100% !important;" class="form-control" name="totalSumInsured" id="totalSumInsured" onkeypress = "return onlyNumbers(event)" onkeyup="formatNumber(this)">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div id='numberToWordTotalSumInsured' class="text-danger-2" ></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for=""></label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<table>
|
||||
<tbody>
|
||||
<tr><td></td></tr><tr><td></td></tr><tr><td></td></tr>
|
||||
<tr>
|
||||
<td style="width: 5%;">
|
||||
<span style="margin-right: 20px;">Self:</span>
|
||||
</td>
|
||||
<td style="width: 11%;">
|
||||
<input disabled type="checkbox" style="margin-right: 70px;" name="family_floaters[]" value="self" id="self" checked>
|
||||
</td>
|
||||
<td style="width: 20%;">
|
||||
<div class="self-age">
|
||||
<span style="margin-right: 20px;">Min Age:</span>
|
||||
<input class="underline-input min_age" value="<?php echo isset($self_min_age) ? $self_min_age : '18'; ?>" style="width: 35%;" type="number" name="self_min_age" id="self_min_age_gpa">
|
||||
</div>
|
||||
</td>
|
||||
<td style="width: 20%;">
|
||||
<div class="self-age">
|
||||
<span style="margin-right: 20px;">Max Age:</span>
|
||||
<input class="underline-input max_age" value="<?php echo isset($self_max_age) ? $self_max_age : '60'; ?>" style="width: 35%;" type="number" name="self_max_age" id="self_max_age_gpa">
|
||||
</div>
|
||||
</td>
|
||||
<td ></td>
|
||||
</tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Accidental Death Benefit</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="radio" name="accidentalDeathBenefit" value="1"> Yes
|
||||
<input type="radio" name="accidentalDeathBenefit" value="0" style="margin-left:10px" checked> No
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Permanent Total Disablement</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="permanentTotalDisablement" id="permanentTotalDisablement" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Permanent Partial Disablement</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="permanentPartialDisablement" id="permanentPartialDisablement" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Temporary Total Disablement benefit</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="temporaryTotalDisablementBenefit" id="temporaryTotalDisablementBenefit" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Accidental Hospitalization Expenses</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<select name="accidentalHospitalizationExpenses" id="accidentalHospitalizationExpenses" class="form-control">
|
||||
<option value="">Select an option</option>
|
||||
<option value="No">No</option>
|
||||
<option value="10%-40%">Covered upto 10% of SI or 40% of actual which ever is less</option>
|
||||
<option value="20%-50%">Covered upto 20% of SI or 50% of actual which ever is less</option>
|
||||
<option value="50K-500k">INR 50K, to vary in multiples of 25K till 5 Lacs</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Children Education Welfare Fund</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<select name="childrenEducationWelfareFund" id="childrenEducationWelfareFund" class="form-control">
|
||||
<option value="">Select an option</option>
|
||||
<option value="No">No</option>
|
||||
<option value="10000">Covered upto 10,000/ per child ( Restricted to 2 children)</option>
|
||||
<option value="5000">Covered upto 5,000/ per child ( Restricted to 2 children)</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Compassionate Visit Expenses</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="radio" name="compassionateVisitExpenses" value="1"> Yes
|
||||
<input type="radio" name="compassionateVisitExpenses" value="0" style="margin-left:10px" checked> No
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;display:none;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Compassionate Visit Expenses Data</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="compassionateVisitExpensesData" id="compassionateVisitExpensesData" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Broken Bone Expenses</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="radio" name="brokenBoneExpenses" value="1"> Yes
|
||||
<input type="radio" name="brokenBoneExpenses" value="0" style="margin-left:10px" checked> No
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;display:none;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Broken Bone Expenses Data</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="brokenBoneExpensesData" id="brokenBoneExpensesData" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured"> Ambulance charges</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="radio" name="ambulanceCharges" value="1"> Yes
|
||||
<input type="radio" name="ambulanceCharges" value="0" style="margin-left:10px" checked> No
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;display:none;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Ambulance charges Data</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="ambulanceChargesData" id="ambulanceChargesData" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured"> Burn Expenses</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="radio" name="burnExpenses" value="1"> Yes
|
||||
<input type="radio" name="burnExpenses" value="0" style="margin-left:10px" checked> No
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;display:none;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Burn Expenses Data</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="burnExpensesData" id="burnExpensesData" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Carriage of Dead Body</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="radio" name="carriageOfDeadBody" value="1"> Yes
|
||||
<input type="radio" name="carriageOfDeadBody" value="0" style="margin-left:10px" checked> No
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;display:none;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Carriage of Dead Body Data</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="carriageOfDeadBodyData" id="carriageOfDeadBodyData" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Animal/Snake/Insect bite</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="radio" name="animalSnakeInsectBite" value="1"> Yes
|
||||
<input type="radio" name="animalSnakeInsectBite" value="0" style="margin-left:10px" checked> No
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Terrorism</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="radio" name="terrorism" value="1"> Yes
|
||||
<input type="radio" name="terrorism" value="0" style="margin-left:10px" checked> No
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Worldwide Cover</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="radio" name="worldwideCover" value="1"> Yes
|
||||
<input type="radio" name="worldwideCover" value="0" style="margin-left:10px" checked> No
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Worldwide Cover</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="radio" name="worldwideCover" value="1"> Yes
|
||||
<input type="radio" name="worldwideCover" value="0" style="margin-left:10px" checked> No
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
@ -385,6 +425,12 @@
|
||||
|
||||
|
||||
$("#policyGPATerms").submit(function(event) {
|
||||
|
||||
|
||||
if (!$('#self').prop('checked')) {
|
||||
$('#self_min_age_gpa').removeAttr('name')
|
||||
$('#self_max_age_gpa').removeAttr('name')
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
var isValid = $('#policyGPATerms').parsley().validate();
|
||||
@ -563,6 +609,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
if (key.includes("age_ratio")) {
|
||||
console.log("-------------------------");
|
||||
console.log(jsonObject[key]);
|
||||
console.log(jsonObject[key].self);
|
||||
console.log(jsonObject[key].self.min);
|
||||
|
||||
$('#self_min_age_gpa').val(jsonObject[key].self.min);
|
||||
$('#self_max_age_gpa').val(jsonObject[key].self.max);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
Binary file not shown.
Loading…
Reference in New Issue
Block a user