Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
c80dad91bc
@ -327,7 +327,10 @@ class EmployeeRestController extends AdminController
|
|||||||
public function updatePremiumAmount($client_policy_id , $emp_code , $client_branch_id)
|
public function updatePremiumAmount($client_policy_id , $emp_code , $client_branch_id)
|
||||||
{
|
{
|
||||||
$response = $this->calculatePremium($client_policy_id , $emp_code , null , $client_branch_id);
|
$response = $this->calculatePremium($client_policy_id , $emp_code , null , $client_branch_id);
|
||||||
|
// echo '<pre>';
|
||||||
|
// print_r($response);
|
||||||
|
// echo '</pre>';
|
||||||
|
// die();
|
||||||
if(count($response[$emp_code]))
|
if(count($response[$emp_code]))
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -441,34 +444,12 @@ class EmployeeRestController extends AdminController
|
|||||||
{
|
{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$requestData = $this->request->getJSON();
|
$requestData = $this->request->getJSON();
|
||||||
|
if(count($requestData))
|
||||||
foreach ($requestData as $key => $value) {
|
{
|
||||||
|
$this->updatePremiumAmount($requestData[0]->client_policy_id , $requestData[0]->emp_code , $requestData[0]->client_branch_id);
|
||||||
|
|
||||||
$checkIfExist = $this->employeePolicyModel->where('employee_id', $value->employee_id)
|
|
||||||
->where('client_policy_id', $value->client_policy_id)
|
|
||||||
->where('is_active', 1 )
|
|
||||||
->findAll();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($checkIfExist) {
|
|
||||||
|
|
||||||
$empPolicy = $this->employeePolicyModel->updateSiAndPremium($value->client_policy_id, $value->employee_id, $value->basic_cover_si);
|
|
||||||
|
|
||||||
}else{
|
|
||||||
|
|
||||||
$data['employee_id']= $value->employee_id;
|
|
||||||
$data['client_policy_id']= $value->client_policy_id;
|
|
||||||
$data['basic_cover_si']= $value->basic_cover_si;
|
|
||||||
$data['status'] = 'draft';
|
|
||||||
|
|
||||||
$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);
|
||||||
|
|
||||||
@ -1526,8 +1507,17 @@ class EmployeeRestController extends AdminController
|
|||||||
|
|
||||||
if(count($clientPolicy))
|
if(count($clientPolicy))
|
||||||
{
|
{
|
||||||
$band = $this->employeeModel->where('is_active', 1 )->where('emp_code',$this->request->getGet('emp_code'))->where('client_id',$this->request->getGet('client_id'))->where('client_branch_id',$this->request->getGet('client_branch_id'))->where('family_floater_key','self')->get()->getRow()->band;
|
$self = $this->employeeModel
|
||||||
|
->join('employee_polices', 'employees.id = employee_polices.employee_id')
|
||||||
|
->where('employees.is_active', 1)
|
||||||
|
->where('employees.emp_code', $this->request->getGet('emp_code'))
|
||||||
|
->where('employees.client_id', $this->request->getGet('client_id'))
|
||||||
|
->where('employees.client_branch_id', $this->request->getGet('client_branch_id'))
|
||||||
|
->where('employees.family_floater_key', 'self')
|
||||||
|
->get()
|
||||||
|
->getRow();
|
||||||
|
|
||||||
|
$band = $self->band;
|
||||||
$PolicyData = [];
|
$PolicyData = [];
|
||||||
foreach ($clientPolicy as $key => $array) {
|
foreach ($clientPolicy as $key => $array) {
|
||||||
$responce = [];
|
$responce = [];
|
||||||
@ -1579,6 +1569,7 @@ class EmployeeRestController extends AdminController
|
|||||||
->get()
|
->get()
|
||||||
->getResult();
|
->getResult();
|
||||||
|
|
||||||
|
|
||||||
if(count($tpaArray))
|
if(count($tpaArray))
|
||||||
{
|
{
|
||||||
if($tpaArray[0]->tpa_id != null)
|
if($tpaArray[0]->tpa_id != null)
|
||||||
@ -1603,6 +1594,12 @@ class EmployeeRestController extends AdminController
|
|||||||
if($array['is_addon'] == 3 && $array['policy_type_id'] == 3)//dependent add on policy
|
if($array['is_addon'] == 3 && $array['policy_type_id'] == 3)//dependent add on policy
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$selfSi = $self->basic_cover_si;
|
||||||
|
$filteredSlabRates = array_filter($responce['SlabRates'], function ($rate) use ($selfSi) {
|
||||||
|
return $rate['si'] === $selfSi;
|
||||||
|
});
|
||||||
|
// To reindex the array to have a proper 0 index
|
||||||
|
$responce['SlabRates'] = array_values($filteredSlabRates);
|
||||||
|
|
||||||
// Map family floaters that already exist in the employee table
|
// Map family floaters that already exist in the employee table
|
||||||
$familyFloates = $policy_terms->family_floaters;
|
$familyFloates = $policy_terms->family_floaters;
|
||||||
@ -1614,7 +1611,6 @@ class EmployeeRestController extends AdminController
|
|||||||
// Convert familyFloaters terms data to plain array
|
// Convert familyFloaters terms data to plain array
|
||||||
$floters = $this->FloterConvertion($familyFloates);
|
$floters = $this->FloterConvertion($familyFloates);
|
||||||
|
|
||||||
|
|
||||||
$data = [];
|
$data = [];
|
||||||
$dependent_and_si_value = 0;
|
$dependent_and_si_value = 0;
|
||||||
$dependent_and_si_premium_value = 0;
|
$dependent_and_si_premium_value = 0;
|
||||||
@ -1626,7 +1622,7 @@ class EmployeeRestController extends AdminController
|
|||||||
if ($value['family_floater_key'] === $dependent) {
|
if ($value['family_floater_key'] === $dependent) {
|
||||||
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array['id'])->where('is_active', 1 )->get()->getRow();
|
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array['id'])->where('is_active', 1 )->get()->getRow();
|
||||||
if(isset($employee_policy->basic_cover_si)){ $dependent_and_si_value = $employee_policy->basic_cover_si; }
|
if(isset($employee_policy->basic_cover_si)){ $dependent_and_si_value = $employee_policy->basic_cover_si; }
|
||||||
if(isset($employee_policy->premium)){ $dependent_and_si_premium_value = $dependent_and_si_premium_value + $employee_policy->premium;}
|
if(isset($employee_policy->rata_premimum)){ $dependent_and_si_premium_value = $dependent_and_si_premium_value + $employee_policy->rata_premimum;}
|
||||||
if(isset($employee_policy->gst)){ $dependent_and_si_gst_value = $dependent_and_si_gst_value + $employee_policy->gst;}
|
if(isset($employee_policy->gst)){ $dependent_and_si_gst_value = $dependent_and_si_gst_value + $employee_policy->gst;}
|
||||||
|
|
||||||
$temp['is_value_exist'] = true;
|
$temp['is_value_exist'] = true;
|
||||||
@ -1650,24 +1646,10 @@ class EmployeeRestController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Remove Unwanted floter key from floters array based on either-parents-pil term value
|
//Remove Unwanted floter key from floters array based on either-parents-pil term value
|
||||||
if($familyFloates->{'either-parents-pil'} == 1 && count($floters))
|
if($familyFloates->{'either-parents-pil'} == 1 && count($floters))
|
||||||
{
|
{
|
||||||
if(count($addOnEmployeeData) == 0)
|
|
||||||
{
|
|
||||||
$GMCEmpData = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code'))
|
|
||||||
->where('is_addon_value',0)
|
|
||||||
->where('is_active', 1 )
|
|
||||||
->where('family_floater_key','parent')
|
|
||||||
->findAll();
|
|
||||||
|
|
||||||
if(count($GMCEmpData) > 0){
|
|
||||||
$floters = array_diff($floters, ["parent1","parent2"]);
|
|
||||||
}else{
|
|
||||||
$floters = array_diff($floters, ["parent_in_law1","parent_in_law2"]);
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
|
|
||||||
$count_parent = 0;
|
$count_parent = 0;
|
||||||
$count_parent_in_law = 0;
|
$count_parent_in_law = 0;
|
||||||
@ -1681,26 +1663,11 @@ class EmployeeRestController extends AdminController
|
|||||||
if($count_parent_in_law != 2) {
|
if($count_parent_in_law != 2) {
|
||||||
$floters = array_filter($floters, fn($value) => strpos($value, 'parent') === false || strpos($value, 'parent_in_law') !== false);
|
$floters = array_filter($floters, fn($value) => strpos($value, 'parent') === false || strpos($value, 'parent_in_law') !== false);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else if($familyFloates->{'either-parents-pil'} == 2 && count($floters))
|
else if($familyFloates->{'either-parents-pil'} == 2 && count($floters))
|
||||||
{
|
{
|
||||||
if(count($addOnEmployeeData) == 0)
|
|
||||||
{
|
|
||||||
$GMCEmpData = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code'))
|
|
||||||
->where('is_addon_value',0)
|
|
||||||
->where('is_active', 1 )
|
|
||||||
->where('family_floater_key','parent')
|
|
||||||
->findAll();
|
|
||||||
|
|
||||||
if(count($GMCEmpData) > 0){
|
|
||||||
$floters = array_diff($floters, ["parent1","parent2"]);
|
|
||||||
}else{
|
|
||||||
$floters = array_diff($floters, ["parent_in_law1","parent_in_law2"]);
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
$count_parent = 0;
|
$count_parent = 0;
|
||||||
$count_parent_in_law = 0;
|
$count_parent_in_law = 0;
|
||||||
foreach ($floters as $value) {
|
foreach ($floters as $value) {
|
||||||
@ -1710,12 +1677,10 @@ class EmployeeRestController extends AdminController
|
|||||||
if(($count_parent + $count_parent_in_law) == 2) {
|
if(($count_parent + $count_parent_in_law) == 2) {
|
||||||
$floters = array_filter($floters, fn($value) => strpos($value, 'parent') === false);
|
$floters = array_filter($floters, fn($value) => strpos($value, 'parent') === false);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Add family floter buttons placement data for FE validation
|
// Add family floter buttons placement data for FE validation
|
||||||
if(count($floters)){
|
if(count($floters)){
|
||||||
foreach ($floters as $familyFloatesValue) {
|
foreach ($floters as $familyFloatesValue) {
|
||||||
@ -1734,9 +1699,9 @@ class EmployeeRestController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$responce['family_floaters_of_dependent_and_si_array'] = $data;
|
$responce['family_floaters_of_dependent_and_si_array'] = $data;
|
||||||
$responce['family_floaters_of_dependent_and_si_value'] = $dependent_and_si_value;
|
$responce['family_floaters_of_dependent_and_si_value'] = $dependent_and_si_value > 0 ? $dependent_and_si_value : 0;
|
||||||
$responce['family_floaters_of_dependent_and_si_premium_value'] = $dependent_and_si_premium_value;
|
$responce['family_floaters_of_dependent_and_si_premium_value'] = $dependent_and_si_premium_value > 0 ? $dependent_and_si_premium_value : 0;
|
||||||
$responce['family_floaters_of_dependent_and_gst_value'] = $dependent_and_si_gst_value;
|
$responce['family_floaters_of_dependent_and_gst_value'] = $dependent_and_si_gst_value > 0 ? $dependent_and_si_gst_value : 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1774,7 +1739,7 @@ class EmployeeRestController extends AdminController
|
|||||||
|
|
||||||
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array['id'])->where('is_active', 1 )->get()->getRow();
|
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array['id'])->where('is_active', 1 )->get()->getRow();
|
||||||
if(isset($employee_policy->basic_cover_si)){ $only_si_value = $employee_policy->basic_cover_si; }
|
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->rata_premimum;}
|
if(isset($employee_policy->rata_premimum)){ $only_si_premium_value = $only_si_premium_value + $employee_policy->rata_premimum;}
|
||||||
if(isset($employee_policy->gst)){ $only_si_gst_value = $only_si_gst_value + $employee_policy->gst;}
|
if(isset($employee_policy->gst)){ $only_si_gst_value = $only_si_gst_value + $employee_policy->gst;}
|
||||||
$temp3['is_value_exist'] = true;
|
$temp3['is_value_exist'] = true;
|
||||||
$temp3['data']['employee_id'] = $value['id'];
|
$temp3['data']['employee_id'] = $value['id'];
|
||||||
@ -1823,7 +1788,7 @@ class EmployeeRestController extends AdminController
|
|||||||
|
|
||||||
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array['id'])->where('is_active', 1 )->get()->getRow();
|
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array['id'])->where('is_active', 1 )->get()->getRow();
|
||||||
if(isset($employee_policy->basic_cover_si)){ $only_si_value = $employee_policy->basic_cover_si; }
|
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->rata_premimum;}
|
if(isset($employee_policy->rata_premimum)){ $only_si_premium_value = $only_si_premium_value + $employee_policy->rata_premimum;}
|
||||||
if(isset($employee_policy->gst)){ $only_si_gst_value = $only_si_gst_value + $employee_policy->gst;}
|
if(isset($employee_policy->gst)){ $only_si_gst_value = $only_si_gst_value + $employee_policy->gst;}
|
||||||
$temp3['is_value_exist'] = true;
|
$temp3['is_value_exist'] = true;
|
||||||
$temp3['data']['employee_id'] = $value['id'];
|
$temp3['data']['employee_id'] = $value['id'];
|
||||||
@ -1868,7 +1833,7 @@ class EmployeeRestController extends AdminController
|
|||||||
$postData = json_decode($this->request->getBody(), true);
|
$postData = json_decode($this->request->getBody(), true);
|
||||||
$client_policy_id = $postData['client_policy_id'];
|
$client_policy_id = $postData['client_policy_id'];
|
||||||
sort($client_policy_id);
|
sort($client_policy_id);
|
||||||
// Alternatively, you can use echo to see the type
|
|
||||||
$emp_code = $postData['emp_code'];
|
$emp_code = $postData['emp_code'];
|
||||||
$client_id = $postData['client_id'];
|
$client_id = $postData['client_id'];
|
||||||
|
|
||||||
@ -1918,19 +1883,25 @@ class EmployeeRestController extends AdminController
|
|||||||
|
|
||||||
$account_manager_wholeData =sendMailNotification::sendMailNotification('account_maneger_summary_mail', $params);
|
$account_manager_wholeData =sendMailNotification::sendMailNotification('account_maneger_summary_mail', $params);
|
||||||
|
|
||||||
|
if($account_manager_wholeData != null && $account_manager_wholeData != '' && count($account_manager_wholeData))
|
||||||
|
{
|
||||||
foreach ($account_manager_wholeData as $key => $value) {
|
foreach ($account_manager_wholeData as $key => $value) {
|
||||||
$mail_send_return1 = MailHelper::send_email($value);
|
$mail_send_return1 = MailHelper::send_email($value);
|
||||||
$this->myLogger->logme("info", $mail_send_return1);
|
$this->myLogger->logme("info", $mail_send_return1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$client_hr_wholeData =sendMailNotification::sendMailNotification('client_hr_summary_mail', $params);
|
$client_hr_wholeData =sendMailNotification::sendMailNotification('client_hr_summary_mail', $params);
|
||||||
|
|
||||||
|
if($client_hr_wholeData != null && $client_hr_wholeData != '' &&count($client_hr_wholeData))
|
||||||
|
{
|
||||||
foreach ($client_hr_wholeData as $key => $value) {
|
foreach ($client_hr_wholeData as $key => $value) {
|
||||||
$mail_send_return2 = MailHelper::send_email($value);
|
$mail_send_return2 = MailHelper::send_email($value);
|
||||||
$this->myLogger->logme("info", $mail_send_return2);
|
$this->myLogger->logme("info", $mail_send_return2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user