diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 7126cd69..98b2a821 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -4055,10 +4055,25 @@ class ClientController extends AdminController { // ---------for client----------------------------------------------------------------------------- + $role_id = get_role_id(); + $user_id = get_session_userid(); + + + if ($role_id == 2 || $role_id == 3) { + $clients = $this->clientModel - ->select("*, DATE_FORMAT(dob, '%d-%m-%Y') as dob") - ->where('is_active', 1) - ->findAll(); + ->select("clients.*, DATE_FORMAT(clients.dob, '%d-%m-%Y') as dob") + ->join('client_rm', 'client_rm.client_id = clients.id') + ->where('client_rm.user_id', $user_id) + ->where('clients.is_active', 1) + ->findAll(); + } else { + + $clients = $this->clientModel + ->select("*, DATE_FORMAT(dob, '%d-%m-%Y') as dob") + ->where('is_active', 1) + ->findAll(); + } $clientIds = array_column($clients, 'id'); @@ -5064,6 +5079,10 @@ class ClientController extends AdminController // $res = $empServiceController->employeesCorrectionProcess(['file_id' => '1681']); // dd( $res); + // $EmployeeMultiEventServiceController = new EmployeeMultiEventServiceController(); + // $res = $EmployeeMultiEventServiceController->constructMultiEventData(['file_id' => '1056']); + // dd($res); + // ---------- POLICY TRANSACTION CONTROLLER -------------------------------------------------------------------------------- $policyTransactionController = new PolicyTransactionController(); @@ -5181,6 +5200,7 @@ class ClientController extends AdminController // $data['data'] = $BDSReportController->getBAPClientData(); // return $this->loadLayout('irda_bap_client_report_list', $data); + // $data['data'] = $BDSReportController->getClientData(1); // return $this->loadLayout('irda_client_report_list', $data); diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php index dd80cd05..40e8af2b 100755 --- a/app/Controllers/EmployeeController.php +++ b/app/Controllers/EmployeeController.php @@ -270,10 +270,11 @@ class EmployeeController extends AdminController $client_id = $this->request->getPost('client_id'); $policy_id = $this->request->getPost('policy_id'); $branch_id = $this->request->getPost('branch_id'); + $hr_file_id = $this->request->getPost('hr_file_id') ?? null; $action = $this->request->getPost('upload-action-type'); $status = 'inprogress'; - $file_id = $this->fileModel->insert(['file_name' => $filename, 'client_id' => $client_id, 'policy_id' => $policy_id, 'created_by' => $loggedInUserID, 'status' => $status, 'action' => $action, 'client_branch_id' => $branch_id,'uploaded_by' => 1]); //here field policy_id have client_policy_id and not policy id from policy master + $file_id = $this->fileModel->insert(['file_name' => $filename, 'client_id' => $client_id, 'policy_id' => $policy_id, 'created_by' => $loggedInUserID, 'status' => $status, 'action' => $action, 'client_branch_id' => $branch_id,'uploaded_by' => 1, 'hr_file_id' => $hr_file_id]); //here field policy_id have client_policy_id and not policy id from policy master $this->myLogger->logme("error", '{file_id} uploaded success', ['file_id' => $file_id]); //start validation process diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 91833826..f307a351 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -3960,11 +3960,46 @@ class EmployeeRestController extends AdminController $request = service('request'); // Start builder from model + // $builder = $this->hrFileUploadModel + // ->select('hr_file_upload.* , c.short_name , cb.branch_name , lc.name as first_name') + // ->join('clients c', 'c.id = hr_file_upload.client_id AND c.is_active = 1', 'left') + // ->join('client_branch cb', 'cb.id = hr_file_upload.client_branch_id AND cb.is_active = 1', 'left') + // ->join('level_contacts lc', 'lc.id = hr_file_upload.created_by AND lc.contact_type = "client" AND lc.is_active = 1', 'left'); + $builder = $this->hrFileUploadModel - ->select('hr_file_upload.* , c.short_name , cb.branch_name , lc.name as first_name') + ->select(' + hr_file_upload.id, + hr_file_upload.client_id, + hr_file_upload.client_branch_id, + hr_file_upload.policy_id, + hr_file_upload.policy_no, + hr_file_upload.file_name, + hr_file_upload.file_action, + hr_file_upload.created_at, + hr_file_upload.created_by, + hr_file_upload.updated_at, + hr_file_upload.updated_by, + c.short_name, + cb.branch_name, + lc.name as first_name, + CASE + WHEN f.status IS NULL + THEN hr_file_upload.status + ELSE CONCAT(UCASE(LEFT(f.status, 1)), LCASE(SUBSTRING(f.status, 2))) + END AS status + ', false) ->join('clients c', 'c.id = hr_file_upload.client_id AND c.is_active = 1', 'left') ->join('client_branch cb', 'cb.id = hr_file_upload.client_branch_id AND cb.is_active = 1', 'left') - ->join('level_contacts lc', 'lc.id = hr_file_upload.created_by AND lc.contact_type = "client" AND lc.is_active = 1', 'left'); + ->join('level_contacts lc', 'lc.id = hr_file_upload.created_by AND lc.contact_type = "client" AND lc.is_active = 1', 'left') + ->join( + '(SELECT f1.* + FROM files f1 + WHERE f1.is_active = 1 + ORDER BY f1.id DESC + LIMIT 1) f', + 'f.hr_file_id = hr_file_upload.id', + 'left' + ); // Allowed filter keys $filters = [ diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php index 9f7d7341..f7e75acf 100644 --- a/app/Controllers/PolicyTransactionController.php +++ b/app/Controllers/PolicyTransactionController.php @@ -997,10 +997,10 @@ class PolicyTransactionController extends BaseController $data['is_active'] = 0; $policy_transaction_data = $this->policyTransactionModel->where('id', $id)->first(); if($policy_transaction_data['policy_type_id'] > 7){ - $this->policyTransactionModel->where('id', $id)->set($data)->update(); $this->PTCOShareDetailsModel->where('pt_id', $id)->set($data)->update(); $this->clientPolicyModel->where('id', $policy_transaction_data['client_policy_id'])->set($data)->update(); + $this->policyTransactionModel->where('client_policy_id', $policy_transaction_data['client_policy_id'])->set($data)->update(); }else{ $this->policyTransactionModel->where('id', $id)->set($data)->update(); $this->PTCOShareDetailsModel->where('pt_id', $id)->set($data)->update(); diff --git a/app/Models/FileModel.php b/app/Models/FileModel.php index 5b27a7d4..ff4f584e 100755 --- a/app/Models/FileModel.php +++ b/app/Models/FileModel.php @@ -20,7 +20,8 @@ class FileModel extends Model "policy_id", "client_branch_id", "uploaded_by", - "updated_by" + "updated_by", + "hr_file_id", ]; diff --git a/app/Views/claim_dump_file_list.php b/app/Views/claim_dump_file_list.php index 3caeb6a5..52918801 100644 --- a/app/Views/claim_dump_file_list.php +++ b/app/Views/claim_dump_file_list.php @@ -1,10 +1,29 @@ -
+
@@ -39,7 +57,7 @@
- + -->
@@ -121,6 +139,34 @@
+ + + \ No newline at end of file diff --git a/app/Views/employee_upload.php b/app/Views/employee_upload.php index 7f1ae499..ab566571 100755 --- a/app/Views/employee_upload.php +++ b/app/Views/employee_upload.php @@ -129,7 +129,6 @@ option:disabled { - - -