From c90e2205e6a0e710673a68477145f7fefd939a91 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Mon, 24 Feb 2025 14:10:18 +0530 Subject: [PATCH] CHANGE_CLAIMS_STATUS : RV --- app/Controllers/ClientController.php | 33 ++++++++++++++++++---------- app/Controllers/TicketController.php | 6 +++++ app/Models/EmployeeModel.php | 19 +++++++++++----- app/Views/ticket_form_gmc.php | 2 +- app/Views/ticket_form_gpa.php | 2 +- app/Views/ticket_form_handler.php | 4 +++- 6 files changed, 47 insertions(+), 19 deletions(-) diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 2a1cdcfd..60ce746c 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -4841,12 +4841,12 @@ class ClientController extends AdminController } } - public function getTheEmpDataForClaimSearchByMobile($param, $type = 'mobile') + public function getTheEmpDataForClaimSearchByMobile($param, $type = 'mobile', $client_policy_id = null) { $field_name = 'employees.' . $type; // Construct the base query - $data = $this->clientPolicyModel + $query = $this->clientPolicyModel ->select(" clients.id AS client_id, clients.client_name, @@ -4861,24 +4861,33 @@ class ClientController extends AdminController employees.email_corporate AS emp_email, employees.relationship AS emp_relationship, employee_polices.uhid AS policy_no, - employee_polices.tpa_id AS tpa_no + employee_polices.tpa_id AS tpa_no, + employee_polices.client_policy_id AS policy_id ") ->join('clients', 'client_policy.client_id = clients.id', 'left') ->join('insurers', 'client_policy.insurer_id = insurers.id', 'left') ->join('tpa', 'client_policy.tpa_id = tpa.id', 'left') - ->join('employees', 'clients.id = employees.client_id', 'left') - ->join('employee_polices', 'employees.id = employee_polices.employee_id', 'left') + ->join('employees', 'clients.id = employees.client_id') + ->join('employee_polices', 'employees.id = employee_polices.employee_id') ->where('client_policy.is_active', 1) ->where('insurers.is_active', 1) ->where('tpa.is_active', 1) ->where('employees.is_active', 1) ->where('employees.relationship', "Self") ->where('employee_polices.is_active', 1) - ->where($field_name, $param) - ->groupBy('employees.id') - ->orderBy('employees.id', 'DESC') - ->first(); - + ->where($field_name, $param); + + if (!empty($client_policy_id)) { + $query->where('employee_polices.client_policy_id', $client_policy_id); + } + + $query->groupBy('employees.id') + ->orderBy('employees.id', 'DESC'); + + $data = $query->get()->getRowArray(); + + // print_r(db_connect()->getLastQuery()); die; + $memberData = []; $dataForClientAndInsurer = []; @@ -4891,7 +4900,7 @@ class ClientController extends AdminController if(!empty($data) && count($data) > 0){ - $memberData = $this->employeeModel->getEmployeeByEmployeeCode($data['emp_code']); + $memberData = $this->employeeModel->getEmployeeByEmployeeCode($data['emp_code'], $data['policy_id']); $acms = $this->clientRMModel ->select('user_profiles.id, user_profiles.first_name') @@ -4914,6 +4923,7 @@ class ClientController extends AdminController 'message' => 'Data found', 'data' => $data, 'param' => $param, + 'client_policy_id' => $client_policy_id, 'type' => $type, 'dataForClientAndInsurer' => $dataForClientAndInsurer, 'memberData' => $memberData, @@ -4925,6 +4935,7 @@ class ClientController extends AdminController 'code' => 404, 'message' => 'No data found', 'param' => $param, + 'client_policy_id' => $client_policy_id, 'type' => $type, 'dataForClientAndInsurer' => $dataForClientAndInsurer, 'memberData' => $memberData, diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index f4cc3bd6..60394874 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -1381,6 +1381,12 @@ class TicketController extends BaseController $lastMatchedStatus = $status; } } + + if($lastMatchedStatus == 1){ + if(!empty($incoming_form_values['tpa_no'])){ + $lastMatchedStatus = 2; + } + } return $lastMatchedStatus; } diff --git a/app/Models/EmployeeModel.php b/app/Models/EmployeeModel.php index d8fd4894..58cf6010 100755 --- a/app/Models/EmployeeModel.php +++ b/app/Models/EmployeeModel.php @@ -240,9 +240,9 @@ class EmployeeModel extends Model return $results; } - public function getEmployeeByEmployeeCode($emp_code) + public function getEmployeeByEmployeeCode($emp_code, $client_policy_id = null) { - return $this->select(" + $query = $this->select(" employees.id AS emp_id, employees.name AS emp_name, employees.emp_code, @@ -255,9 +255,18 @@ class EmployeeModel extends Model ->join('employee_polices', 'employees.id = employee_polices.employee_id', 'left') ->where('employees.is_active', 1) ->where('employee_polices.is_active', 1) - ->where('employees.emp_code', $emp_code) - ->groupBy('employees.id') - ->findAll(); + ->where('employees.emp_code', $emp_code); + + if(!empty($client_policy_id)){ + $query->where('employee_polices.client_policy_id', $client_policy_id); + } + + $query->groupBy('employees.id'); + $data = $query->findAll(); + + return $data; + + } } diff --git a/app/Views/ticket_form_gmc.php b/app/Views/ticket_form_gmc.php index f72160f1..31a7c964 100644 --- a/app/Views/ticket_form_gmc.php +++ b/app/Views/ticket_form_gmc.php @@ -448,7 +448,7 @@ function claimStatusFieldChanges(fields) { var $field = $("#" + fieldId); if ($field.length) { - $field.prop('required', true); + // $field.prop('required', true); var $parentDiv = $field.closest("div"); $parentDiv.show(); diff --git a/app/Views/ticket_form_gpa.php b/app/Views/ticket_form_gpa.php index fa4dbd10..42b916cb 100644 --- a/app/Views/ticket_form_gpa.php +++ b/app/Views/ticket_form_gpa.php @@ -342,7 +342,7 @@ function claimStatusFieldChanges(fields) { var $field = $("#" + fieldId); if ($field.length) { - $field.prop('required', true); + // $field.prop('required', true); var $parentDiv = $field.closest("div"); $parentDiv.show(); diff --git a/app/Views/ticket_form_handler.php b/app/Views/ticket_form_handler.php index 2eef1eb5..262ec7b3 100644 --- a/app/Views/ticket_form_handler.php +++ b/app/Views/ticket_form_handler.php @@ -512,17 +512,19 @@ function getTheEmpDataForClaimSearchByMobile(input, searchType = null) { console.log(input) let type = $('#employee_data_points').val() let param = $('#emp_mobile_number_for_claim').val() + let client_policy_id = $('#emp_client_policy_data_list').val() if (searchType == 'client') { type = 'emp_code'; param = $(input).val(); } - let url = '' + param + '/' + type; + let url = '' + param + '/' + type + '/' + client_policy_id; // Data to send in the AJAX request let requestData = { param: param, type: type, + client_policy_id: client_policy_id, }; // Show loader