CHANGE_EMPLOYEE_REST_CONTROLLER_UPDATE_KEY_CHANGE_SAVE : AADHAVAN
This commit is contained in:
parent
22614962c3
commit
602cceab7c
@ -631,11 +631,10 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
];
|
||||
|
||||
$basic_cover_si_value = '';
|
||||
$basic_cover_si_value = null;
|
||||
|
||||
//Grid id is 10 and 11 sum insure value add only for self other grid type self sum insure is for the dependence
|
||||
|
||||
if ($policy['policy_type_id'] != 1) {
|
||||
// if ($policy['policy_type_id'] != 1) {
|
||||
if ($policy_permium['policy_grid_id'] == 10 || $policy_permium['policy_grid_id'] == 11) {
|
||||
if (strtolower($extra['5'][$index]) == 'self') {
|
||||
$basic_cover_si_value = $extra['9'][$index];
|
||||
@ -656,7 +655,7 @@ class EmployeeRestController extends AdminController
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
$record2 = [
|
||||
'basic_cover_si' => $basic_cover_si_value,
|
||||
@ -668,10 +667,11 @@ class EmployeeRestController extends AdminController
|
||||
}
|
||||
for ($a=0; $a <count($dataToInsert) ; $a++)
|
||||
{
|
||||
$employee = $this->employeeModel->checkExistingEmpEntrollment($dataToInsert[$a]);
|
||||
$employee = $this->employeeModel->checkExistingEmployee($dataToInsert[$a]);
|
||||
$emp_id =0;
|
||||
|
||||
$data_after_gpa_or_gmc =[];
|
||||
// print_r($policy);die;
|
||||
if ($policy['policy_type_id'] == 1) {
|
||||
if (strtolower($dataToInsert[$a]['relationship']) == 'self') {
|
||||
$data_after_gpa_or_gmc = $dataToInsert[$a];
|
||||
@ -681,12 +681,18 @@ class EmployeeRestController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
|
||||
date_default_timezone_set('Asia/Kolkata');
|
||||
$current_timestamp = time();
|
||||
$formatted_date_time = date('Y-m-d H:i:s', $current_timestamp);
|
||||
|
||||
if ($employee) {
|
||||
|
||||
|
||||
$emp_id =$employee['id'];
|
||||
$id =$emp_id;
|
||||
$result = $this->employeeModel->update($id, $data_after_gpa_or_gmc);
|
||||
$data_after_gpa_or_gmc['id'] = $id;
|
||||
$data_after_gpa_or_gmc['updated_at'] = $formatted_date_time;
|
||||
$result = $this->employeeModel->save($data_after_gpa_or_gmc);
|
||||
if ($result) {
|
||||
$log_message = 'Update Employee - '.$employee['name'].'('.$employee['emp_code'].') with PK '.$employee['id'];
|
||||
$this->myLogger->logme('error',('Update - ' . $employee['id'].' - '. $employee['emp_code'] .' - '.$employee['name']));
|
||||
@ -719,7 +725,9 @@ class EmployeeRestController extends AdminController
|
||||
$employee_policy = $this->employeePolicyModel->checkExistingEmpPolicy(['employee_id' => $emp_id,'client_policy_id' => $policy_id]);
|
||||
if ($employee_policy) {
|
||||
foreach ($employee_policy as $existing_policy) {
|
||||
$this->employeePolicyModel->update($existing_policy['id'], $emp_policy_data);
|
||||
$emp_policy_data['id']= $existing_policy['id'];
|
||||
$emp_policy_data['updated_at'] = $formatted_date_time;
|
||||
$this->employeePolicyModel->save($emp_policy_data);
|
||||
}
|
||||
} else {
|
||||
$emp_policy = $this->employeePolicyModel->insert($emp_policy_data);
|
||||
|
||||
@ -29,6 +29,7 @@ class EmployeeModel extends Model
|
||||
"emp_status",
|
||||
"created_by",
|
||||
"updated_by",
|
||||
"updated_at",
|
||||
"is_active",
|
||||
];
|
||||
|
||||
@ -51,9 +52,12 @@ class EmployeeModel extends Model
|
||||
|
||||
|
||||
// for EMP rest API process do not change
|
||||
public function checkExistingEmpEntrollment($arr)
|
||||
{
|
||||
return $this->where('emp_code',$arr['emp_code'])->where('name',$arr['name'])->first();
|
||||
public function checkExistingEmployee($arr)
|
||||
{
|
||||
return $this->where('emp_code',$arr['emp_code'])->where('name',$arr['name'])->where('client_id', $arr['client_id'])->first();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -29,6 +29,7 @@ class EmployeePolicyModel extends Model
|
||||
"gst",
|
||||
"created_by",
|
||||
"updated_by",
|
||||
"updated_at",
|
||||
"is_active",
|
||||
];
|
||||
|
||||
|
||||
@ -753,6 +753,10 @@
|
||||
}
|
||||
convertCommaNumberToWords(input);
|
||||
|
||||
if (input.id == 'gpa_sum_si') {
|
||||
gpaSumInsureMultiplier(input);
|
||||
}
|
||||
|
||||
// if(input.id == 'basic_pay'){
|
||||
// var inputNumber = input.value;
|
||||
// if (inputNumber) {
|
||||
|
||||
@ -1424,7 +1424,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
function gpaSumInsureMultiplier() {
|
||||
function gpaSumInsureMultiplier(element) {
|
||||
console.log(element);
|
||||
var element = $('#gpa_sum_multiplier')[0];
|
||||
var sumInsured = $('input[name="gpa_sum_si[]"]');
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user