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
|
//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 ($policy_permium['policy_grid_id'] == 10 || $policy_permium['policy_grid_id'] == 11) {
|
||||||
if (strtolower($extra['5'][$index]) == 'self') {
|
if (strtolower($extra['5'][$index]) == 'self') {
|
||||||
$basic_cover_si_value = $extra['9'][$index];
|
$basic_cover_si_value = $extra['9'][$index];
|
||||||
@ -656,7 +655,7 @@ class EmployeeRestController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
// }
|
||||||
|
|
||||||
$record2 = [
|
$record2 = [
|
||||||
'basic_cover_si' => $basic_cover_si_value,
|
'basic_cover_si' => $basic_cover_si_value,
|
||||||
@ -668,10 +667,11 @@ class EmployeeRestController extends AdminController
|
|||||||
}
|
}
|
||||||
for ($a=0; $a <count($dataToInsert) ; $a++)
|
for ($a=0; $a <count($dataToInsert) ; $a++)
|
||||||
{
|
{
|
||||||
$employee = $this->employeeModel->checkExistingEmpEntrollment($dataToInsert[$a]);
|
$employee = $this->employeeModel->checkExistingEmployee($dataToInsert[$a]);
|
||||||
$emp_id =0;
|
$emp_id =0;
|
||||||
|
|
||||||
$data_after_gpa_or_gmc =[];
|
$data_after_gpa_or_gmc =[];
|
||||||
|
// print_r($policy);die;
|
||||||
if ($policy['policy_type_id'] == 1) {
|
if ($policy['policy_type_id'] == 1) {
|
||||||
if (strtolower($dataToInsert[$a]['relationship']) == 'self') {
|
if (strtolower($dataToInsert[$a]['relationship']) == 'self') {
|
||||||
$data_after_gpa_or_gmc = $dataToInsert[$a];
|
$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) {
|
if ($employee) {
|
||||||
|
|
||||||
|
|
||||||
$emp_id =$employee['id'];
|
$emp_id =$employee['id'];
|
||||||
$id =$emp_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) {
|
if ($result) {
|
||||||
$log_message = 'Update Employee - '.$employee['name'].'('.$employee['emp_code'].') with PK '.$employee['id'];
|
$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']));
|
$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]);
|
$employee_policy = $this->employeePolicyModel->checkExistingEmpPolicy(['employee_id' => $emp_id,'client_policy_id' => $policy_id]);
|
||||||
if ($employee_policy) {
|
if ($employee_policy) {
|
||||||
foreach ($employee_policy as $existing_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 {
|
} else {
|
||||||
$emp_policy = $this->employeePolicyModel->insert($emp_policy_data);
|
$emp_policy = $this->employeePolicyModel->insert($emp_policy_data);
|
||||||
|
|||||||
@ -29,6 +29,7 @@ class EmployeeModel extends Model
|
|||||||
"emp_status",
|
"emp_status",
|
||||||
"created_by",
|
"created_by",
|
||||||
"updated_by",
|
"updated_by",
|
||||||
|
"updated_at",
|
||||||
"is_active",
|
"is_active",
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -51,9 +52,12 @@ class EmployeeModel extends Model
|
|||||||
|
|
||||||
|
|
||||||
// for EMP rest API process do not change
|
// for EMP rest API process do not change
|
||||||
public function checkExistingEmpEntrollment($arr)
|
public function checkExistingEmployee($arr)
|
||||||
{
|
{
|
||||||
return $this->where('emp_code',$arr['emp_code'])->where('name',$arr['name'])->first();
|
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",
|
"gst",
|
||||||
"created_by",
|
"created_by",
|
||||||
"updated_by",
|
"updated_by",
|
||||||
|
"updated_at",
|
||||||
"is_active",
|
"is_active",
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@ -753,6 +753,10 @@
|
|||||||
}
|
}
|
||||||
convertCommaNumberToWords(input);
|
convertCommaNumberToWords(input);
|
||||||
|
|
||||||
|
if (input.id == 'gpa_sum_si') {
|
||||||
|
gpaSumInsureMultiplier(input);
|
||||||
|
}
|
||||||
|
|
||||||
// if(input.id == 'basic_pay'){
|
// if(input.id == 'basic_pay'){
|
||||||
// var inputNumber = input.value;
|
// var inputNumber = input.value;
|
||||||
// if (inputNumber) {
|
// if (inputNumber) {
|
||||||
|
|||||||
@ -1424,7 +1424,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function gpaSumInsureMultiplier() {
|
function gpaSumInsureMultiplier(element) {
|
||||||
|
console.log(element);
|
||||||
var element = $('#gpa_sum_multiplier')[0];
|
var element = $('#gpa_sum_multiplier')[0];
|
||||||
var sumInsured = $('input[name="gpa_sum_si[]"]');
|
var sumInsured = $('input[name="gpa_sum_si[]"]');
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user