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/EmpDataServiceController.php b/app/Controllers/EmpDataServiceController.php index 1aec089e..c144fb0f 100755 --- a/app/Controllers/EmpDataServiceController.php +++ b/app/Controllers/EmpDataServiceController.php @@ -2078,18 +2078,18 @@ class EmpDataServiceController extends BaseController 'user_id' => $user_id, ]]); - $r = Jobs::addJob(['job_name' => 'makeEntryForBDSPolicyTransaction', 'payload' => [ - 'client_policy_id' => $client_policy_id ?? null, - 'endorsement_no' => $endorsement_id ?? null, - 'emp_count' => $emp_count ?? null, - 'action_type' => $file['event_type'] ?? null, - 'no_of_insured' => count($no_of_insured ?? []) ?? null, - 'no_of_dependent' => count($no_of_dependent ?? []) ?? null, - 'base_premium' => $base_bremium_and_gst['base_premium'] ?? null, - 'gst' => $base_bremium_and_gst['gst'] ?? null, - 'policy_issue_date' => $policy_issue_date ?? null, - 'created_by' => $file['created_by'] ?? null, - ]]); + // $r = Jobs::addJob(['job_name' => 'makeEntryForBDSPolicyTransaction', 'payload' => [ + // 'client_policy_id' => $client_policy_id ?? null, + // 'endorsement_no' => $endorsement_id ?? null, + // 'emp_count' => $emp_count ?? null, + // 'action_type' => $file['event_type'] ?? null, + // 'no_of_insured' => count($no_of_insured ?? []) ?? null, + // 'no_of_dependent' => count($no_of_dependent ?? []) ?? null, + // 'base_premium' => $base_bremium_and_gst['base_premium'] ?? null, + // 'gst' => $base_bremium_and_gst['gst'] ?? null, + // 'policy_issue_date' => $policy_issue_date ?? null, + // 'created_by' => $file['created_by'] ?? null, + // ]]); // $this->cashDepositCalculationForInception($depositeData); // $this->sendMailForDownloadingECard($emp_policy_ids); @@ -2518,14 +2518,14 @@ class EmpDataServiceController extends BaseController $file_data = $this->getDataByFileId($file_id, 'success'); $this->setPullNotification($file_data); - $r = Jobs::addJob(['job_name' => 'makeEntryForBDSPolicyTransaction', 'payload' => [ - 'client_policy_id' => $client_policy_id ?? null, - 'endorsement_no' => $endorsement_id[0] ?? null, - 'emp_count' => $emp_count ?? null, - 'action_type' => $file['event_type'] ?? null, - 'policy_issue_date' => $policy_issue_date ?? null, - 'created_by' => $file['created_by'] ?? null, - ]]); + // $r = Jobs::addJob(['job_name' => 'makeEntryForBDSPolicyTransaction', 'payload' => [ + // 'client_policy_id' => $client_policy_id ?? null, + // 'endorsement_no' => $endorsement_id[0] ?? null, + // 'emp_count' => $emp_count ?? null, + // 'action_type' => $file['event_type'] ?? null, + // 'policy_issue_date' => $policy_issue_date ?? null, + // 'created_by' => $file['created_by'] ?? null, + // ]]); //import file to upload Google Drive @@ -3177,18 +3177,18 @@ class EmpDataServiceController extends BaseController 'user_id' => $user_id, ]]); - $r = Jobs::addJob(['job_name' => 'makeEntryForBDSPolicyTransaction', 'payload' => [ - 'client_policy_id' => $client_policy_id ?? null, - 'endorsement_no' => $endorsement_id ?? null, - 'emp_count' => $emp_count ?? null, - 'action_type' => $file['event_type'] ?? null, - 'no_of_insured' => count($no_of_insured ?? []) ?? null, - 'no_of_dependent' => count($no_of_dependent ?? []) ?? null, - 'base_premium' => $base_bremium_and_gst['base_premium'] ?? null, - 'gst' => $base_bremium_and_gst['gst'] ?? null, - 'policy_issue_date' => $policy_issue_date ?? null, - 'created_by' => $file['created_by'] ?? null, - ]]); + // $r = Jobs::addJob(['job_name' => 'makeEntryForBDSPolicyTransaction', 'payload' => [ + // 'client_policy_id' => $client_policy_id ?? null, + // 'endorsement_no' => $endorsement_id ?? null, + // 'emp_count' => $emp_count ?? null, + // 'action_type' => $file['event_type'] ?? null, + // 'no_of_insured' => count($no_of_insured ?? []) ?? null, + // 'no_of_dependent' => count($no_of_dependent ?? []) ?? null, + // 'base_premium' => $base_bremium_and_gst['base_premium'] ?? null, + // 'gst' => $base_bremium_and_gst['gst'] ?? null, + // 'policy_issue_date' => $policy_issue_date ?? null, + // 'created_by' => $file['created_by'] ?? null, + // ]]); } @@ -3688,18 +3688,18 @@ class EmpDataServiceController extends BaseController 'user_id' => $user_id, ]]); - $r = Jobs::addJob(['job_name' => 'makeEntryForBDSPolicyTransaction', 'payload' => [ - 'client_policy_id' => $client_policy_id ?? null, - 'endorsement_no' => $endorsement_id ?? null, - 'emp_count' => $emp_count ?? null, - 'action_type' => $file['event_type'] ?? null, - 'no_of_insured' => count($no_of_insured ?? []) ?? null, - 'no_of_dependent' => count($no_of_dependent ?? []) ?? null, - 'base_premium' => $base_bremium_and_gst['base_premium'] ?? null, - 'gst' => $base_bremium_and_gst['gst'] ?? null, - 'policy_issue_date' => $policy_issue_date ?? null, - 'created_by' => $file['created_by'] ?? null, - ]]); + // $r = Jobs::addJob(['job_name' => 'makeEntryForBDSPolicyTransaction', 'payload' => [ + // 'client_policy_id' => $client_policy_id ?? null, + // 'endorsement_no' => $endorsement_id ?? null, + // 'emp_count' => $emp_count ?? null, + // 'action_type' => $file['event_type'] ?? null, + // 'no_of_insured' => count($no_of_insured ?? []) ?? null, + // 'no_of_dependent' => count($no_of_dependent ?? []) ?? null, + // 'base_premium' => $base_bremium_and_gst['base_premium'] ?? null, + // 'gst' => $base_bremium_and_gst['gst'] ?? null, + // 'policy_issue_date' => $policy_issue_date ?? null, + // 'created_by' => $file['created_by'] ?? null, + // ]]); } $file_data = $this->getDataByFileId($file_id, 'success'); diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php index b97bd1b0..3751da86 100755 --- a/app/Controllers/EmployeeController.php +++ b/app/Controllers/EmployeeController.php @@ -526,7 +526,7 @@ class EmployeeController extends AdminController $client_branch_id = $this->request->getPost('client_branch_id'); $insurer_or_tpa = $this->request->getPost('insurer_or_tpa'); $actions = $this->request->getPost('action_type'); - $policy_issue_date = $this->request->getPost('policy_issue_date'); + $policy_issue_date = $this->request->getPost('policy_issue_date') ?? null; $client_data = $this->clientPolicyModel->getCliendDataForExcelFileName($client_policy_id); $file_name = generate_filename($client_data['short_name'], $event_type, $actions, $insurer_or_tpa, $client_data['policy_type'], $client_data['branch_code']); @@ -544,9 +544,7 @@ class EmployeeController extends AdminController ]; - $batch_data['policy_issue_date'] = (!empty($policy_issue_date) && strtotime($policy_issue_date) !== false) - ? change_date_format($policy_issue_date) - : null; + $batch_data['policy_issue_date'] = (!empty($policy_issue_date) && strtotime($policy_issue_date) !== false) ? change_date_format($policy_issue_date) : null; if ($actions == 'export') { 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 bf34881a..348d309d 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 diff --git a/app/Views/insurer_or_tpa_data.php b/app/Views/insurer_or_tpa_data.php index dc07ab1c..fc822a52 100755 --- a/app/Views/insurer_or_tpa_data.php +++ b/app/Views/insurer_or_tpa_data.php @@ -90,13 +90,14 @@ -