diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 2e9e11c9..8ecf4184 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -5266,7 +5266,7 @@ class ClientController extends AdminController // $res = $empServiceController->employeesEnrollmentInsert(['file_id' => 836]); // $res = $empServiceController->employeesSIEnhanceProcess(['file_id' => '978']); // $res = $empServiceController->employeeDisembark(['file_id' => '1681']); - // $res = $empServiceController->employeesCorrectionProcess(['file_id' => '1681']); + // $res = $empServiceController->employeesCorrectionProcess(['file_id' => '2033']); // dd( $res); $EmployeeMultiEventServiceController = new EmployeeMultiEventServiceController(); @@ -5324,6 +5324,7 @@ class ClientController extends AdminController $EmpDataServiceController = new EmpDataServiceController(); // $res = $EmpDataServiceController->generateExcelForDeletion($batch_data); dd($return); die; // $res = $EmpDataServiceController->generateExcelForSIEnhancement($batch_data); die; + // $res = $EmpDataServiceController->generateExcelForCorrection($batch_data); // $res = $EmpDataServiceController->importInceptionFileValidation(['file_id' => 1932]); die; // $res = $EmpDataServiceController->importDeletionValidation(['file_id' => 304]); //for live // $res = $EmpDataServiceController->importSIEnhancementUpdateEndorsementID(['file_id' => 1199]); //for live diff --git a/app/Controllers/EmployeeMultiEventServiceController.php b/app/Controllers/EmployeeMultiEventServiceController.php index a7519fea..e3027d01 100644 --- a/app/Controllers/EmployeeMultiEventServiceController.php +++ b/app/Controllers/EmployeeMultiEventServiceController.php @@ -1956,14 +1956,29 @@ class EmployeeMultiEventServiceController extends BaseController $field_value = ($field_name == 'dob' ? change_date_format($row[4], 'd-M-Y', 'Y-m-d') : $row[4]); + // $employee = $this->employeeModel + // ->where('emp_code', $row[1]) + // ->where('name', $row[2]) + // ->where('client_id', $file['client_id']) + // ->where('client_branch_id', $file['client_branch_id']) + // ->where('emp_status', 'active') + // ->where('is_active', 1) + // ->first(); + $employee = $this->employeeModel - ->where('emp_code', $row[1]) - ->where('name', $row[2]) - ->where('client_id', $file['client_id']) - ->where('client_branch_id', $file['client_branch_id']) - ->where('emp_status', 'active') - ->where('is_active', 1) - ->first(); + ->select('employees.*') + ->join('employee_polices', 'employees.id = employee_polices.employee_id') + ->where('employees.emp_code', $row[1]) + ->where('employees.name',$row[2]) + ->where('employees.client_id',$file['client_id']) + ->where('employees.client_branch_id',$file['client_branch_id']) + ->where('employee_polices.client_policy_id',$file['policy_id']) + ->where('employees.emp_status','active') + ->where('employees.is_active',1) + ->where('employee_polices.status','active') + ->where('employee_polices.is_active',1) + ->first(); + $existing_endorsements = $this->empEndorsementModel->where('actions', 'c') ->where('table_name', 'employees') ->where('endorsement_id is null') diff --git a/app/Controllers/EmployeeServiceController.php b/app/Controllers/EmployeeServiceController.php index a80ec116..07bf7ad5 100755 --- a/app/Controllers/EmployeeServiceController.php +++ b/app/Controllers/EmployeeServiceController.php @@ -1470,10 +1470,11 @@ class EmployeeServiceController extends AdminController //get file name $file_id = $params['file_id']; $file = $this->fileModel->find($file_id); + // dd($file); $file_name_with_path = WRITEPATH."/uploads/excel/".$file['file_name']; - $spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file_name_with_path); + $spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file_name_with_path); $sheet = $spreadsheet->getActiveSheet(); $highestRowAndColumn = $sheet->getHighestRowAndColumn(); @@ -1498,13 +1499,21 @@ class EmployeeServiceController extends AdminController $employee = $this->employeeModel - ->where('emp_code', $row[1]) - ->where('name',$row[2]) - ->where('client_id',$file['client_id']) - ->where('client_branch_id',$file['client_branch_id']) - ->where('emp_status','active') - ->where('is_active',1) + ->select('employees.*') + ->join('employee_polices', 'employees.id = employee_polices.employee_id') + ->where('employees.emp_code', $row[1]) + ->where('employees.name',$row[2]) + ->where('employees.client_id',$file['client_id']) + ->where('employees.client_branch_id',$file['client_branch_id']) + ->where('employee_polices.client_policy_id',$file['policy_id']) + ->where('employees.emp_status','active') + ->where('employees.is_active',1) + ->where('employee_polices.status','active') + ->where('employee_polices.is_active',1) ->first(); + + // Kint::dump($employee); + $existing_endorsements = $this->empEndorsementModel->where('actions','c') ->where('table_name','employees') ->where('endorsement_id is null') @@ -1530,7 +1539,7 @@ class EmployeeServiceController extends AdminController $this->myLogger->logme("error",'{file_id} uploaded success',['file_id' => $file_id]); //set success msg to pull notifications $this->setPullNotification($this->getFileMetaDataByFileId($file_id,'success')); - return true; + return true; } diff --git a/app/Models/EmployeePolicyModel.php b/app/Models/EmployeePolicyModel.php index 82a8cb3b..2ef130de 100755 --- a/app/Models/EmployeePolicyModel.php +++ b/app/Models/EmployeePolicyModel.php @@ -563,36 +563,19 @@ class EmployeePolicyModel extends Model employees.email_personal AS emp_email_p, employees.band AS emp_grade, employees.designation AS emp_designation, - employees.basic_pay AS emp_basic_pay, - - batch_data.emp_policy_id, - batch_data.bl AS batch_list_batch_code, - batch_data.bf AS batch_files_batch_code - + employees.basic_pay AS emp_basic_pay FROM emp_endorsement LEFT JOIN employees ON employees.id = emp_endorsement.pk LEFT JOIN employee_polices ON employees.id = employee_polices.employee_id - LEFT JOIN ( - SELECT batch_list.emp_policy_id, - batch_list.batch_code AS bl, - batch_files.batch_code AS bf - FROM - batch_files - LEFT JOIN - batch_list ON batch_files.batch_code = batch_list.batch_code - WHERE batch_files.event_type = 'correction' - AND batch_files.actions = 'export' - AND batch_files.insurer_or_tpa = '{$insurer_or_tpa}' - ) AS batch_data ON emp_endorsement.pk = batch_data.emp_policy_id - WHERE employees.client_id = '{$client_id}' AND employee_polices.client_policy_id = '{$client_policy_id}' AND employees.client_branch_id = '{$client_branch_id}' AND emp_endorsement.actions = 'c' AND emp_endorsement.status != 'truncated' + AND emp_endorsement.is_active = 1 AND employee_polices.is_active = 1 AND employee_polices.status = 'active' AND employees.is_active = 1