CODE_MERGE : RV
This commit is contained in:
commit
a14e16e729
@ -212,7 +212,7 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
public function addEmployeeAndDependence()
|
||||
{
|
||||
// try {
|
||||
try {
|
||||
$data = $this->request->getJSON();
|
||||
|
||||
|
||||
@ -254,20 +254,13 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
if(isset($data[0]->id))
|
||||
{
|
||||
if(!isset($data[0]->is_addon_value))
|
||||
{
|
||||
$this->createEmployeePolicyData($data[0]->id , $data[0]->emp_code , $data[0]->client_id , $data[0]->client_policy_id);
|
||||
}else{
|
||||
|
||||
$this->createEmployeePolicyData($data[0]->id , $data[0]->emp_code , $data[0]->client_id , $data[0]->client_policy_id , $data[0]->basic_cover_si);
|
||||
}
|
||||
|
||||
|
||||
}else{
|
||||
if(!isset($data[0]->is_addon_value))
|
||||
{
|
||||
$this->createEmployeePolicyData($employee , $data[0]->emp_code , $data[0]->client_id , $data[0]->client_policy_id);
|
||||
}else{
|
||||
|
||||
$this->createEmployeePolicyData($employee , $data[0]->emp_code , $data[0]->client_id , $data[0]->client_policy_id , $data[0]->basic_cover_si);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -283,9 +276,9 @@ class EmployeeRestController extends AdminController
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => $result], 404);
|
||||
}
|
||||
}
|
||||
// } catch (\Exception $e) {
|
||||
// return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
|
||||
// }
|
||||
} catch (\Exception $e) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -327,7 +320,10 @@ class EmployeeRestController extends AdminController
|
||||
public function updatePremiumAmount($client_policy_id , $emp_code , $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]))
|
||||
{
|
||||
|
||||
@ -441,35 +437,13 @@ class EmployeeRestController extends AdminController
|
||||
{
|
||||
|
||||
try {
|
||||
|
||||
$requestData = $this->request->getJSON();
|
||||
|
||||
foreach ($requestData as $key => $value) {
|
||||
|
||||
|
||||
$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);
|
||||
}
|
||||
if(count($requestData))
|
||||
{
|
||||
$this->updatePremiumAmount($requestData[0]->client_policy_id , $requestData[0]->emp_code , $requestData[0]->client_branch_id);
|
||||
}
|
||||
|
||||
$this->updatePremiumAmount($requestData[0]->client_policy_id , $requestData[0]->emp_code);
|
||||
|
||||
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => []], 200);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
@ -1227,7 +1201,7 @@ class EmployeeRestController extends AdminController
|
||||
->where('employee_polices.client_policy_id',$array->ClientPolicyId)
|
||||
->get()
|
||||
->getResult();
|
||||
|
||||
|
||||
if(count($tpaArray))
|
||||
{
|
||||
|
||||
@ -1517,7 +1491,7 @@ class EmployeeRestController extends AdminController
|
||||
->where('client_branch_id',$this->request->getGet('client_branch_id'))
|
||||
->where('is_addon_value',1)->findAll();
|
||||
|
||||
|
||||
|
||||
|
||||
$clientPolicy = $this->clientPolicyModel->where('client_id',$this->request->getGet('client_id'))
|
||||
->where('client_branch_id',$this->request->getGet('client_branch_id'))
|
||||
@ -1526,8 +1500,17 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
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 = [];
|
||||
foreach ($clientPolicy as $key => $array) {
|
||||
$responce = [];
|
||||
@ -1579,6 +1562,7 @@ class EmployeeRestController extends AdminController
|
||||
->get()
|
||||
->getResult();
|
||||
|
||||
|
||||
if(count($tpaArray))
|
||||
{
|
||||
if($tpaArray[0]->tpa_id != null)
|
||||
@ -1602,7 +1586,13 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
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
|
||||
$familyFloates = $policy_terms->family_floaters;
|
||||
@ -1613,8 +1603,7 @@ class EmployeeRestController extends AdminController
|
||||
}
|
||||
// Convert familyFloaters terms data to plain array
|
||||
$floters = $this->FloterConvertion($familyFloates);
|
||||
|
||||
|
||||
|
||||
$data = [];
|
||||
$dependent_and_si_value = 0;
|
||||
$dependent_and_si_premium_value = 0;
|
||||
@ -1626,7 +1615,7 @@ class EmployeeRestController extends AdminController
|
||||
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();
|
||||
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;}
|
||||
|
||||
$temp['is_value_exist'] = true;
|
||||
@ -1649,59 +1638,30 @@ class EmployeeRestController extends AdminController
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Remove Unwanted floter key from floters array based on either-parents-pil term value
|
||||
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_in_law = 0;
|
||||
foreach ($floters as $value) {
|
||||
if (preg_replace('/\d/', '', $value) == 'parent') { $count_parent++; }
|
||||
if (preg_replace('/\d/', '', $value) == 'parent_in_law') {$count_parent_in_law++;}
|
||||
}
|
||||
if($count_parent != 2) {
|
||||
$floters = array_filter($floters, fn($value) => strpos($value, 'parent_in_law') === false);
|
||||
}
|
||||
if($count_parent_in_law != 2) {
|
||||
$floters = array_filter($floters, fn($value) => strpos($value, 'parent') === false || strpos($value, 'parent_in_law') !== false);
|
||||
}
|
||||
$count_parent = 0;
|
||||
$count_parent_in_law = 0;
|
||||
foreach ($floters as $value) {
|
||||
if (preg_replace('/\d/', '', $value) == 'parent') { $count_parent++; }
|
||||
if (preg_replace('/\d/', '', $value) == 'parent_in_law') {$count_parent_in_law++;}
|
||||
}
|
||||
if($count_parent != 2) {
|
||||
$floters = array_filter($floters, fn($value) => strpos($value, 'parent_in_law') === false);
|
||||
}
|
||||
if($count_parent_in_law != 2) {
|
||||
$floters = array_filter($floters, fn($value) => strpos($value, 'parent') === false || strpos($value, 'parent_in_law') !== false);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
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;
|
||||
foreach ($floters as $value) {
|
||||
if (preg_replace('/\d/', '', $value) == 'parent') { $count_parent++; }
|
||||
@ -1710,12 +1670,10 @@ class EmployeeRestController extends AdminController
|
||||
if(($count_parent + $count_parent_in_law) == 2) {
|
||||
$floters = array_filter($floters, fn($value) => strpos($value, 'parent') === false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Add family floter buttons placement data for FE validation
|
||||
if(count($floters)){
|
||||
foreach ($floters as $familyFloatesValue) {
|
||||
@ -1732,11 +1690,11 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$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_premium_value'] = $dependent_and_si_premium_value;
|
||||
$responce['family_floaters_of_dependent_and_gst_value'] = $dependent_and_si_gst_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 > 0 ? $dependent_and_si_premium_value : 0;
|
||||
$responce['family_floaters_of_dependent_and_gst_value'] = $dependent_and_si_gst_value > 0 ? $dependent_and_si_gst_value : 0;
|
||||
|
||||
|
||||
|
||||
@ -1774,7 +1732,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();
|
||||
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;}
|
||||
$temp3['is_value_exist'] = true;
|
||||
$temp3['data']['employee_id'] = $value['id'];
|
||||
@ -1823,7 +1781,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();
|
||||
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;}
|
||||
$temp3['is_value_exist'] = true;
|
||||
$temp3['data']['employee_id'] = $value['id'];
|
||||
@ -1868,7 +1826,7 @@ class EmployeeRestController extends AdminController
|
||||
$postData = json_decode($this->request->getBody(), true);
|
||||
$client_policy_id = $postData['client_policy_id'];
|
||||
sort($client_policy_id);
|
||||
// Alternatively, you can use echo to see the type
|
||||
|
||||
$emp_code = $postData['emp_code'];
|
||||
$client_id = $postData['client_id'];
|
||||
|
||||
@ -1918,8 +1876,8 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
$account_manager_wholeData =sendMailNotification::sendMailNotification('account_maneger_summary_mail', $params);
|
||||
|
||||
if ($account_manager_wholeData) {
|
||||
|
||||
if($account_manager_wholeData != null && $account_manager_wholeData != '' && count($account_manager_wholeData))
|
||||
{
|
||||
foreach ($account_manager_wholeData as $key => $value) {
|
||||
$mail_send_return1 = MailHelper::send_email($value);
|
||||
$this->myLogger->logme("info", $mail_send_return1);
|
||||
@ -1930,8 +1888,8 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
$client_hr_wholeData =sendMailNotification::sendMailNotification('client_hr_summary_mail', $params);
|
||||
|
||||
if ($client_hr_wholeData) {
|
||||
|
||||
if($client_hr_wholeData != null && $client_hr_wholeData != '' &&count($client_hr_wholeData))
|
||||
{
|
||||
foreach ($client_hr_wholeData as $key => $value) {
|
||||
$mail_send_return2 = MailHelper::send_email($value);
|
||||
$this->myLogger->logme("info", $mail_send_return2);
|
||||
|
||||
@ -1566,7 +1566,7 @@ class MasterController extends AdminController
|
||||
{
|
||||
|
||||
if ($this->request->getMethod() == 'post') {
|
||||
$gmailapi = \Config\Services::gmailapi();
|
||||
// $gmailapi = \Config\Services::gmailapi();
|
||||
|
||||
$to = $this->request->getPost('to');
|
||||
$subject = $this->request->getPost('subject');
|
||||
@ -1603,7 +1603,7 @@ class MasterController extends AdminController
|
||||
public function testGmailAPIViaCLI(string $email_id = 'velmurugan.s@venbainfotech.com')
|
||||
{
|
||||
// print_r($email_id);die();
|
||||
$gmailapi = \Config\Services::gmailapi();
|
||||
// $gmailapi = \Config\Services::gmailapi();
|
||||
$res = MailHelper::send_email(['mail' => $email_id, 'subject' => 'Mail Via CLI', 'message' => 'This is sample mail sent via CLI mode']);
|
||||
print_r($res);
|
||||
|
||||
|
||||
@ -95,12 +95,14 @@ class MailHelper
|
||||
$message = $params['message'];
|
||||
if (isset($params['bcc'])) {
|
||||
$bcc = $params['bcc'];
|
||||
$bcc = explode(',', $bcc);
|
||||
}else{
|
||||
$bcc = [];
|
||||
}
|
||||
|
||||
if (isset($params['cc'])) {
|
||||
$cc = $params['cc'];
|
||||
$cc = explode(',', $cc);
|
||||
}else{
|
||||
$cc = [];
|
||||
}
|
||||
|
||||
@ -1581,7 +1581,7 @@ if(!function_exists('get_emp_records_from_audit_history'))
|
||||
function get_emp_records_from_audit_history($employee_id)
|
||||
{
|
||||
$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' and field_name in ('name','dob','gender','mobile','email_corporate','relationship') group by field_name order by id asc";
|
||||
$query = "SELECT min(id) as id,pk,table_name,field_name,old_value FROM 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);
|
||||
// echo $db->getLastQuery();
|
||||
$res = $res->getResultArray();
|
||||
@ -1603,7 +1603,7 @@ 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";
|
||||
$query = "SELECT min(id) as id,pk,table_name,field_name,old_value FROM 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();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user