From a80f3809e98547c6313f5b51393f54c020567a3c Mon Sep 17 00:00:00 2001 From: "sanjeev.p" Date: Tue, 24 Mar 2026 11:57:46 +0530 Subject: [PATCH 1/4] FIX_Daily Report Section Interchanged. --- app/Views/daily_report_email_template.php | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/app/Views/daily_report_email_template.php b/app/Views/daily_report_email_template.php index 0ba7c8ff..0b43ca82 100644 --- a/app/Views/daily_report_email_template.php +++ b/app/Views/daily_report_email_template.php @@ -253,16 +253,6 @@ - -

Claims

-
-
-
Total Claims Registered for the day
-
-
-
-
-

BDS by Policy Type

@@ -294,10 +284,19 @@
+ +

Claims

+
+
+
Total Claims Registered for the day
+
+
+
+

Claim Status Breakdown

- The total claims received so far are listed ticket type-wise. + The total claims received so far are listed policy type-wise.
Date: Tue, 24 Mar 2026 15:39:48 +0530 Subject: [PATCH 2/4] FEAT_NON_EB_CONTD_POLICY_BIND_HR_API --- app/Config/Constants.php | 1 + app/Config/Routes.php | 3 + app/Controllers/ClientController.php | 85 +++++++++ app/Controllers/EmployeeRestController.php | 29 ++- app/Models/ClientPolicyModel.php | 3 + app/Views/client_onboarding.php | 34 ++++ app/Views/client_policy.php | 200 +++++++++++++++++++-- 7 files changed, 342 insertions(+), 13 deletions(-) diff --git a/app/Config/Constants.php b/app/Config/Constants.php index d47699d8..9078b11c 100755 --- a/app/Config/Constants.php +++ b/app/Config/Constants.php @@ -131,3 +131,4 @@ define('UPLOAD_EXT_POLICY_DOCS', ['pdf', 'jpg', 'jpeg', 'png', 'xls', 'xlsx']); define('UPLOAD_EXT_LEAD_FILES', ['xls', 'xlsx', 'pdf', 'jpg', 'jpeg', 'png']); define('UPLOAD_EXT_EXCEL', ['xls', 'xlsx', 'ods', 'csv']); define('UPLOAD_EXT_MAIL_ATTACHMENTS', ['pdf', 'jpg', 'jpeg', 'png', 'doc', 'docx', 'xls', 'xlsx']); +define('UPLOAD_EXT_NON_EB_RACK_RATE', ['pdf', 'xls', 'xlsx']); diff --git a/app/Config/Routes.php b/app/Config/Routes.php index d45acf8a..201e7209 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -171,6 +171,9 @@ $routes->group("/client", ["filter" => "authMVC"], function ($routes) { $routes->post("policyGMCTerms", "ClientController::policyGMCTerms"); $routes->get("getterms", "ClientController::getterms"); $routes->get("remove/(:any)", "ClientController::removePolicy/$1"); + $routes->get("getNonEbRackRateFiles", "ClientController::getNonEbRackRateFiles"); + $routes->post("uploadNonEbRackRateFile", "ClientController::uploadNonEbRackRateFile"); + $routes->post("removeNonEbRackRateFile", "ClientController::removeNonEbRackRateFile"); }); $routes->group("kyc", ["filter" => "authMVC"], function ($routes) { diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index df96dde0..5e191755 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -964,6 +964,8 @@ class ClientController extends AdminController 'tpa_branch_code' => $item->tpa_branch_code, 'branch_name' => $item->branch_name ?? ' - ', 'policy_type_id' => $item->policy_type_id, + 'allocg' => $item->allocg, + 'lead_misc' => $item->lead_misc, ]; }, $rawList)) : []; $editData['client_policy']['role'] = get_role_id(); @@ -3113,6 +3115,89 @@ class ClientController extends AdminController } } + public function getNonEbRackRateFiles() + { + $clientPolicyId = $this->request->getGet('client_policy_id'); + $policy = $this->clientPolicyModel->where('id', $clientPolicyId)->first(); + + if (!$policy) { + return $this->respond(['status' => false, 'message' => 'Policy not found'], 200); + } + + $files = []; + $jsonField = is_array($policy) ? ($policy['non_eb_rack_rate_files'] ?? null) : ($policy->non_eb_rack_rate_files ?? null); + + if (!empty($jsonField)) { + $files = json_decode($jsonField, true) ?? []; + } + + return $this->respond(['status' => true, 'files' => $files], 200); + } + + public function uploadNonEbRackRateFile() + { + $clientPolicyId = $this->request->getPost('client_policy_id'); + $policy = $this->clientPolicyModel->where('id', $clientPolicyId)->first(); + + if (!$policy) { + return $this->respond(['status' => false, 'message' => 'Policy not found'], 200); + } + + $uploadFilePath = WRITEPATH . 'uploads/non_eb_rack_rate'; + $fileName = file_Upload($this->request->getFile('file'), $uploadFilePath, UPLOAD_EXT_NON_EB_RACK_RATE); + + if (empty($fileName)) { + return $this->respond(['status' => false, 'message' => 'Invalid file. Only PDF and Excel files are allowed.'], 200); + } + + $originalName = $this->request->getFile('file')->getClientName(); + $ext = pathinfo($fileName, PATHINFO_EXTENSION); + + $jsonField = is_array($policy) ? ($policy['non_eb_rack_rate_files'] ?? null) : ($policy->non_eb_rack_rate_files ?? null); + $files = !empty($jsonField) ? (json_decode($jsonField, true) ?? []) : []; + + $fileEntry = [ + 'name' => $fileName, + 'original_name' => $originalName, + 'type' => $ext, + 'uploaded_at' => date('Y-m-d H:i:s'), + ]; + + $files[] = $fileEntry; + + $this->clientPolicyModel->where('id', $clientPolicyId)->set(['non_eb_rack_rate_files' => json_encode($files)])->update(); + + return $this->respond(['status' => true, 'file' => $fileEntry], 200); + } + + public function removeNonEbRackRateFile() + { + $clientPolicyId = $this->request->getPost('client_policy_id'); + $filename = $this->request->getPost('filename'); + $policy = $this->clientPolicyModel->where('id', $clientPolicyId)->first(); + + if (!$policy) { + return $this->respond(['status' => false, 'message' => 'Policy not found'], 200); + } + + $jsonField = is_array($policy) ? ($policy['non_eb_rack_rate_files'] ?? null) : ($policy->non_eb_rack_rate_files ?? null); + $files = !empty($jsonField) ? (json_decode($jsonField, true) ?? []) : []; + + $files = array_values(array_filter($files, function ($file) use ($filename) { + return $file['name'] !== $filename; + })); + + $this->clientPolicyModel->where('id', $clientPolicyId)->set(['non_eb_rack_rate_files' => json_encode($files)])->update(); + + // Delete physical file + $filePath = WRITEPATH . 'uploads/non_eb_rack_rate/' . $filename; + if (file_exists($filePath)) { + unlink($filePath); + } + + return $this->respond(['status' => true], 200); + } + public function deactivatePolicyTransactionsPolicy($clientPolicyId) { // Deactivate policy_transaction records diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 40bbb7f9..6c5afb5c 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -2272,8 +2272,10 @@ class EmployeeRestController extends AdminController where is_active = 1 and status = $emp_policy_status and client_policy_id = client_policy.id - ) as total_premium + ) as total_premium, + CASE WHEN policy_type.allocg IN ('Non-EB', 'Marine') THEN 'Non-EB' ELSE 'EB' END as allocg ", false) + ->join('policy_type', 'policy_type.id = client_policy.policy_type_id', 'left') ->where('md5(client_policy.client_id)', $this->request->getGet('client_id')) ->where('client_policy.client_branch_id', $this->request->getGet('client_branch_id')) ->where('client_policy.is_active', 1) @@ -4520,6 +4522,29 @@ class EmployeeRestController extends AdminController ]; // print_r($post_data); die; + + $ClientPolicyData = $this->clientPolicyModel + ->select(" + client_policy.id as client_policy_id , + client_policy.client_id as client_id, + client_policy.policy_type_id as policy_type_id, + client_policy.is_addon as is_addon , + client_policy.open_for_enrollment as OpenForEnrollment , + client_policy.inception_type as inception_type, + client_policy.policy_no as policy_no, + client_policy.insurer_id as insurer_id, + DATE_FORMAT(client_policy.policy_start_date, '%d-%m-%Y') AS policy_start_date, + DATE_FORMAT(client_policy.policy_end_date, '%d-%m-%Y') AS policy_expiry_date, + CASE WHEN policy_type.allocg IN ('Non-EB', 'Marine') THEN 'Non-EB' ELSE 'EB' END as allocg + ", false) + ->join('policy_type', 'policy_type.id = client_policy.policy_type_id', 'left') + ->where('md5(client_policy.client_id)', $post_data['client_id']) + ->where('client_policy.client_branch_id', $post_data['client_branch_id']) + ->where('client_policy.is_active', 1) + // ->where('client_policy.policy_status', $this->request->getGet('policy_status')) + ->whereIn('client_policy.id', $post_data['policy_id']) + ->first(); + if (empty($post_data['client_id'])) { return $this->respondCreated(['status' => false, 'message' => 'Client is required', 'data' => []]); } @@ -4538,7 +4563,7 @@ class EmployeeRestController extends AdminController // print_r($client_data); die; - if ($client_data['hr_file_processed_by'] == 1) { + if ($client_data['hr_file_processed_by'] == 1 && $ClientPolicyData['allocg'] == 'EB') { $responce = $this->fileUploadInFilesTable($post_data); } else { $responce = $this->fileUploadInHrFileUploadTable($post_data); diff --git a/app/Models/ClientPolicyModel.php b/app/Models/ClientPolicyModel.php index 762e8c40..c3acb681 100755 --- a/app/Models/ClientPolicyModel.php +++ b/app/Models/ClientPolicyModel.php @@ -59,6 +59,7 @@ class ClientPolicyModel extends Model "is_from_lead", "wellness_plan_id", "wellness_vendor_id", + "non_eb_rack_rate_files", ]; // Callbacks @@ -135,6 +136,8 @@ class ClientPolicyModel extends Model ->select('tpa_branch.branch_name as tpa_branch_name, tpa_branch.branch_code as tpa_branch_code') ->select('policy_type.policy_type as policy_type_name') ->select('client_branch.branch_name as branch_name') + ->select('policy_type.allocg as allocg') + ->select('leads.misc as lead_misc') ->join('insurers', 'insurers.id = client_policy.insurer_id') ->join('insurer_branch', 'client_policy.insurer_branch_id = insurer_branch.id') ->join('tpa', 'tpa.id = client_policy.tpa_id', 'left') diff --git a/app/Views/client_onboarding.php b/app/Views/client_onboarding.php index 3b00d236..96697d78 100755 --- a/app/Views/client_onboarding.php +++ b/app/Views/client_onboarding.php @@ -454,6 +454,40 @@ + + +