Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
745019faa7
@ -743,7 +743,7 @@ class ClientController extends AdminController
|
|||||||
$client_id = $this->request->getPost('client_id');
|
$client_id = $this->request->getPost('client_id');
|
||||||
$client_policy_id = $this->request->getPost('client_policy_id');
|
$client_policy_id = $this->request->getPost('client_policy_id');
|
||||||
$premium_type = $this->request->getPost('premium_type');
|
$premium_type = $this->request->getPost('premium_type');
|
||||||
if(!empty($client_id) && $client_id != null){
|
if (!empty($client_id) && $client_id != null) {
|
||||||
$client_policy_data = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
$client_policy_data = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
||||||
$client_id = $client_policy_data['client_id'];
|
$client_id = $client_policy_data['client_id'];
|
||||||
}
|
}
|
||||||
@ -754,7 +754,7 @@ class ClientController extends AdminController
|
|||||||
$multiplier = str_replace(',', '', $this->request->getPost('multiplier'));
|
$multiplier = str_replace(',', '', $this->request->getPost('multiplier'));
|
||||||
$basic_pay = str_replace(',', '', $this->request->getPost('basic_pay'));
|
$basic_pay = str_replace(',', '', $this->request->getPost('basic_pay'));
|
||||||
|
|
||||||
$data=[];
|
$data = [];
|
||||||
$data['client_id'] = $client_id;
|
$data['client_id'] = $client_id;
|
||||||
$data['client_policy_id'] = $client_policy_id;
|
$data['client_policy_id'] = $client_policy_id;
|
||||||
$data['policy_grid_id'] = $policy_grid_id;
|
$data['policy_grid_id'] = $policy_grid_id;
|
||||||
@ -770,18 +770,18 @@ class ClientController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if($policy_grid_id == '1'){
|
if ($policy_grid_id == '1') {
|
||||||
if ($si_or_bp == '1') {
|
if ($si_or_bp == '1') {
|
||||||
$premium=str_replace(',', '', $this->request->getPost('gpa_sum_premium[]'));
|
$premium = str_replace(',', '', $this->request->getPost('gpa_sum_premium[]'));
|
||||||
$sum_insure=str_replace(',', '', $this->request->getPost('gpa_sum_si[]'));
|
$sum_insure = str_replace(',', '', $this->request->getPost('gpa_sum_si[]'));
|
||||||
$multiplier=$this->request->getPost('gpa_sum_multiplier');
|
$multiplier = $this->request->getPost('gpa_sum_multiplier');
|
||||||
for ($i=0; $i < count($premium) ; $i++) {
|
for ($i = 0; $i < count($premium); $i++) {
|
||||||
$data['si'] = $sum_insure[$i];
|
$data['si'] = $sum_insure[$i];
|
||||||
$data['premium'] = $premium[$i];
|
$data['premium'] = $premium[$i];
|
||||||
$data['multiplier'] = $multiplier;
|
$data['multiplier'] = $multiplier;
|
||||||
$data['si_or_bp'] = $this->request->getPost('si_or_bp');
|
$data['si_or_bp'] = $this->request->getPost('si_or_bp');
|
||||||
|
|
||||||
$policyPremium= $this->policyPremium1Model->insert($data);
|
$policyPremium = $this->policyPremium1Model->insert($data);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$data['premium'] = str_replace(',', '', $this->request->getPost('gpa_basic_premium'));
|
$data['premium'] = str_replace(',', '', $this->request->getPost('gpa_basic_premium'));
|
||||||
@ -791,175 +791,180 @@ class ClientController extends AdminController
|
|||||||
$data['basic_pay'] = str_replace(',', '', $this->request->getPost('basic_pay'));
|
$data['basic_pay'] = str_replace(',', '', $this->request->getPost('basic_pay'));
|
||||||
$data['si_or_bp'] = $this->request->getPost('si_or_bp');
|
$data['si_or_bp'] = $this->request->getPost('si_or_bp');
|
||||||
|
|
||||||
$policyPremium= $this->policyPremium1Model->insert($data);
|
$policyPremium = $this->policyPremium1Model->insert($data);
|
||||||
}
|
}
|
||||||
$data = $this->request->getPost();
|
$data = $this->request->getPost();
|
||||||
$insert = true;
|
$insert = true;
|
||||||
}else if($policy_grid_id == '2'){
|
} else if ($policy_grid_id == '2') {
|
||||||
$data['premium'] = str_replace(',', '', $this->request->getPost('gpa_premium'));
|
$data['premium'] = str_replace(',', '', $this->request->getPost('gpa_premium'));
|
||||||
$data['si'] = str_replace(',', '', $this->request->getPost('gpa_si'));
|
$data['si'] = str_replace(',', '', $this->request->getPost('gpa_si'));
|
||||||
|
|
||||||
$policyPremium= $this->policyPremium1Model->insert($data);
|
$policyPremium = $this->policyPremium1Model->insert($data);
|
||||||
|
|
||||||
$data = $this->request->getPost();
|
$data = $this->request->getPost();
|
||||||
$insert = true;
|
$insert = true;
|
||||||
}else if($policy_grid_id == '3'){
|
} else if ($policy_grid_id == '3') {
|
||||||
$premium=$this->request->getPost('3_premium[]');
|
$premium = $this->request->getPost('3_premium[]');
|
||||||
$sum_insure =$this->request->getPost('3_si[]');
|
$sum_insure = $this->request->getPost('3_si[]');
|
||||||
for ($i=0; $i < count($premium) ; $i++) {
|
for ($i = 0; $i < count($premium); $i++) {
|
||||||
$data['premium'] = str_replace(',', '',$premium[$i]);
|
$data['premium'] = str_replace(',', '', $premium[$i]);
|
||||||
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
||||||
$dataa= $this->policyPremium2Model->insert($data);
|
$dataa = $this->policyPremium2Model->insert($data);
|
||||||
}
|
}
|
||||||
$data = $this->request->getPost();
|
$data = $this->request->getPost();
|
||||||
$insert = true;
|
$insert = true;
|
||||||
}else if($policy_grid_id == '4'){
|
} else if ($policy_grid_id == '4') {
|
||||||
$premium=$this->request->getPost('4_premium[]');
|
$premium = $this->request->getPost('4_premium[]');
|
||||||
$sum_insure =$this->request->getPost('4_si');
|
$sum_insure = $this->request->getPost('4_si');
|
||||||
$age_from =$this->request->getPost('4_age_from[]');
|
$age_from = $this->request->getPost('4_age_from[]');
|
||||||
$age_to =$this->request->getPost('4_age_to[]');
|
$age_to = $this->request->getPost('4_age_to[]');
|
||||||
for ($i=0; $i < count($premium) ; $i++) {
|
for ($i = 0; $i < count($premium); $i++) {
|
||||||
$data['premium'] = str_replace(',', '',$premium[$i]);
|
$data['premium'] = str_replace(',', '', $premium[$i]);
|
||||||
$data['si'] = str_replace(',', '', $sum_insure);
|
$data['si'] = str_replace(',', '', $sum_insure);
|
||||||
$data['age_from'] = $age_from[$i];
|
$data['age_from'] = $age_from[$i];
|
||||||
$data['age_to'] = $age_to[$i];
|
$data['age_to'] = $age_to[$i];
|
||||||
$dataa= $this->policyPremium2Model->insert($data);
|
$dataa = $this->policyPremium2Model->insert($data);
|
||||||
}
|
}
|
||||||
$data = $this->request->getPost();
|
$data = $this->request->getPost();
|
||||||
$insert = true;
|
$insert = true;
|
||||||
}else if($policy_grid_id == '5'){
|
} else if ($policy_grid_id == '5') {
|
||||||
$premium=$this->request->getPost('5_premium[]');
|
$premium = $this->request->getPost('5_premium[]');
|
||||||
$sum_insure =$this->request->getPost('5_si[]');
|
$sum_insure = $this->request->getPost('5_si[]');
|
||||||
$age_from =$this->request->getPost('5_age_from[]');
|
$age_from = $this->request->getPost('5_age_from[]');
|
||||||
$age_to =$this->request->getPost('5_age_to[]');
|
$age_to = $this->request->getPost('5_age_to[]');
|
||||||
for ($i=0; $i < count($premium) ; $i++) {
|
for ($i = 0; $i < count($premium); $i++) {
|
||||||
$data['premium'] = str_replace(',', '',$premium[$i]);
|
$data['premium'] = str_replace(',', '', $premium[$i]);
|
||||||
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
||||||
$data['age_from'] = $age_from[$i];
|
$data['age_from'] = $age_from[$i];
|
||||||
$data['age_to'] = $age_to[$i];
|
$data['age_to'] = $age_to[$i];
|
||||||
$dataa= $this->policyPremium2Model->insert($data);
|
$dataa = $this->policyPremium2Model->insert($data);
|
||||||
}
|
}
|
||||||
$data = $this->request->getPost();
|
$data = $this->request->getPost();
|
||||||
$insert = true;
|
$insert = true;
|
||||||
}else if($policy_grid_id == '6'){
|
} else if ($policy_grid_id == '6') {
|
||||||
$premium=$this->request->getPost('6_premium[]');
|
$premium = $this->request->getPost('6_premium[]');
|
||||||
$sum_insure =$this->request->getPost('6_si[]');
|
$sum_insure = $this->request->getPost('6_si[]');
|
||||||
$age_from =$this->request->getPost('6_age_from[]');
|
$age_from = $this->request->getPost('6_age_from[]');
|
||||||
$age_to =$this->request->getPost('6_age_to[]');
|
$age_to = $this->request->getPost('6_age_to[]');
|
||||||
for ($i=0; $i < count($premium) ; $i++) {
|
for ($i = 0; $i < count($premium); $i++) {
|
||||||
$data['premium'] = str_replace(',', '',$premium[$i]);
|
$data['premium'] = str_replace(',', '', $premium[$i]);
|
||||||
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
||||||
$data['age_from'] = $age_from[$i];
|
$data['age_from'] = $age_from[$i];
|
||||||
$data['age_to'] = $age_to[$i];
|
$data['age_to'] = $age_to[$i];
|
||||||
$dataa= $this->policyPremium2Model->insert($data);
|
$dataa = $this->policyPremium2Model->insert($data);
|
||||||
}
|
}
|
||||||
$data = $this->request->getPost();
|
$data = $this->request->getPost();
|
||||||
$insert = true;
|
$insert = true;
|
||||||
}else if($policy_grid_id == '7'){
|
} else if ($policy_grid_id == '7') {
|
||||||
$premium=$this->request->getPost('7_premium[]');
|
$premium = $this->request->getPost('7_premium[]');
|
||||||
$sum_insure =$this->request->getPost('7_si[]');
|
$sum_insure = $this->request->getPost('7_si[]');
|
||||||
$age_from =$this->request->getPost('7_age_from[]');
|
$age_from = $this->request->getPost('7_age_from[]');
|
||||||
$age_to =$this->request->getPost('7_age_to[]');
|
$age_to = $this->request->getPost('7_age_to[]');
|
||||||
for ($i=0; $i < count($premium) ; $i++) {
|
for ($i = 0; $i < count($premium); $i++) {
|
||||||
$data['premium'] = str_replace(',', '',$premium[$i]);
|
$data['premium'] = str_replace(',', '', $premium[$i]);
|
||||||
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
||||||
$data['age_from'] = $age_from[$i];
|
$data['age_from'] = $age_from[$i];
|
||||||
$data['age_to'] = $age_to[$i];
|
$data['age_to'] = $age_to[$i];
|
||||||
$dataa= $this->policyPremium2Model->insert($data);
|
$dataa = $this->policyPremium2Model->insert($data);
|
||||||
}
|
}
|
||||||
$data = $this->request->getPost();
|
$data = $this->request->getPost();
|
||||||
$insert = true;
|
$insert = true;
|
||||||
}else if($policy_grid_id == '8'){
|
} else if ($policy_grid_id == '8') {
|
||||||
$premium=$this->request->getPost('8_premium[]');
|
$premium = $this->request->getPost('8_premium[]');
|
||||||
$sum_insure =$this->request->getPost('8_si[]');
|
$sum_insure = $this->request->getPost('8_si[]');
|
||||||
$grade =$this->request->getPost('8_grade[]');
|
$grade = $this->request->getPost('8_grade[]');
|
||||||
for ($i=0; $i < count($premium) ; $i++) {
|
for ($i = 0; $i < count($premium); $i++) {
|
||||||
$data['premium'] = str_replace(',', '',$premium[$i]);
|
$data['premium'] = str_replace(',', '', $premium[$i]);
|
||||||
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
||||||
$data['grade'] = $grade[$i];
|
$data['grade'] = $grade[$i];
|
||||||
$dataa= $this->policyPremium2Model->insert($data);
|
$dataa = $this->policyPremium2Model->insert($data);
|
||||||
}
|
}
|
||||||
$data = $this->request->getPost();
|
$data = $this->request->getPost();
|
||||||
$insert = true;
|
$insert = true;
|
||||||
}else if($policy_grid_id == '9'){
|
} else if ($policy_grid_id == '9') {
|
||||||
$premium=$this->request->getPost('9_premium[]');
|
|
||||||
$sum_insure =$this->request->getPost('9_si[]');
|
$data['premium'] = str_replace(',', '', $this->request->getPost('gpa_premium'));
|
||||||
$grade =$this->request->getPost('9_grade[]');
|
$data['si'] = str_replace(',', '', $this->request->getPost('gpa_si'));
|
||||||
for ($i=0; $i < count($premium) ; $i++) {
|
|
||||||
$data['premium'] = str_replace(',', '',$premium[$i]);
|
$policyPremium = $this->policyPremium2Model->insert($data);
|
||||||
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
// $premium = $this->request->getPost('9_premium[]');
|
||||||
$data['grade'] = $grade[$i];
|
// $sum_insure = $this->request->getPost('9_si[]');
|
||||||
$dataa= $this->policyPremium2Model->insert($data);
|
// $grade = $this->request->getPost('9_grade[]');
|
||||||
}
|
// for ($i = 0; $i < count($premium); $i++) {
|
||||||
|
// $data['premium'] = str_replace(',', '', $premium[$i]);
|
||||||
|
// $data['si'] = str_replace(',', '', $sum_insure[$i]);
|
||||||
|
// // $data['grade'] = $grade[$i];
|
||||||
|
// $dataa = $this->policyPremium2Model->insert($data);
|
||||||
|
// }
|
||||||
$data = $this->request->getPost();
|
$data = $this->request->getPost();
|
||||||
$insert = true;
|
$insert = true;
|
||||||
}else if($policy_grid_id == '10'){
|
} else if ($policy_grid_id == '10') {
|
||||||
$premium=$this->request->getPost('10_premium[]');
|
$premium = $this->request->getPost('10_premium[]');
|
||||||
$sum_insure =$this->request->getPost('10_si[]');
|
$sum_insure = $this->request->getPost('10_si[]');
|
||||||
$age_from =$this->request->getPost('10_age_from[]');
|
$age_from = $this->request->getPost('10_age_from[]');
|
||||||
$age_to =$this->request->getPost('10_age_to[]');
|
$age_to = $this->request->getPost('10_age_to[]');
|
||||||
for ($i=0; $i < count($premium) ; $i++) {
|
for ($i = 0; $i < count($premium); $i++) {
|
||||||
$data['premium'] = str_replace(',', '',$premium[$i]);
|
$data['premium'] = str_replace(',', '', $premium[$i]);
|
||||||
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
||||||
$data['age_from'] = $age_from[$i];
|
$data['age_from'] = $age_from[$i];
|
||||||
$data['age_to'] = $age_to[$i];
|
$data['age_to'] = $age_to[$i];
|
||||||
$policyPremium= $this->policyPremium2Model->insert($data);
|
$policyPremium = $this->policyPremium2Model->insert($data);
|
||||||
}
|
}
|
||||||
$data = $this->request->getPost();
|
$data = $this->request->getPost();
|
||||||
$insert = true;
|
$insert = true;
|
||||||
}else if($policy_grid_id == '11'){
|
} else if ($policy_grid_id == '11') {
|
||||||
$premium=$this->request->getPost('11_premium[]');
|
$premium = $this->request->getPost('11_premium[]');
|
||||||
$sum_insure =$this->request->getPost('11_si[]');
|
$sum_insure = $this->request->getPost('11_si[]');
|
||||||
$grade =$this->request->getPost('11_grade[]');
|
$grade = $this->request->getPost('11_grade[]');
|
||||||
$max_sum_insure =$this->request->getPost('11_max_si[]');
|
$max_sum_insure = $this->request->getPost('11_max_si[]');
|
||||||
for ($i=0; $i < count($premium) ; $i++) {
|
for ($i = 0; $i < count($premium); $i++) {
|
||||||
$data['premium'] = str_replace(',', '',$premium[$i]);
|
$data['premium'] = str_replace(',', '', $premium[$i]);
|
||||||
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
||||||
$data['grade'] = $grade[$i];
|
$data['grade'] = $grade[$i];
|
||||||
$data['max_si'] = $max_sum_insure[$i];
|
$data['max_si'] = $max_sum_insure[$i];
|
||||||
$dataa= $this->policyPremium2Model->insert($data);
|
$dataa = $this->policyPremium2Model->insert($data);
|
||||||
}
|
}
|
||||||
$data = $this->request->getPost();
|
$data = $this->request->getPost();
|
||||||
$insert = true;
|
$insert = true;
|
||||||
}else if($policy_grid_id == '12'){
|
} else if ($policy_grid_id == '12') {
|
||||||
|
|
||||||
$premium=$this->request->getPost('12_premium[]');
|
$premium = $this->request->getPost('12_premium[]');
|
||||||
$sum_insure =$this->request->getPost('12_si[]');
|
$sum_insure = $this->request->getPost('12_si[]');
|
||||||
$relationship =$this->request->getPost('12_relationship[]');
|
$relationship = $this->request->getPost('12_relationship[]');
|
||||||
for ($i=0; $i < count($premium) ; $i++) {
|
for ($i = 0; $i < count($premium); $i++) {
|
||||||
$data['premium'] = str_replace(',', '',$premium[$i]);
|
$data['premium'] = str_replace(',', '', $premium[$i]);
|
||||||
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
||||||
$data['relationship'] = $relationship[$i];
|
$data['relationship'] = $relationship[$i];
|
||||||
|
|
||||||
$dataa= $this->policyPremium2Model->insert($data);
|
$dataa = $this->policyPremium2Model->insert($data);
|
||||||
}
|
}
|
||||||
$data = $this->request->getPost();
|
$data = $this->request->getPost();
|
||||||
$insert = true;
|
$insert = true;
|
||||||
}else if($policy_grid_id == '13'){
|
} else if ($policy_grid_id == '13') {
|
||||||
|
|
||||||
$premium=$this->request->getPost('13_premium[]');
|
$premium = $this->request->getPost('13_premium[]');
|
||||||
$sum_insure =$this->request->getPost('13_si[]');
|
$sum_insure = $this->request->getPost('13_si[]');
|
||||||
$age_from =$this->request->getPost('13_age_from[]');
|
$age_from = $this->request->getPost('13_age_from[]');
|
||||||
$age_to =$this->request->getPost('13_age_to[]');
|
$age_to = $this->request->getPost('13_age_to[]');
|
||||||
$relationship =$this->request->getPost('13_relationship[]');
|
$relationship = $this->request->getPost('13_relationship[]');
|
||||||
|
|
||||||
for ($i=0; $i < count($premium) ; $i++) {
|
for ($i = 0; $i < count($premium); $i++) {
|
||||||
$data['premium'] = str_replace(',', '',$premium[$i]);
|
$data['premium'] = str_replace(',', '', $premium[$i]);
|
||||||
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
||||||
$data['age_from'] = $age_from[$i];
|
$data['age_from'] = $age_from[$i];
|
||||||
$data['age_to'] = $age_to[$i];
|
$data['age_to'] = $age_to[$i];
|
||||||
$data['relationship'] = $relationship[$i];
|
$data['relationship'] = $relationship[$i];
|
||||||
|
|
||||||
$dataa= $this->policyPremium2Model->insert($data);
|
$dataa = $this->policyPremium2Model->insert($data);
|
||||||
}
|
}
|
||||||
$data = $this->request->getPost();
|
$data = $this->request->getPost();
|
||||||
$insert = true;
|
$insert = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($insert){
|
if ($insert) {
|
||||||
return $this->respond(['status' => true,'code' => 200,'data' => $data], 200);
|
return $this->respond(['status' => true, 'code' => 200, 'data' => $data], 200);
|
||||||
}else{
|
} else {
|
||||||
return $this->respond(['status' => false,'code' => 404, 'data' => $data,'message' => 'no data found'], 200);
|
return $this->respond(['status' => false, 'code' => 404, 'data' => $data, 'message' => 'no data found'], 200);
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
// Handle exceptions here
|
// Handle exceptions here
|
||||||
@ -1031,9 +1036,9 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
$client_policy_id = $this->request->getGet('client_policy_id');
|
$client_policy_id = $this->request->getGet('client_policy_id');
|
||||||
$record = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
$record = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
||||||
$family_floater ='';
|
$family_floater = '';
|
||||||
if (isset(json_decode($record['policy_terms'])->family_floater)) {
|
if (isset(json_decode($record['policy_terms'])->family_floater)) {
|
||||||
$family_floater=json_decode($record['policy_terms'])->family_floater;
|
$family_floater = json_decode($record['policy_terms'])->family_floater;
|
||||||
}
|
}
|
||||||
|
|
||||||
$policy_terms_data = json_decode($record['policy_terms']);
|
$policy_terms_data = json_decode($record['policy_terms']);
|
||||||
@ -1042,10 +1047,10 @@ class ClientController extends AdminController
|
|||||||
$self = $policy_terms_data->family_floaters;
|
$self = $policy_terms_data->family_floaters;
|
||||||
}
|
}
|
||||||
|
|
||||||
$emp_count = $this->employeeModel ->join('client_policy cp',"employees.client_id = cp.client_id")
|
$emp_count = $this->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")
|
->join('employee_polices ep', "cp.id = ep.client_policy_id AND employees.id = ep.employee_id")
|
||||||
->where("employees.client_id",$record['client_id'])
|
->where("employees.client_id", $record['client_id'])
|
||||||
->where("employees.emp_status",'active')
|
->where("employees.emp_status", 'active')
|
||||||
->countAllResults();
|
->countAllResults();
|
||||||
|
|
||||||
|
|
||||||
@ -1070,26 +1075,26 @@ class ClientController extends AdminController
|
|||||||
$subject = $data[0]->policy_type;
|
$subject = $data[0]->policy_type;
|
||||||
if (preg_match($gmc_pattern, $subject)) {
|
if (preg_match($gmc_pattern, $subject)) {
|
||||||
$search_term = 'GMC';
|
$search_term = 'GMC';
|
||||||
} else if (preg_match($gpa_pattern, $subject)){
|
} else if (preg_match($gpa_pattern, $subject)) {
|
||||||
$search_term = 'GPA';
|
$search_term = 'GPA';
|
||||||
}else{
|
} else {
|
||||||
$search_term = "";
|
$search_term = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
$results = $this->policyGridModel->like('policy_type', $search_term)->findAll();
|
$results = $this->policyGridModel->like('policy_type', $search_term)->findAll();
|
||||||
|
|
||||||
if($search_term === 'GPA'){
|
if ($search_term === 'GPA') {
|
||||||
|
|
||||||
$premiumData = $this->policyPremium1Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->findAll();
|
$premiumData = $this->policyPremium1Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->findAll();
|
||||||
|
} else if ($search_term === 'GMC') {
|
||||||
}else if($search_term === 'GMC'){
|
|
||||||
|
|
||||||
$premiumData = $this->policyPremium2Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->findAll();
|
$premiumData = $this->policyPremium2Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->findAll();
|
||||||
|
} else {
|
||||||
}else{
|
|
||||||
|
|
||||||
$premiumData = "";
|
$premiumData = "";
|
||||||
}
|
}
|
||||||
|
// echo '<pre>';
|
||||||
|
// print_r($premiumData); die;
|
||||||
|
|
||||||
// echo $record['client_id'];
|
// echo $record['client_id'];
|
||||||
// echo "-----";
|
// echo "-----";
|
||||||
@ -1098,7 +1103,7 @@ class ClientController extends AdminController
|
|||||||
// echo '<pre>';
|
// echo '<pre>';
|
||||||
// echo $family_floater;
|
// echo $family_floater;
|
||||||
|
|
||||||
if($search_term === 'GMC'){
|
if ($search_term === 'GMC') {
|
||||||
|
|
||||||
$resultss = [];
|
$resultss = [];
|
||||||
|
|
||||||
@ -1120,26 +1125,25 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
$premiumDataa ='';
|
$premiumDataa = '';
|
||||||
if ($family_floater == 0) {
|
if ($family_floater == 0) {
|
||||||
// print_r($premiumData);die;
|
// print_r($premiumData);die;
|
||||||
if (count($premiumData) == 0) {
|
if (count($premiumData) == 0) {
|
||||||
$premiumDataa = $premiumData;
|
$premiumDataa = $premiumData;
|
||||||
}else if ($premiumData[0]['policy_grid_id'] == '3' || $premiumData[0]['policy_grid_id'] == '4' || $premiumData[0]['policy_grid_id'] == '5' || $premiumData[0]['policy_grid_id'] == '6' || $premiumData[0]['policy_grid_id'] == '7' || $premiumData[0]['policy_grid_id'] == '8' || $premiumData[0]['policy_grid_id'] == '9' ) {
|
} else if ($premiumData[0]['policy_grid_id'] == '3' || $premiumData[0]['policy_grid_id'] == '4' || $premiumData[0]['policy_grid_id'] == '5' || $premiumData[0]['policy_grid_id'] == '6' || $premiumData[0]['policy_grid_id'] == '7' || $premiumData[0]['policy_grid_id'] == '8' || $premiumData[0]['policy_grid_id'] == '9') {
|
||||||
$premiumDataa = $premiumData;
|
$premiumDataa = $premiumData;
|
||||||
}
|
}
|
||||||
}
|
} else if ($family_floater == 1) {
|
||||||
else if($family_floater == 1){
|
if (count($premiumData) == 0) {
|
||||||
if(count($premiumData) == 0){
|
|
||||||
$premiumDataa = $premiumData;
|
$premiumDataa = $premiumData;
|
||||||
}else if ($premiumData[0]['policy_grid_id'] == '10' || $premiumData[0]['policy_grid_id'] == '11' ) {
|
} else if ($premiumData[0]['policy_grid_id'] == '10' || $premiumData[0]['policy_grid_id'] == '11') {
|
||||||
$premiumDataa = $premiumData;
|
$premiumDataa = $premiumData;
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
$premiumDataa = $premiumData;
|
$premiumDataa = $premiumData;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($premiumDataa == ""){
|
if ($premiumDataa == "") {
|
||||||
$premiumDataa = $premiumData;
|
$premiumDataa = $premiumData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1149,16 +1153,13 @@ class ClientController extends AdminController
|
|||||||
// echo "hello";
|
// echo "hello";
|
||||||
// return json_encode($premiumData);
|
// return json_encode($premiumData);
|
||||||
|
|
||||||
return $this->respond(['status' => true,'code' => 200,'data' => $resultss, 'premiumData' => json_encode($premiumDataa), 'count' => $emp_count, 'policy_name' => $policy_name, 'family_floater' => $family_floater, 'self' => $self], 200);
|
return $this->respond(['status' => true, 'code' => 200, 'data' => $resultss, 'premiumData' => json_encode($premiumDataa), 'count' => $emp_count, 'policy_name' => $policy_name, 'family_floater' => $family_floater, 'self' => $self], 200);
|
||||||
|
} else if ($search_term === 'GPA') {
|
||||||
|
|
||||||
}else if($search_term === 'GPA'){
|
return $this->respond(['status' => true, 'code' => 200, 'data' => $results, 'premiumData' => json_encode($premiumData), 'count' => $emp_count, 'policy_name' => $policy_name, 'family_floater' => $family_floater, 'self' => $self], 200);
|
||||||
|
} else {
|
||||||
return $this->respond(['status' => true,'code' => 200,'data' => $results, 'premiumData' => json_encode($premiumData), 'count' => $emp_count, 'policy_name' => $policy_name, 'family_floater' => $family_floater, 'self' => $self], 200);
|
|
||||||
|
|
||||||
}else{
|
|
||||||
|
|
||||||
return $this->respond(['status' => false,'code' => 200,'data' => $results, 'premiumData' => json_encode($premiumData), 'count' => $emp_count, 'policy_name' => $policy_name, 'family_floater' => $family_floater, 'self' => $self], 200);
|
|
||||||
|
|
||||||
|
return $this->respond(['status' => false, 'code' => 200, 'data' => $results, 'premiumData' => json_encode($premiumData), 'count' => $emp_count, 'policy_name' => $policy_name, 'family_floater' => $family_floater, 'self' => $self], 200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1457,7 +1458,14 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
$client_policy_id = $this->request->getGet('client_policy_id');
|
$client_policy_id = $this->request->getGet('client_policy_id');
|
||||||
$record = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
$record = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
||||||
|
$message = 'Policy updated Successfully' ;
|
||||||
|
if($record['open_for_enrollment'] == 0){
|
||||||
|
$open_for_enrollment_update_value = 1;
|
||||||
|
$message = 'Update Open Enrollment Successfully';
|
||||||
|
}else if($record['open_for_enrollment'] == 1){
|
||||||
|
$open_for_enrollment_update_value = 0;
|
||||||
|
$message = 'Update Open Enrollment Successfully';
|
||||||
|
}
|
||||||
|
|
||||||
$data = $this->policesModel->getPolicyPremium($record['policy_id']);
|
$data = $this->policesModel->getPolicyPremium($record['policy_id']);
|
||||||
$pattern = '/gmc/i';
|
$pattern = '/gmc/i';
|
||||||
@ -1508,7 +1516,7 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
$policy_status = $this->clientPolicyModel->where('id', $client_policy_id )->set('policy_status', 1)->update();
|
$policy_status = $this->clientPolicyModel->where('id', $client_policy_id )->set('policy_status', 1)->update();
|
||||||
$json_data ='';
|
$json_data ='';
|
||||||
$open_for_enrollment = $this->clientPolicyModel->where('id', $client_policy_id )->set('open_for_enrollment', 1)->update();
|
$open_for_enrollment = $this->clientPolicyModel->where('id', $client_policy_id )->set('open_for_enrollment', $open_for_enrollment_update_value)->update();
|
||||||
if ($open_for_enrollment) {
|
if ($open_for_enrollment) {
|
||||||
$open_for_enrollment_1 = $this->clientPolicyModel->where('id', $client_policy_id )->find();
|
$open_for_enrollment_1 = $this->clientPolicyModel->where('id', $client_policy_id )->find();
|
||||||
$open_for_enrollment_value = $open_for_enrollment_1[0]['open_for_enrollment'];
|
$open_for_enrollment_value = $open_for_enrollment_1[0]['open_for_enrollment'];
|
||||||
@ -1517,9 +1525,7 @@ class ClientController extends AdminController
|
|||||||
$json_data = json_encode(['open_for_enrollment' => $open_for_enrollment_value, 'client_policy_id' => $client_policy_id_value]);
|
$json_data = json_encode(['open_for_enrollment' => $open_for_enrollment_value, 'client_policy_id' => $client_policy_id_value]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->respond(['status' => true,'code' => 200, 'message' => 'Policy Status Updated Successfully', 'data' => $termsData, 'racRate' => $racRate, 'open_for_enrollment' => $json_data], 200);
|
return $this->respond(['status' => true,'code' => 200, 'message' => $message, 'data' => $termsData, 'racRate' => $racRate, 'open_for_enrollment' => $json_data], 200);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -887,6 +887,68 @@ class EmployeeController extends AdminController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function truncateFileData() //truncateFileDataIn DB (de activate rows)
|
||||||
|
{
|
||||||
|
$file_id = $this->request->uri->getSegment(3);
|
||||||
|
// $file_id = 112;
|
||||||
|
$file = $this->fileModel->find($file_id);
|
||||||
|
// $file['action'] = 'si_enhancement';
|
||||||
|
// $result = [];
|
||||||
|
// !dd($file);
|
||||||
|
if($file['action'] == 'inception' || $file['action'] == 'dependent_addition' || $file['action'] == 'addition')
|
||||||
|
{
|
||||||
|
$result = $this->employeeModel->getEmpListByFileId(file_id: $file_id,emp_status: ['active'],policy_status:['active']);
|
||||||
|
// ~dd($result);
|
||||||
|
if(count($result))
|
||||||
|
{
|
||||||
|
return $this->respond(['dataStatus' => false,'code' => 404,'message' => 'File data already processed'], 200);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
//update emp and emp plocies
|
||||||
|
$db = db_connect();
|
||||||
|
$query = "UPDATE employees JOIN employee_polices ON employees.id = employee_polices.employee_id and employees.file_id = $file_id SET employees.emp_status = 'truncated', employee_polices.status = 'truncated', employees.is_active = 0,employee_polices.is_active = 0 WHERE employees.file_id = $file_id";
|
||||||
|
$db->query($query);
|
||||||
|
$affectedRows = $db->affectedRows();
|
||||||
|
// $affectedRows = 10;
|
||||||
|
|
||||||
|
//update file status
|
||||||
|
$this->fileModel->where('id', $file_id)->set(['status' => 'truncated'])->update();
|
||||||
|
|
||||||
|
return $this->respond(['dataStatus' => true,'code' => 200,'data' => round($affectedRows/2)], 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if($file['action'] == 'si_enhancement' || $file['action'] == 'correction' || $file['action'] == 'deletion')
|
||||||
|
{
|
||||||
|
$res = $this->empEndorsementModel->select(['count(id) as count'])
|
||||||
|
->where('emp_endorsement.file_id',$file_id)
|
||||||
|
->groupStart()
|
||||||
|
->where('emp_endorsement.endorsement_id is not null')
|
||||||
|
->orwhereIn('emp_endorsement.status',['complete'])
|
||||||
|
->groupEnd()
|
||||||
|
->get()
|
||||||
|
->getResult();
|
||||||
|
// print_r($this->empEndorsementModel->getLastQuery());
|
||||||
|
// echo $res[0]->count;die();
|
||||||
|
if($res[0]->count == 0)
|
||||||
|
{
|
||||||
|
//update truncated status to db
|
||||||
|
$this->empEndorsementModel->where('file_id',$file_id)
|
||||||
|
->set(['status' => 'truncated'])
|
||||||
|
->update();
|
||||||
|
//update file status
|
||||||
|
$this->fileModel->where('id', $file_id)->set(['status' => 'truncated'])->update();
|
||||||
|
return $this->respond(['dataStatus' => true,'code' => 200,'data' => 'success'], 200);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return $this->respond(['dataStatus' => false,'code' => 404,'message' => 'File data already processed'], 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -834,7 +834,7 @@ class EmployeeServiceController extends AdminController
|
|||||||
|
|
||||||
foreach($familiy_data as $fkey => $value)
|
foreach($familiy_data as $fkey => $value)
|
||||||
{
|
{
|
||||||
if($file['id'] == null || ($value['temp']['source'] == 'excel' || (in_array($value['temp']['grid_type'],[10,11]) && strtolower($value['relationship']) == 'self'))) //insert data come from excel and from db
|
if($file['id'] == null || $value['temp']['source'] == 'excel') //insert data come from excel and from db i.e. ( $file['id'] == null for enrollment data)
|
||||||
{
|
{
|
||||||
|
|
||||||
$employee = $this->employeeModel->checkExistingEmp($value);
|
$employee = $this->employeeModel->checkExistingEmp($value);
|
||||||
@ -842,50 +842,6 @@ class EmployeeServiceController extends AdminController
|
|||||||
$temp = $value['temp'];
|
$temp = $value['temp'];
|
||||||
unset($value['policy_details']);
|
unset($value['policy_details']);
|
||||||
unset($value['temp']);
|
unset($value['temp']);
|
||||||
|
|
||||||
if($file['id'] == null && (strtolower($value['relationship']) == 'self' && $temp['source'] == 'db' && $temp['emp_id'] != null && $temp['emp_policy_id'] != null))
|
|
||||||
{
|
|
||||||
//check existing si and new si
|
|
||||||
$employee_policy = $this->employeePolicyModel->where('employee_id',$employee['id'])->where('client_policy_id',$file['policy_id'])->first();
|
|
||||||
if($employee_policy['basic_cover_si'] != $policy_data['basic_cover_si'])
|
|
||||||
{
|
|
||||||
|
|
||||||
//check any existing si enhancement pending
|
|
||||||
$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();
|
|
||||||
|
|
||||||
if(!count($existing_endorsements))
|
|
||||||
{
|
|
||||||
|
|
||||||
$slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($file['policy_id'],$file['client_id']);
|
|
||||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
|
||||||
{
|
|
||||||
if($slab_value['si'] == $policy_data['si'])
|
|
||||||
{
|
|
||||||
$group_key = rand(100000, 999999);
|
|
||||||
//add new premimum details in endorsement table
|
|
||||||
$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['premium'],'created_by' => $file['created_by'],'remarks' => 'da auto si enhancement','group_key' => $group_key]);
|
|
||||||
$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' => 'da auto si enhancement','group_key' => $group_key]);
|
|
||||||
$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' => ($policy_data['date_coverage']),'created_by' => $file['created_by'],'remarks' => 'da auto si enhancement','group_key' => $group_key]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}// end of self employee si enhance ment
|
|
||||||
|
|
||||||
|
|
||||||
//save employee table
|
//save employee table
|
||||||
if(count($employee))
|
if(count($employee))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -656,17 +656,33 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
// dd($emp_data);
|
// dd($emp_data);
|
||||||
|
|
||||||
//check if the data comes from enrollment (DB) and status is draft then fetch original data of employee from
|
//check if the data comes from enrollment (DB) and status is draft then fetch original data of employee from
|
||||||
//audit history table then initiate calculation with it. so this data again get updated in emp and policy table
|
//audit history table then initiate calculation with it. so this data again get updated in emp table
|
||||||
|
|
||||||
// if($emp_data['temp']['emp_status'] == 'draft' && $emp_data['temp']['policy_status'] == 'draft')
|
//check emp records
|
||||||
// {
|
if($emp_data['file_id'] == null && $emp_data['temp']['emp_status'] == 'draft' && $emp_data['temp']['policy_status'] == 'draft')
|
||||||
// $original_emp_records = get_emp_records_from_audit_history($emp_data['temp']['emp_id']);
|
{
|
||||||
// if(is_array($original_emp_records))
|
$original_emp_records = get_emp_records_from_audit_history($emp_data['temp']['emp_id']);
|
||||||
// {
|
if(is_array($original_emp_records))
|
||||||
// print_r($original_emp_records);
|
{
|
||||||
// }
|
// Kint::dump($original_emp_records);
|
||||||
// }
|
$emp_data = replace_original_data(original_data:$original_emp_records,current_data:$emp_data);
|
||||||
|
// Kint::dump($value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//check emp policy records
|
||||||
|
if($emp_data['file_id'] == null && $emp_data['temp']['emp_status'] == 'draft' && $emp_data['temp']['policy_status'] == 'draft')
|
||||||
|
{
|
||||||
|
$original_emp_policy_records = get_emp_policy_records_from_audit_history($emp_data['temp']['emp_policy_id']);
|
||||||
|
if(is_array($original_emp_policy_records))
|
||||||
|
{
|
||||||
|
// Kint::dump($original_emp_records);
|
||||||
|
$emp_data['policy_details'] = replace_original_data(original_data:$original_emp_policy_records,current_data:$emp_data['policy_details']);
|
||||||
|
// Kint::dump($policy_data);
|
||||||
|
}
|
||||||
|
}
|
||||||
//end of fetching data from audit history table
|
//end of fetching data from audit history table
|
||||||
|
|
||||||
//gird and calculation start
|
//gird and calculation start
|
||||||
$slug = \Config\Services::slug();
|
$slug = \Config\Services::slug();
|
||||||
$grid_type = $slab_details['grid_master']['ui_type'];
|
$grid_type = $slab_details['grid_master']['ui_type'];
|
||||||
@ -844,7 +860,7 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||||
{
|
{
|
||||||
|
|
||||||
if($slab_value['grade'] == $employee_received_band && $slab_value['si'] == $employee_received_si && (($slab_value['premium_type'] == 1 && strtolower($emp_data['relationship']) == 'self') || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
if($slab_value['si'] == $employee_received_si && (($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']['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']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
||||||
@ -1055,7 +1071,7 @@ if(!function_exists('get_emp_records_from_audit_history'))
|
|||||||
function get_emp_records_from_audit_history($employee_id)
|
function get_emp_records_from_audit_history($employee_id)
|
||||||
{
|
{
|
||||||
$db = db_connect();
|
$db = db_connect();
|
||||||
$query = "SELECT min(id) as id,pk,table_name,field_name,old_value FROM venbaehn_nhance.auditing_history where pk = $employee_id and table_name = 'employees'group by field_name order by id asc";
|
$query = "SELECT min(id) as id,pk,table_name,field_name,old_value FROM venbaehn_nhance.auditing_history where pk = $employee_id and table_name = 'employees' and field_name in ('name','dob','gender','mobile','email_corporate','relationship') group by field_name order by id asc";
|
||||||
$res = $db->query($query);
|
$res = $db->query($query);
|
||||||
// echo $db->getLastQuery();
|
// echo $db->getLastQuery();
|
||||||
$res = $res->getResultArray();
|
$res = $res->getResultArray();
|
||||||
@ -1071,3 +1087,41 @@ if(!function_exists('get_emp_records_from_audit_history'))
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!function_exists('get_emp_policy_records_from_audit_history'))
|
||||||
|
{
|
||||||
|
function get_emp_policy_records_from_audit_history($emp_policy_id)
|
||||||
|
{
|
||||||
|
$db = db_connect();
|
||||||
|
$query = "SELECT min(id) as id,pk,table_name,field_name,old_value FROM venbaehn_nhance.auditing_history where pk = $emp_policy_id and table_name = 'employee_polices' and field_name in ('basic_cover_si','premium','gst') group by field_name order by id asc";
|
||||||
|
$res = $db->query($query);
|
||||||
|
// echo $db->getLastQuery();
|
||||||
|
$res = $res->getResultArray();
|
||||||
|
if(count($res))
|
||||||
|
{ $temp = [];
|
||||||
|
foreach($res as $row)
|
||||||
|
{
|
||||||
|
$temp[ $row['field_name'] ] = $row['old_value'];
|
||||||
|
}
|
||||||
|
return $temp;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(!function_exists('replace_original_data'))
|
||||||
|
{
|
||||||
|
function replace_original_data(array $original_data,array $current_data)
|
||||||
|
{
|
||||||
|
foreach($original_data as $key => $data)
|
||||||
|
{
|
||||||
|
if(array_key_exists($key, $current_data))
|
||||||
|
{
|
||||||
|
$current_data [$key] = $data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $current_data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -78,6 +78,8 @@ class EmployeeModel extends Model
|
|||||||
public function checkExistingEmp($arr)
|
public function checkExistingEmp($arr)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if($arr['temp']['emp_id'] == null)
|
||||||
|
{
|
||||||
return $this->where('emp_code',$arr['emp_code'])
|
return $this->where('emp_code',$arr['emp_code'])
|
||||||
->where('name',$arr['name'])
|
->where('name',$arr['name'])
|
||||||
->where('client_id',$arr['client_id'])
|
->where('client_id',$arr['client_id'])
|
||||||
@ -86,6 +88,11 @@ class EmployeeModel extends Model
|
|||||||
->where('dob',$arr['dob'])
|
->where('dob',$arr['dob'])
|
||||||
->find();
|
->find();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return $this->where('id',$arr['temp']['emp_id'])->find();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
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 = [])
|
||||||
|
|||||||
@ -27,4 +27,39 @@ class PolicyPremium1Model extends Model
|
|||||||
'premium_type',
|
'premium_type',
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// Callbacks
|
||||||
|
protected $allowCallbacks = true;
|
||||||
|
protected $beforeInsert = ["checkAndADDCreatedByValue"];
|
||||||
|
protected $afterInsert = [];
|
||||||
|
protected $beforeUpdate = ["checkAndUpdateUpdatedByValue"];
|
||||||
|
protected $afterUpdate = [];
|
||||||
|
protected $beforeFind = [];
|
||||||
|
protected $afterFind = [];
|
||||||
|
protected $beforeDelete = [];
|
||||||
|
protected $afterDelete = [];
|
||||||
|
|
||||||
|
protected function checkAndADDCreatedByValue(array $data)
|
||||||
|
{
|
||||||
|
// Check if 'updated_by' value is null or empty
|
||||||
|
if (empty($data['data']['created_by'])) {
|
||||||
|
// Set 'updated_by' value to the current session user ID
|
||||||
|
$data['data']['created_by'] = get_session_userid();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function checkAndUpdateUpdatedByValue(array $data)
|
||||||
|
{
|
||||||
|
// Check if 'updated_by' value is null or empty
|
||||||
|
if (empty($data['data']['updated_by'])) {
|
||||||
|
// Set 'updated_by' value to the current session user ID
|
||||||
|
$data['data']['updated_by'] = get_session_userid();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,4 +28,37 @@ class PolicyPremium2Model extends Model
|
|||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// Callbacks
|
||||||
|
protected $allowCallbacks = true;
|
||||||
|
protected $beforeInsert = ["checkAndADDCreatedByValue"];
|
||||||
|
protected $afterInsert = [];
|
||||||
|
protected $beforeUpdate = ["checkAndUpdateUpdatedByValue"];
|
||||||
|
protected $afterUpdate = [];
|
||||||
|
protected $beforeFind = [];
|
||||||
|
protected $afterFind = [];
|
||||||
|
protected $beforeDelete = [];
|
||||||
|
protected $afterDelete = [];
|
||||||
|
|
||||||
|
protected function checkAndADDCreatedByValue(array $data)
|
||||||
|
{
|
||||||
|
// Check if 'updated_by' value is null or empty
|
||||||
|
if (empty($data['data']['created_by'])) {
|
||||||
|
// Set 'updated_by' value to the current session user ID
|
||||||
|
$data['data']['created_by'] = get_session_userid();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function checkAndUpdateUpdatedByValue(array $data)
|
||||||
|
{
|
||||||
|
// Check if 'updated_by' value is null or empty
|
||||||
|
if (empty($data['data']['updated_by'])) {
|
||||||
|
// Set 'updated_by' value to the current session user ID
|
||||||
|
$data['data']['updated_by'] = get_session_userid();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,8 +2,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<div class="row float-right" style="padding-bottom: 10px; position: relative;right: 13px;">
|
<div class="row float-right" style="padding-bottom: 10px; position: relative;right: 13px;">
|
||||||
<button type="button" id="BtnAdd" class="btn btn-primary waves-effect waves-light btnAdd btn-sm"><span
|
<button type="button" id="BtnAdd" class="btn btn-primary waves-effect waves-light btnAdd btn-sm"><span class="fa fa-plus-square" aria-hidden="true" style="padding: 5px 10px;"></span>Add Policy</button>
|
||||||
class="fa fa-plus-square" aria-hidden="true" style="padding: 5px 10px;"></span>Add Policy</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="table-responsive" id="table_list">
|
<div class="table-responsive" id="table_list">
|
||||||
@ -29,9 +28,7 @@
|
|||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
|
||||||
<div class="row float-right" style="position: relative; bottom: 20px; right: 13px;">
|
<div class="row float-right" style="position: relative; bottom: 20px; right: 13px;">
|
||||||
<button type="button" id="btnPolicyBack"
|
<button type="button" id="btnPolicyBack" class="btn btn-primary waves-effect waves-light btn-sm btnBack btn-sm"><span class="fa fa-list" aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
|
||||||
class="btn btn-primary waves-effect waves-light btn-sm btnBack btn-sm"><span class="fa fa-list"
|
|
||||||
aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
@ -41,8 +38,7 @@
|
|||||||
<input type="hidden" name="PrimaryKey" id="policy_PrimaryKey" />
|
<input type="hidden" name="PrimaryKey" id="policy_PrimaryKey" />
|
||||||
<input type="hidden" id="policy_form_action" />
|
<input type="hidden" id="policy_form_action" />
|
||||||
<input type="hidden" name="policy_type_id" id="policy_type_id" />
|
<input type="hidden" name="policy_type_id" id="policy_type_id" />
|
||||||
<input type="hidden" name="client_id" id="client_id_policy"
|
<input type="hidden" name="client_id" id="client_id_policy" value="<?= isset($client['id']) ? $client['id'] : '' ?>" />
|
||||||
value="<?= isset($client['id']) ? $client['id'] : '' ?>" />
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
@ -50,7 +46,7 @@
|
|||||||
<label for="email"> Policy Type<span class="text-danger">*</span></label>
|
<label for="email"> Policy Type<span class="text-danger">*</span></label>
|
||||||
<select class="form-control" id="policy_type" name="is_addon" required>
|
<select class="form-control" id="policy_type" name="is_addon" required>
|
||||||
<option value="0">Select Policy Type</option>
|
<option value="0">Select Policy Type</option>
|
||||||
<?php foreach($policy_type as $key => $value) { ?>
|
<?php foreach ($policy_type as $key => $value) { ?>
|
||||||
<option value="<?= $key ?>"><?= $value ?></option>
|
<option value="<?= $key ?>"><?= $value ?></option>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
@ -70,8 +66,8 @@
|
|||||||
<label for="email">Insurer<span class="text-danger">*</span></label>
|
<label for="email">Insurer<span class="text-danger">*</span></label>
|
||||||
<select class="form-control" id="insurer" name="insurer" required>
|
<select class="form-control" id="insurer" name="insurer" required>
|
||||||
<option value="">Select Insurer</option>
|
<option value="">Select Insurer</option>
|
||||||
<?php foreach($insurer as $value) { ?>
|
<?php foreach ($insurer as $value) { ?>
|
||||||
<option value="<?= $value['id'] . '-' . $value['insurer_id']?>">
|
<option value="<?= $value['id'] . '-' . $value['insurer_id'] ?>">
|
||||||
<?= $value['insurer_name'] . '-' . $value['branch_code'] ?></option>
|
<?= $value['insurer_name'] . '-' . $value['branch_code'] ?></option>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
@ -86,8 +82,8 @@
|
|||||||
<label for="mobile">TPA<span class="text-danger">*</span></label>
|
<label for="mobile">TPA<span class="text-danger">*</span></label>
|
||||||
<select class="form-control" id="tpa" name="tpa" required>
|
<select class="form-control" id="tpa" name="tpa" required>
|
||||||
<option value="">Select TPA</option>
|
<option value="">Select TPA</option>
|
||||||
<?php foreach($tpa as $value) { ?>
|
<?php foreach ($tpa as $value) { ?>
|
||||||
<option value="<?= $value['id']. '-' . $value['tpa_id'] ?>">
|
<option value="<?= $value['id'] . '-' . $value['tpa_id'] ?>">
|
||||||
<?= $value['tpa_short_name'] . '-' . $value['branch_code'] ?></option>
|
<?= $value['tpa_short_name'] . '-' . $value['branch_code'] ?></option>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
@ -96,20 +92,16 @@
|
|||||||
|
|
||||||
<div class="form-row" id="second" style="display: none;">
|
<div class="form-row" id="second" style="display: none;">
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="policy_start_date">Policy Start Date<span
|
<label for="policy_start_date">Policy Start Date<span class="text-danger">*</span></label>
|
||||||
class="text-danger">*</span></label>
|
<input value="" type="text" class="form-control" placeholder="Enter Start Date " name="policy_start_date" id="start_date" required>
|
||||||
<input value="" type="text" class="form-control" placeholder="Enter Start Date "
|
|
||||||
name="policy_start_date" id="start_date" required>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="policy_end_date">Policy End Date<span class="text-danger">*</span></label>
|
<label for="policy_end_date">Policy End Date<span class="text-danger">*</span></label>
|
||||||
<input value="" type="text" class="form-control" placeholder="Enter End Date "
|
<input value="" type="text" class="form-control" placeholder="Enter End Date " name="policy_end_date" id="end_date" required>
|
||||||
name="policy_end_date" id="end_date" required>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-4" id="policy_status_field">
|
<div class="form-group col-md-4" id="policy_status_field">
|
||||||
<label for="policy_status">Policy Status</label>
|
<label for="policy_status">Policy Status</label>
|
||||||
<input value="" type="text" class="form-control" placeholder="Policy Status"
|
<input value="" type="text" class="form-control" placeholder="Policy Status" id="policy_status" readonly>
|
||||||
id="policy_status" readonly>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -118,10 +110,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group text-right m-b-0">
|
<div class="form-group text-right m-b-0">
|
||||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnSubmit">Submit</button>
|
||||||
id="btnSubmit">Submit</button>
|
<button type="button" class="btn btn-secondary waves-effect btnBack" id="btnBack">Cancel</button>
|
||||||
<button type="button" class="btn btn-secondary waves-effect btnBack"
|
|
||||||
id="btnBack">Cancel</button>
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@ -135,18 +125,18 @@
|
|||||||
<?php include('policy_gpa_terms.php'); ?>
|
<?php include('policy_gpa_terms.php'); ?>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var policy_PrimaryKey = $('#client_id_policy').val();
|
var policy_PrimaryKey = $('#client_id_policy').val();
|
||||||
var policy_client = $('#policy_PrimaryKey').val();
|
var policy_client = $('#policy_PrimaryKey').val();
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
// Initialize select2
|
// Initialize select2
|
||||||
$("#insurer").select2();
|
$("#insurer").select2();
|
||||||
$("#policy").select2();
|
$("#policy").select2();
|
||||||
$("#tpa").select2();
|
$("#tpa").select2();
|
||||||
$("#base_policy").select2();
|
$("#base_policy").select2();
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
$('#policy_status_field').hide()
|
$('#policy_status_field').hide()
|
||||||
|
|
||||||
@ -265,9 +255,10 @@ $(document).ready(function() {
|
|||||||
`<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnOpenEnroll"><i class="mdi mdi-file-lock mr-2 text-muted font-18 vertical-middle"></i>Open Enrollment</a> `;
|
`<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnOpenEnroll"><i class="mdi mdi-file-lock mr-2 text-muted font-18 vertical-middle"></i>Open Enrollment</a> `;
|
||||||
} else {
|
} else {
|
||||||
policyTable +=
|
policyTable +=
|
||||||
`<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnOpenEnroll" style="pointer-events:none; background-color: lightgrey;"><i class="mdi mdi-file-lock mr-2 text-muted font-18 vertical-middle" ></i>Open Enrollment</a> `;
|
`<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnOpenEnroll" style="background-color: lightgrey;"><i class="mdi mdi-file-lock mr-2 text-muted font-18 vertical-middle" ></i>Open Enrollment</a> `;
|
||||||
}
|
}
|
||||||
policyTable += ` </div>
|
policyTable += `
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -283,10 +274,10 @@ $(document).ready(function() {
|
|||||||
searching: false
|
searching: false
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/******** for form submit using AJAX *******/
|
/******** for form submit using AJAX *******/
|
||||||
$("#policy_form").submit(function(event) {
|
$("#policy_form").submit(function(event) {
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
@ -378,7 +369,15 @@ $("#policy_form").submit(function(event) {
|
|||||||
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||||
<a href="#" data-id="${item.id}" id="${search_term}" class="dropdown-item btnPolicyMaster" data-toggle="modal"><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
<a href="#" data-id="${item.id}" id="${search_term}" class="dropdown-item btnPolicyMaster" data-toggle="modal"><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
||||||
<a href="#" data-id="${item.id}" id="${search_term}"class="dropdown-item btnPolicyModel" data-toggle="modal" data-target="#bs-example-modal-lg"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Rack Rate</a>
|
<a href="#" data-id="${item.id}" id="${search_term}"class="dropdown-item btnPolicyModel" data-toggle="modal" data-target="#bs-example-modal-lg"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Rack Rate</a>
|
||||||
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnOpenEnroll"><i class="mdi mdi-file-lock mr-2 text-muted font-18 vertical-middle"></i>Open Enrollment</a>
|
`;
|
||||||
|
if (item.open_for_enrollment == 0) {
|
||||||
|
policyTable +=
|
||||||
|
`<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnOpenEnroll"><i class="mdi mdi-file-lock mr-2 text-muted font-18 vertical-middle"></i>Open Enrollment</a> `;
|
||||||
|
} else {
|
||||||
|
policyTable +=
|
||||||
|
`<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnOpenEnroll" style="background-color: lightgrey;"><i class="mdi mdi-file-lock mr-2 text-muted font-18 vertical-middle" ></i>Open Enrollment</a> `;
|
||||||
|
}
|
||||||
|
policyTable += `
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@ -409,9 +408,9 @@ $("#policy_form").submit(function(event) {
|
|||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
/********* To get th POLICY base on Insurer *******/
|
/********* To get th POLICY base on Insurer *******/
|
||||||
$('#insurer').change(function() {
|
$('#insurer').change(function() {
|
||||||
var id = $(this).val();
|
var id = $(this).val();
|
||||||
@ -433,13 +432,13 @@ $(document).ready(function() {
|
|||||||
item.id +
|
item.id +
|
||||||
'">' + item.name + '</option>';
|
'">' + item.name + '</option>';
|
||||||
}
|
}
|
||||||
}else if($policy_type_value == 2){
|
} else if ($policy_type_value == 2) {
|
||||||
if (item.policy_type_id == 4 ) {
|
if (item.policy_type_id == 4) {
|
||||||
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' +
|
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' +
|
||||||
item.id +
|
item.id +
|
||||||
'">' + item.name + '</option>';
|
'">' + item.name + '</option>';
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' +
|
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' +
|
||||||
item.id +
|
item.id +
|
||||||
'">' + item.name + '</option>';
|
'">' + item.name + '</option>';
|
||||||
@ -452,9 +451,9 @@ $(document).ready(function() {
|
|||||||
console.error(status, error);
|
console.error(status, error);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
/********* set the Policy_Type_id for Form Submit *******/
|
/********* set the Policy_Type_id for Form Submit *******/
|
||||||
$('#policy').change(function() {
|
$('#policy').change(function() {
|
||||||
|
|
||||||
@ -480,10 +479,10 @@ $(document).ready(function() {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// get the client policy data for edit
|
// get the client policy data for edit
|
||||||
$('body').on('click', '.btnPolicyEdit', function() {
|
$('body').on('click', '.btnPolicyEdit', function() {
|
||||||
|
|
||||||
var policy_form_action = '';
|
var policy_form_action = '';
|
||||||
var policy_id = $(this).attr('data-id');
|
var policy_id = $(this).attr('data-id');
|
||||||
@ -577,16 +576,25 @@ $('body').on('click', '.btnPolicyEdit', function() {
|
|||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$('body').on('click', '.btnOpenEnroll', function() {
|
$('body').on('click', '.btnOpenEnroll', function() {
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: "Are you sure?",
|
||||||
|
text: "You need to approve this!",
|
||||||
|
icon: "warning",
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: "#3085d6",
|
||||||
|
cancelButtonColor: "#d33",
|
||||||
|
confirmButtonText: "Yes, delete it!"
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
var client_policy_id = $(this).attr('data-id');
|
var client_policy_id = $(this).attr('data-id');
|
||||||
var policy_id = $(this).attr('id');
|
var policy_id = $(this).attr('id');
|
||||||
var client_id = $('#client_id_policy').val()
|
var client_id = $('#client_id_policy').val()
|
||||||
|
|
||||||
|
|
||||||
// console.log('client_policy_id', client_policy_id);
|
// console.log('client_policy_id', client_policy_id);
|
||||||
|
|
||||||
if (client_policy_id) {
|
if (client_policy_id) {
|
||||||
@ -595,13 +603,14 @@ $('body').on('click', '.btnOpenEnroll', function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '<?php echo base_url('util/update-policy-status');?>',
|
url: '<?php echo base_url('util/update-policy-status'); ?>',
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
data: {
|
data: {
|
||||||
client_policy_id: client_policy_id,
|
client_policy_id: client_policy_id,
|
||||||
},
|
},
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
console.log(res);
|
console.log(res);
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
if (res.open_for_enrollment) {
|
if (res.open_for_enrollment) {
|
||||||
var json_decode = JSON.parse(res.open_for_enrollment);
|
var json_decode = JSON.parse(res.open_for_enrollment);
|
||||||
@ -613,8 +622,17 @@ $('body').on('click', '.btnOpenEnroll', function() {
|
|||||||
if ($(element).data('id') == client_policy_id) {
|
if ($(element).data('id') == client_policy_id) {
|
||||||
$(element).css({
|
$(element).css({
|
||||||
'background-color': 'lightgrey',
|
'background-color': 'lightgrey',
|
||||||
'pointer-events': 'none'
|
|
||||||
});
|
});
|
||||||
|
$(element).html('<i class="mdi mdi-file-lock mr-2 text-muted font-18 vertical-middle"></i>Open Enrollment');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$('.btnOpenEnroll').each(function(index, element) {
|
||||||
|
if ($(element).data('id') == client_policy_id) {
|
||||||
|
$(element).css({
|
||||||
|
'background-color': '',
|
||||||
|
});
|
||||||
|
$(element).html('<i class="mdi mdi-file-lock mr-2 text-muted font-18 vertical-middle"></i>Open Enrollment');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -648,9 +666,13 @@ $('body').on('click', '.btnOpenEnroll', function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
}
|
||||||
|
|
||||||
function appendPolicyFormFields(policy_type, data = false) {
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
function appendPolicyFormFields(policy_type, data = false) {
|
||||||
|
|
||||||
var html = '';
|
var html = '';
|
||||||
var container = document.getElementById('policy_fields');
|
var container = document.getElementById('policy_fields');
|
||||||
@ -788,11 +810,11 @@ function appendPolicyFormFields(policy_type, data = false) {
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//for date convert to indian formate like this 'yyyy-mm-dd' to this 'dd-mm-yyyy'
|
//for date convert to indian formate like this 'yyyy-mm-dd' to this 'dd-mm-yyyy'
|
||||||
function rearrangeDateFormat(inputDate) {
|
function rearrangeDateFormat(inputDate) {
|
||||||
|
|
||||||
if (inputDate !== null) {
|
if (inputDate !== null) {
|
||||||
var dateComponents = inputDate.split("-");
|
var dateComponents = inputDate.split("-");
|
||||||
@ -801,9 +823,9 @@ function rearrangeDateFormat(inputDate) {
|
|||||||
} else {
|
} else {
|
||||||
return '00-00-0000';
|
return '00-00-0000';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkDateStatus(inputDate, bg = false) {
|
function checkDateStatus(inputDate, bg = false) {
|
||||||
|
|
||||||
var givenDate = new Date(inputDate);
|
var givenDate = new Date(inputDate);
|
||||||
var currentDate = new Date();
|
var currentDate = new Date();
|
||||||
@ -822,9 +844,9 @@ function checkDateStatus(inputDate, bg = false) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const numberWords = {
|
const numberWords = {
|
||||||
0: "Zero",
|
0: "Zero",
|
||||||
1: "One",
|
1: "One",
|
||||||
2: "Two",
|
2: "Two",
|
||||||
@ -853,9 +875,9 @@ const numberWords = {
|
|||||||
70: "Seventy",
|
70: "Seventy",
|
||||||
80: "Eighty",
|
80: "Eighty",
|
||||||
90: "Ninety"
|
90: "Ninety"
|
||||||
};
|
};
|
||||||
|
|
||||||
function convertNumberToWords(number) {
|
function convertNumberToWords(number) {
|
||||||
if (number === 0) {
|
if (number === 0) {
|
||||||
return numberWords[number];
|
return numberWords[number];
|
||||||
}
|
}
|
||||||
@ -893,9 +915,9 @@ function convertNumberToWords(number) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return word.trim();
|
return word.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
function convertCommaNumberToWords(input) {
|
function convertCommaNumberToWords(input) {
|
||||||
let number;
|
let number;
|
||||||
if (input instanceof HTMLElement) {
|
if (input instanceof HTMLElement) {
|
||||||
const inputValue = input.value;
|
const inputValue = input.value;
|
||||||
@ -911,17 +933,17 @@ function convertCommaNumberToWords(input) {
|
|||||||
var convert_word_value = convertNumberToWords(number);
|
var convert_word_value = convertNumberToWords(number);
|
||||||
|
|
||||||
return convert_word_value;
|
return convert_word_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
function onlyNumbers(event) {
|
function onlyNumbers(event) {
|
||||||
var charcode;
|
var charcode;
|
||||||
charcode = event.which || event.keyCode;
|
charcode = event.which || event.keyCode;
|
||||||
if (charcode >= 48 && charcode <= 57) return true;
|
if (charcode >= 48 && charcode <= 57) return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function formatNumber(input, maxLength) {
|
function formatNumber(input, maxLength) {
|
||||||
|
|
||||||
// console.log("input", input);
|
// console.log("input", input);
|
||||||
maxLength = 16;
|
maxLength = 16;
|
||||||
@ -989,15 +1011,15 @@ function formatNumber(input, maxLength) {
|
|||||||
return;
|
return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function removeClientPolicy(element) {
|
function removeClientPolicy(element) {
|
||||||
console.log(element);
|
console.log(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$('#policy_type').change(function() {
|
$('#policy_type').change(function() {
|
||||||
|
|
||||||
$('#insurer').val('').change();
|
$('#insurer').val('').change();
|
||||||
$('#tpa').val('').change();
|
$('#tpa').val('').change();
|
||||||
@ -1005,7 +1027,7 @@ $('#policy_type').change(function() {
|
|||||||
$('#end_date').val('');
|
$('#end_date').val('');
|
||||||
$('#base_policy').val('0');
|
$('#base_policy').val('0');
|
||||||
|
|
||||||
if($(this).val() == 3){
|
if ($(this).val() == 3) {
|
||||||
toastr.warning('Please Change the Policy Terms after Submit the Policy!', 'warning');
|
toastr.warning('Please Change the Policy Terms after Submit the Policy!', 'warning');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1016,7 +1038,7 @@ $('#policy_type').change(function() {
|
|||||||
$('#first').show();
|
$('#first').show();
|
||||||
$('#second').show();
|
$('#second').show();
|
||||||
|
|
||||||
} else if ($(this).val() == '0'){
|
} else if ($(this).val() == '0') {
|
||||||
|
|
||||||
$('#first').hide();
|
$('#first').hide();
|
||||||
$('#second').hide();
|
$('#second').hide();
|
||||||
@ -1024,17 +1046,17 @@ $('#policy_type').change(function() {
|
|||||||
$('#base_policy').prop('required', false);
|
$('#base_policy').prop('required', false);
|
||||||
|
|
||||||
|
|
||||||
} else if ($(this).val() == '1'){
|
} else if ($(this).val() == '1') {
|
||||||
|
|
||||||
$('#first').show();
|
$('#first').show();
|
||||||
$('#second').show();
|
$('#second').show();
|
||||||
$('#base_policy_id').hide();
|
$('#base_policy_id').hide();
|
||||||
$('#base_policy').prop('required', false);
|
$('#base_policy').prop('required', false);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
function fetchClientPolicyList() {
|
function fetchClientPolicyList() {
|
||||||
|
|
||||||
var client_id = $('#client_id_policy').val()
|
var client_id = $('#client_id_policy').val()
|
||||||
|
|
||||||
@ -1044,7 +1066,7 @@ function fetchClientPolicyList() {
|
|||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
|
|
||||||
console.log('one',res)
|
console.log('one', res)
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
@ -1074,10 +1096,10 @@ function fetchClientPolicyList() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function() {
|
||||||
|
|
||||||
$('#base_policy').change(function() {
|
$('#base_policy').change(function() {
|
||||||
|
|
||||||
@ -1091,8 +1113,8 @@ $(document).ready(function(){
|
|||||||
};
|
};
|
||||||
|
|
||||||
const queryString = objectToQueryString(queryParams);
|
const queryString = objectToQueryString(queryParams);
|
||||||
// var uri = '<?= base_url('util/fetch-policy-for-policy-type')?>?' + queryString
|
// var uri = '<?= base_url('util/fetch-policy-for-policy-type') ?>?' + queryString
|
||||||
var uri = '<?= base_url('client/policy/list/')?>' + client_policy_id
|
var uri = '<?= base_url('client/policy/list/') ?>' + client_policy_id
|
||||||
// console.log('uri', uri)
|
// console.log('uri', uri)
|
||||||
// console.log('queryString', queryString)
|
// console.log('queryString', queryString)
|
||||||
|
|
||||||
@ -1149,10 +1171,9 @@ $(document).ready(function(){
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
function objectToQueryString(obj) {
|
function objectToQueryString(obj) {
|
||||||
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -665,6 +665,9 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
var selectedpolicy = $(this).val();
|
var selectedpolicy = $(this).val();
|
||||||
console.log('selectedpolicy',selectedpolicy)
|
console.log('selectedpolicy',selectedpolicy)
|
||||||
|
$('#upload-action-type').val('').change();
|
||||||
|
$('#file_upload').hide();
|
||||||
|
$('#excel_download').removeAttr('href');
|
||||||
|
|
||||||
var apiURL = '<?php echo base_url();?>' + 'util/fetch-emp-count/' + selectedpolicy;
|
var apiURL = '<?php echo base_url();?>' + 'util/fetch-emp-count/' + selectedpolicy;
|
||||||
console.log(apiURL);
|
console.log(apiURL);
|
||||||
@ -729,5 +732,5 @@ $(document).ready(function() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------
|
||||||
</script>
|
</script>
|
||||||
@ -382,25 +382,17 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
|
|||||||
}
|
}
|
||||||
|
|
||||||
grid_html = `
|
grid_html = `
|
||||||
|
<div class="form-row" id="grid_2" style="width:84%">
|
||||||
<div class="form-row" id="grid_9" style="width:84%">
|
<input value="1" type="hidden" name="policy_type">
|
||||||
<div class="form-group col-md-3">
|
<div class="form-group col-md-6">
|
||||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="9_si[]" id="9_si" onkeypress = "return onlyNumbers(event)" onkeyup="formatNumber(this)" required>
|
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="gpa_si" id="gpa_si" onkeypress = "return onlyNumbers(event)" onkeyup="formatNumber(this)" required>
|
||||||
<div id='sum_insured_number_word' class="text-danger-2" ></div>
|
<div id='gpa_si_number_word' class="text-danger-2" ></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-3">
|
<div class="form-group col-md-6">
|
||||||
<label for="mobile">Grade/Band<span class="text-danger">*</span></label>
|
|
||||||
<input value="${data !== false && data !== undefined && data !== '' ? data.grade : ''}" type="text" class="form-control" placeholder="Enter Grade/Band " name="9_grade[]" id="9_grade" required>
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-3">
|
|
||||||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||||||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="9_premium[]" id="9_premium" onkeypress = "return onlyNumbers(event)" onkeyup="formatNumber(this)" required>
|
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="gpa_premium" id="gpa_premium" onkeypress = "return onlyNumbers(event)" onkeyup="formatNumber(this)" required>
|
||||||
<div id='premium_number_word' class="text-danger-2" ></div>
|
<div id='gpa_premium_number_word' class="text-danger-2" ></div>
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<button style="margin-top: 44px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(0,9)">x</button>
|
|
||||||
<button style="margin-top: 44px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(9)">+</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>`;
|
</div>`;
|
||||||
|
|
||||||
@ -563,8 +555,6 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
grid_container.insertAdjacentHTML('beforeend', grid_html);
|
grid_container.insertAdjacentHTML('beforeend', grid_html);
|
||||||
|
|
||||||
if (dataIdValue == '1') {
|
if (dataIdValue == '1') {
|
||||||
@ -708,8 +698,10 @@ $('body').on('click', '.btnPolicyModel', function() {
|
|||||||
}, 1000);
|
}, 1000);
|
||||||
console.log('policy grid responce', res);
|
console.log('policy grid responce', res);
|
||||||
var temp_for_premiumData = JSON.parse(res.premiumData);
|
var temp_for_premiumData = JSON.parse(res.premiumData);
|
||||||
|
console.log('policy grid responce', temp_for_premiumData);
|
||||||
res.premiumData = JSON.parse(res.premiumData);
|
res.premiumData = JSON.parse(res.premiumData);
|
||||||
|
console.log('policy grid responce', res.premiumData);
|
||||||
|
|
||||||
|
|
||||||
$('#nameOfThePolicy').html(' - ' + res.policy_name);
|
$('#nameOfThePolicy').html(' - ' + res.policy_name);
|
||||||
$('#grid_emp_count').val(res.count);
|
$('#grid_emp_count').val(res.count);
|
||||||
|
|||||||
Binary file not shown.
Loading…
Reference in New Issue
Block a user