CHANGE_BOOLEAN_VALUE_OMMITED_IN_ONBOARD
This commit is contained in:
parent
fa95e29a07
commit
b28a614980
@ -1548,109 +1548,114 @@ class EmployeeServiceController extends AdminController
|
||||
|
||||
|
||||
// insert or update in db for inception addition depent addition
|
||||
public function employeesOnboardProcess($params)
|
||||
public function employeesOnboardProcess($params)
|
||||
{
|
||||
$familiy_data = $params['familiy_data'];
|
||||
$file = $params['file'];
|
||||
foreach($familiy_data as $fkey => $value)
|
||||
{
|
||||
if($file['id'] == null || $value['temp']['source'] == 'excel' || (($file['action'] == 'dependent_addition' && ($value['temp']['premium_type'] == 1 && strtolower($value['relationship']) == 'self') || ($value['temp']['premium_type'] == 2 || $value['temp']['premium_type'] == null)))) //insert data come from excel and from db i.e. ( $file['id'] == null for enrollment data)
|
||||
if(is_array($value))
|
||||
{
|
||||
|
||||
$employee = $this->employeeModel->checkExistingEmp($value,$file['client_branch_id']);
|
||||
$policy_data = $value['policy_details'];
|
||||
$temp = $value['temp'];
|
||||
unset($value['policy_details']);
|
||||
unset($value['temp']);
|
||||
// Kint::dump($value);
|
||||
// Kint::dump($temp);
|
||||
// Kint::dump($policy_data);
|
||||
// echo '---------------------------------------';
|
||||
|
||||
//start implemet of si enhancement of grid type 10,11
|
||||
if(count($employee) && $file['action'] == 'dependent_addition' && $temp['source'] == 'db' && in_array($value['temp']['grid_id'],[10,11]) && ( ($value['temp']['premium_type'] == 1 && (strtolower($value['relationship']) == 'self' || $temp['acting_self'])) || ($value['temp']['premium_type'] == 2 || $value['temp']['premium_type'] == null)))
|
||||
{
|
||||
$log_message = 'Employee record from DB,Checking SI for - '.$employee[0]['name'].'('.$employee[0]['emp_code'].')';
|
||||
$this->myLogger->logme('error',$log_message);
|
||||
$res = $this->employeesSIEnhanceProcessWhileOnbboard(employee:$employee[0],policy_data: $policy_data,file:$file);// where employee holds existing emp data and policy_data holds new si enhancement
|
||||
|
||||
break;//skip db employee
|
||||
}
|
||||
//end implemet of si enhancement of grid type
|
||||
|
||||
//save employee table
|
||||
$value['relationship'] = ucfirst(trim($value['relationship']));
|
||||
if(count($employee))
|
||||
{
|
||||
$value['updated_by'] = $file['created_by'];
|
||||
$value['id'] = $employee[0]['id'];
|
||||
$value['emp_status'] = 'active';
|
||||
$value['client_branch_id'] = $file['client_branch_id'];
|
||||
$log_message = 'Update Employee - '.$employee[0]['name'].'('.$employee[0]['emp_code'].') with PK '.$employee[0]['id'];
|
||||
// $this->myLogger->logme('error',('Update - ' . $employee[0]['id'].' - '. $employee[0]['emp_code'] .' - '.$employee[0]['name']));
|
||||
// echo 'insert emp';
|
||||
}
|
||||
else
|
||||
{
|
||||
$value['emp_status'] = 'active';
|
||||
$value['created_by'] = $file['created_by'];
|
||||
$value['client_branch_id'] = $file['client_branch_id'];
|
||||
$log_message = 'Insert Employee- '.$value['name'] .'('.$value['emp_code'] .') with PK ';
|
||||
// $this->myLogger->logme('error',('Insert - ' . $value['emp_code'] .' - '. $value['name']));
|
||||
// echo 'update emp';
|
||||
}
|
||||
|
||||
$this->employeeModel->save($value);
|
||||
$emp_id = $this->employeeModel->getInsertID();
|
||||
if($emp_id != 0){ $log_message .= $emp_id; }
|
||||
else{ $emp_id = $employee[0]['id']; }
|
||||
|
||||
$this->myLogger->logme('error',$log_message);
|
||||
|
||||
//save policy table
|
||||
$employee_policy = $this->employeePolicyModel->checkExistingEmpPolicy(['employee_id' => $emp_id,'client_policy_id' => $file['policy_id']]);
|
||||
if(count($employee_policy))
|
||||
{
|
||||
$policy_data['updated_by'] = $file['created_by'];
|
||||
$policy_data['id'] = $employee_policy[0]['id'];
|
||||
$policy_data['status'] = 'active';
|
||||
|
||||
$log_message = 'Update Employee Policy for '. $value['name'].'('. $value['emp_code'].') with PK- ' . $employee_policy[0]['id'] .' client policy ID '.$employee_policy[0]['client_policy_id'].' with SI '.$policy_data['basic_cover_si'];
|
||||
// echo 'insert policy';
|
||||
}
|
||||
else
|
||||
{
|
||||
$policy_data['employee_id'] = $emp_id;
|
||||
$policy_data['client_policy_id'] = $file['policy_id'];
|
||||
$policy_data['created_by'] = $file['created_by'];
|
||||
$policy_data['status'] = 'active';
|
||||
$log_message = 'Insert Employee Policy for '. $value['name'].'('. $value['emp_code'].') - client policy id -'. $file['policy_id'].' - with SI '.$policy_data['basic_cover_si'];
|
||||
// echo 'update policy';
|
||||
}
|
||||
|
||||
$this->employeePolicyModel->save($policy_data);
|
||||
$emp_policy_id = $this->employeePolicyModel->getInsertID();
|
||||
if($emp_policy_id != 0)//emp policy inserted
|
||||
{
|
||||
$log_message .= ' with PK ' . $emp_policy_id;
|
||||
|
||||
//make endorsement entry if action is addition OR Dependt addition
|
||||
if(($file['action'] == 'missed_inception' || $file['action'] == 'dependent_addition' || $file['action'] == 'addition') && $temp['source'] == 'excel')
|
||||
|
||||
if($file['id'] == null || $value['temp']['source'] == 'excel' || (($file['action'] == 'dependent_addition' && ($value['temp']['premium_type'] == 1 && strtolower($value['relationship']) == 'self') || ($value['temp']['premium_type'] == 2 || $value['temp']['premium_type'] == null)))) //insert data come from excel and from db i.e. ( $file['id'] == null for enrollment data)
|
||||
{
|
||||
$log_message = $file['action'].' - endorsement'. $value['emp_code'].' - '.$value['name'].' - with policy id'.$emp_policy_id;
|
||||
$this->myLogger->logme('error',$log_message);
|
||||
$actions = ($file['action'] == 'dependent_addition' ? 'da' : ($file['action'] == 'addition' ? 'a' : NULL));
|
||||
$addition_endorse_data = ['pk' => $emp_policy_id,'group_key' => rand(100000, 999999),'emp_code' => $value['emp_code'],'table_name' => 'employee_polices','actions' => $actions,'name' => $value['name'],'field_name' => 'basic_cover_si','old_value' => NULL,'new_value' => $policy_data['basic_cover_si'],'remarks' => 'addition endorsement','file_id' => $file['id'],'created_by' => $file['created_by']];
|
||||
$this->employeeEndorsementforAddtionAndDependentAddition($addition_endorse_data);
|
||||
}
|
||||
|
||||
$employee = $this->employeeModel->checkExistingEmp($value,$file['client_branch_id']);
|
||||
$policy_data = $value['policy_details'];
|
||||
$temp = $value['temp'];
|
||||
unset($value['policy_details']);
|
||||
unset($value['temp']);
|
||||
// Kint::dump($value);
|
||||
// Kint::dump($temp);
|
||||
// Kint::dump($policy_data);
|
||||
// echo '---------------------------------------';
|
||||
|
||||
//start implemet of si enhancement of grid type 10,11
|
||||
if(count($employee) && $file['action'] == 'dependent_addition' && $temp['source'] == 'db' && in_array($value['temp']['grid_id'],[10,11]) && ( ($value['temp']['premium_type'] == 1 && (strtolower($value['relationship']) == 'self' || $temp['acting_self'])) || ($value['temp']['premium_type'] == 2 || $value['temp']['premium_type'] == null)))
|
||||
{
|
||||
$log_message = 'Employee record from DB,Checking SI for - '.$employee[0]['name'].'('.$employee[0]['emp_code'].')';
|
||||
$this->myLogger->logme('error',$log_message);
|
||||
$res = $this->employeesSIEnhanceProcessWhileOnbboard(employee:$employee[0],policy_data: $policy_data,file:$file);// where employee holds existing emp data and policy_data holds new si enhancement
|
||||
|
||||
}
|
||||
else{ $emp_policy_id = $employee_policy[0]['id']; }
|
||||
break;//skip db employee
|
||||
}
|
||||
//end implemet of si enhancement of grid type
|
||||
|
||||
//save employee table
|
||||
$value['relationship'] = ucfirst(trim($value['relationship']));
|
||||
if(count($employee))
|
||||
{
|
||||
$value['updated_by'] = $file['created_by'];
|
||||
$value['id'] = $employee[0]['id'];
|
||||
$value['emp_status'] = 'active';
|
||||
$value['client_branch_id'] = $file['client_branch_id'];
|
||||
$log_message = 'Update Employee - '.$employee[0]['name'].'('.$employee[0]['emp_code'].') with PK '.$employee[0]['id'];
|
||||
// $this->myLogger->logme('error',('Update - ' . $employee[0]['id'].' - '. $employee[0]['emp_code'] .' - '.$employee[0]['name']));
|
||||
// echo 'insert emp';
|
||||
}
|
||||
else
|
||||
{
|
||||
$value['emp_status'] = 'active';
|
||||
$value['created_by'] = $file['created_by'];
|
||||
$value['client_branch_id'] = $file['client_branch_id'];
|
||||
$log_message = 'Insert Employee- '.$value['name'] .'('.$value['emp_code'] .') with PK ';
|
||||
// $this->myLogger->logme('error',('Insert - ' . $value['emp_code'] .' - '. $value['name']));
|
||||
// echo 'update emp';
|
||||
}
|
||||
|
||||
$this->employeeModel->save($value);
|
||||
$emp_id = $this->employeeModel->getInsertID();
|
||||
if($emp_id != 0){ $log_message .= $emp_id; }
|
||||
else{ $emp_id = $employee[0]['id']; }
|
||||
|
||||
$this->myLogger->logme('error',$log_message);
|
||||
|
||||
//save policy table
|
||||
$employee_policy = $this->employeePolicyModel->checkExistingEmpPolicy(['employee_id' => $emp_id,'client_policy_id' => $file['policy_id']]);
|
||||
if(count($employee_policy))
|
||||
{
|
||||
$policy_data['updated_by'] = $file['created_by'];
|
||||
$policy_data['id'] = $employee_policy[0]['id'];
|
||||
$policy_data['status'] = 'active';
|
||||
|
||||
$log_message = 'Update Employee Policy for '. $value['name'].'('. $value['emp_code'].') with PK- ' . $employee_policy[0]['id'] .' client policy ID '.$employee_policy[0]['client_policy_id'].' with SI '.$policy_data['basic_cover_si'];
|
||||
// echo 'insert policy';
|
||||
}
|
||||
else
|
||||
{
|
||||
$policy_data['employee_id'] = $emp_id;
|
||||
$policy_data['client_policy_id'] = $file['policy_id'];
|
||||
$policy_data['created_by'] = $file['created_by'];
|
||||
$policy_data['status'] = 'active';
|
||||
$log_message = 'Insert Employee Policy for '. $value['name'].'('. $value['emp_code'].') - client policy id -'. $file['policy_id'].' - with SI '.$policy_data['basic_cover_si'];
|
||||
// echo 'update policy';
|
||||
}
|
||||
|
||||
$this->employeePolicyModel->save($policy_data);
|
||||
$emp_policy_id = $this->employeePolicyModel->getInsertID();
|
||||
if($emp_policy_id != 0)//emp policy inserted
|
||||
{
|
||||
$log_message .= ' with PK ' . $emp_policy_id;
|
||||
|
||||
//make endorsement entry if action is addition OR Dependt addition
|
||||
if(($file['action'] == 'missed_inception' || $file['action'] == 'dependent_addition' || $file['action'] == 'addition') && $temp['source'] == 'excel')
|
||||
{
|
||||
$log_message = $file['action'].' - endorsement'. $value['emp_code'].' - '.$value['name'].' - with policy id'.$emp_policy_id;
|
||||
$this->myLogger->logme('error',$log_message);
|
||||
$actions = ($file['action'] == 'dependent_addition' ? 'da' : ($file['action'] == 'addition' ? 'a' : NULL));
|
||||
$addition_endorse_data = ['pk' => $emp_policy_id,'group_key' => rand(100000, 999999),'emp_code' => $value['emp_code'],'table_name' => 'employee_polices','actions' => $actions,'name' => $value['name'],'field_name' => 'basic_cover_si','old_value' => NULL,'new_value' => $policy_data['basic_cover_si'],'remarks' => 'addition endorsement','file_id' => $file['id'],'created_by' => $file['created_by']];
|
||||
$this->employeeEndorsementforAddtionAndDependentAddition($addition_endorse_data);
|
||||
}
|
||||
|
||||
}
|
||||
else{ $emp_policy_id = $employee_policy[0]['id']; }
|
||||
|
||||
$this->myLogger->logme('error',$log_message);
|
||||
$this->myLogger->logme('error',$log_message);
|
||||
|
||||
}// if end
|
||||
}// for end
|
||||
}// is array check end
|
||||
}// for end
|
||||
}//function end
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user