CHANGE_siAmountUpdate:GWM
This commit is contained in:
parent
76cc2b3f7d
commit
62054714e6
@ -183,7 +183,7 @@ class EmployeeRestController extends AdminController
|
|||||||
$item->family_floater_key = $this->RelationshipMap($item->relationship);
|
$item->family_floater_key = $this->RelationshipMap($item->relationship);
|
||||||
$item->gender = $this->GenderMap($item->relationship , $item->emp_code);
|
$item->gender = $this->GenderMap($item->relationship , $item->emp_code);
|
||||||
$item->dob = $this->convertDateFormatYMD($item->dob);
|
$item->dob = $this->convertDateFormatYMD($item->dob);
|
||||||
$item->emp_status = 'Draft';
|
$item->emp_status = 'draft';
|
||||||
$employee = $this->employeeModel->where('is_active', 1 )->update($id, (array)$item);
|
$employee = $this->employeeModel->where('is_active', 1 )->update($id, (array)$item);
|
||||||
if ($employee) {
|
if ($employee) {
|
||||||
$Count++;
|
$Count++;
|
||||||
@ -193,7 +193,7 @@ class EmployeeRestController extends AdminController
|
|||||||
$item->family_floater_key = $this->RelationshipMap($item->relationship);
|
$item->family_floater_key = $this->RelationshipMap($item->relationship);
|
||||||
$item->gender = $this->GenderMap($item->relationship , $item->emp_code);
|
$item->gender = $this->GenderMap($item->relationship , $item->emp_code);
|
||||||
$item->dob = $this->convertDateFormatYMD($item->dob);
|
$item->dob = $this->convertDateFormatYMD($item->dob);
|
||||||
$item->emp_status = 'Draft';
|
$item->emp_status = 'draft';
|
||||||
$employee = $this->employeeModel->insert($item);
|
$employee = $this->employeeModel->insert($item);
|
||||||
|
|
||||||
if ($employee) {
|
if ($employee) {
|
||||||
@ -209,7 +209,12 @@ class EmployeeRestController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($Count > 0) {
|
if ($Count > 0) {
|
||||||
|
|
||||||
|
if(!isset($data[0]->is_addon_value))
|
||||||
|
{
|
||||||
$this->updatePremiumAmount($data[0]->client_policy_id , $data[0]->emp_code);
|
$this->updatePremiumAmount($data[0]->client_policy_id , $data[0]->emp_code);
|
||||||
|
}
|
||||||
|
|
||||||
$result = [];
|
$result = [];
|
||||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result], 200);
|
return $this->respond(['status' => 'success','code' => 200,'data' => $result], 200);
|
||||||
} else {
|
} else {
|
||||||
@ -230,12 +235,28 @@ class EmployeeRestController extends AdminController
|
|||||||
$policy_terms = json_decode($client_policy['policy_terms']);
|
$policy_terms = json_decode($client_policy['policy_terms']);
|
||||||
$basic_cover_si = $policy_terms->sum_insured;
|
$basic_cover_si = $policy_terms->sum_insured;
|
||||||
|
|
||||||
|
$checkDataExist = $this->employeePolicyModel->where('employee_id',$employee_id)->where('client_policy_id',$client_policy_id)->first();
|
||||||
|
|
||||||
|
if($checkDataExist){
|
||||||
|
|
||||||
|
$this->employeePolicyModel
|
||||||
|
->where('client_policy_id',$client_policy_id )
|
||||||
|
->where('employee_id' , $employee_id )
|
||||||
|
->where('is_active', 1 )
|
||||||
|
->set(array('basic_cover_si'=> $basic_cover_si ))
|
||||||
|
->update();
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
$data['employee_id']= $employee_id;
|
$data['employee_id']= $employee_id;
|
||||||
$data['client_policy_id']= $client_policy_id;
|
$data['client_policy_id']= $client_policy_id;
|
||||||
$data['basic_cover_si']= $basic_cover_si;
|
$data['basic_cover_si']= $basic_cover_si;
|
||||||
$data['status']= 'draft';
|
$data['status']= 'draft';
|
||||||
|
|
||||||
$this->employeePolicyModel->insert($data);
|
$this->employeePolicyModel->insert($data);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,7 +266,7 @@ class EmployeeRestController extends AdminController
|
|||||||
|
|
||||||
if(count($response[$emp_code]))
|
if(count($response[$emp_code]))
|
||||||
{
|
{
|
||||||
print_r($response[$emp_code]);
|
|
||||||
foreach ($response[$emp_code] as $key => $value)
|
foreach ($response[$emp_code] as $key => $value)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -543,26 +564,26 @@ class EmployeeRestController extends AdminController
|
|||||||
->where('client_policy_id', $value->client_policy_id)
|
->where('client_policy_id', $value->client_policy_id)
|
||||||
->where('is_active', 1 )
|
->where('is_active', 1 )
|
||||||
->findAll();
|
->findAll();
|
||||||
$getSlabAndGridData = $this->policesModel->getPolicySlabRatesForEmpOnboard($value->client_policy_id,$value->client_id);
|
|
||||||
$SlabRatesArray = $getSlabAndGridData['slab_rates'];
|
|
||||||
$premium = $this->findPremiumAmount($SlabRatesArray, $value->basic_cover_si);
|
|
||||||
|
|
||||||
// dd($checkIfExist);
|
// dd($checkIfExist);
|
||||||
if ($checkIfExist) {
|
if ($checkIfExist) {
|
||||||
|
|
||||||
$empPolicy = $this->employeePolicyModel->updateSiAndPremium($value->client_policy_id, $value->employee_id, $value->basic_cover_si,$premium);
|
$empPolicy = $this->employeePolicyModel->updateSiAndPremium($value->client_policy_id, $value->employee_id, $value->basic_cover_si);
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
$data['employee_id']= $value->employee_id;
|
$data['employee_id']= $value->employee_id;
|
||||||
$data['client_policy_id']= $value->client_policy_id;
|
$data['client_policy_id']= $value->client_policy_id;
|
||||||
$data['basic_cover_si']= $value->basic_cover_si;
|
$data['basic_cover_si']= $value->basic_cover_si;
|
||||||
$data['premium']= $premium;
|
$data['status'] = 'draft';
|
||||||
$data['status'] = 'Draft';
|
|
||||||
|
|
||||||
$this->employeePolicyModel->insert($data);
|
$this->employeePolicyModel->insert($data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->updatePremiumAmount($requestData[0]->client_policy_id , $requestData[0]->emp_code);
|
||||||
|
|
||||||
return $this->respond(['status' => 'success','code' => 200,'data' => []], 200);
|
return $this->respond(['status' => 'success','code' => 200,'data' => []], 200);
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|||||||
@ -555,7 +555,7 @@ class EmployeePolicyModel extends Model
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
public function updateSiAndPremium( $client_policy_id, $employee_id,$basic_cover_si,$premium)
|
public function updateSiAndPremium( $client_policy_id, $employee_id,$basic_cover_si,$premium = 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user