diff --git a/app/Config/Acl.php b/app/Config/Acl.php
index 6b6a8e33..f273ba13 100644
--- a/app/Config/Acl.php
+++ b/app/Config/Acl.php
@@ -45,6 +45,7 @@ class Acl
'#^/swagger#' => ['roles' => [ADMIN_ROLE_ID, HEAD_ROLE_ID, ACCOUNT_MANAGER_ROLE_ID, MANAGER_ROLE_ID]],
'#^/viewClaimFile#' => ['roles' => [ADMIN_ROLE_ID, HEAD_ROLE_ID, ACCOUNT_MANAGER_ROLE_ID, MANAGER_ROLE_ID, STAFF_ROLE_ID]],
'#^/employee/tpaReportsDashboard#' => ['roles' => [ACCOUNT_MANAGER_ROLE_ID, ADMIN_ROLE_ID, HEAD_ROLE_ID]],
+ '#^/policy_tranction/sendInstallmentRemainderMail#' => ['roles' => [ADMIN_ROLE_ID, HEAD_ROLE_ID]],
diff --git a/app/Config/Routes.php b/app/Config/Routes.php
index a41e48b6..74a6bf4e 100755
--- a/app/Config/Routes.php
+++ b/app/Config/Routes.php
@@ -483,7 +483,7 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
});
});
-$routes->post("policy_tranction/sendInstallmentRemainderMail","PolicyTransactionController::sendInstallmentRemainderMail");
+$routes->get("policy_tranction/sendInstallmentRemainderMail","PolicyTransactionController::sendInstallmentRemainderMail");
$routes->cli("cli/sendInstallmentRemainderMail","PolicyTransactionController::sendInstallmentRemainderMail");
$routes->cli("cli/cronDailyBDSReport", "PolicyTransactionController::cronDailyBDSReport");
$routes->cli('cli/croneDailyActivityReport', 'DashboardController::croneDailyActivityReport');
diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php
index de22eacf..0af6898a 100755
--- a/app/Controllers/ClientController.php
+++ b/app/Controllers/ClientController.php
@@ -7798,7 +7798,6 @@ class ClientController extends AdminController
public function getTheEmpDataForClaim($param, $type = null)
{
- // Construct the base query
$data = $this->clientPolicyModel
->select("
clients.id AS client_id,
@@ -7816,20 +7815,20 @@ class ClientController extends AdminController
employee_polices.uhid AS policy_no,
employee_polices.client_policy_id
")
- ->join('clients', 'client_policy.client_id = clients.id', 'left')
- ->join('insurers', 'client_policy.insurer_id = insurers.id', 'left')
+ ->join('clients', 'client_policy.client_id = clients.id')
+ ->join('insurers', 'client_policy.insurer_id = insurers.id')
->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 AND client_policy.id = employee_polices.client_policy_id')
->where('client_policy.is_active', 1)
+ ->where('client_policy.id', $param)
->where('employees.is_active', 1)
- ->where('employees.relationship', "Self")
- ->where('employee_polices.is_active', 1)
+ ->where('employees.relationship', 'Self')
->whereIn('employees.emp_status', ['active', 'expired'])
+ ->where('employee_polices.is_active', 1)
->whereIn('employee_polices.status', ['active', 'expired'])
- ->where('employees.is_active', 1)
- ->where('employee_polices.client_policy_id', $param)
- ->groupBy('employees.emp_code')
+ ->groupBy('employees.id')
+ ->orderBy('employees.name', 'ASC')
->get()
->getResultArray();
@@ -7837,13 +7836,13 @@ class ClientController extends AdminController
$dataForClientAndInsurer = $this->clientPolicyModel
->select("
- clients.id AS client_id,
- clients.client_name,
- insurers.id AS insurer_id,
- insurers.name AS insurer_name,
- tpa.id AS tpa_id,
- tpa.name AS tpa_name,
- ")
+ clients.id AS client_id,
+ clients.client_name,
+ insurers.id AS insurer_id,
+ insurers.name AS insurer_name,
+ tpa.id AS tpa_id,
+ tpa.name AS tpa_name
+ ")
->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')
diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php
index a7592ca0..e76d4206 100644
--- a/app/Controllers/PolicyTransactionController.php
+++ b/app/Controllers/PolicyTransactionController.php
@@ -5373,8 +5373,8 @@ class PolicyTransactionController extends BaseController
// print_r($bdsInstallmentData);die();
if (empty($bdsInstallmentData)) {
- $this->myLogger->logme("error", "No Client Installment is Due in the 15th Day");
- CLI::write("No Client Installment is Due in the 15th Day");
+ $this->myLogger->logme("error", "No Client Installment is Due in the 5th Day");
+ CLI::write("No Client Installment is Due in the 5th Day");
return ['status' => false, 'message' => 'No data found', 'response' => []];
}
diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php
index a3e0e01c..8da4c33d 100644
--- a/app/Controllers/TicketController.php
+++ b/app/Controllers/TicketController.php
@@ -3321,78 +3321,71 @@ class TicketController extends BaseController
}
}
- public function getPoliciesbyEmpID()
+ public function getPoliciesbyEmpID()
{
- $received_data = $this->request->getPost();
- $ticket_type_id = $this->request->getPost('ticket_type_id') ?? null;
- $client_id = $this->request->getPost('client_id') ?? null;
- $emp_id = $received_data['emp_id'];
+ $emp_id = (int) ($this->request->getPost('emp_id') ?? 0);
+ $ticket_type_id = (int) ($this->request->getPost('ticket_type_id') ?? 0);
+ $client_id = (int) ($this->request->getPost('client_id') ?? 0);
- // Get all client policy IDs for the given employee
- if ($ticket_type_id == 1) {
-
- //get the self data for get the all policy list aginst the emp_code
- $self_data = $this->employeeModel->where('is_active', 1)->where('id', $emp_id)->first();
-
- $db = db_connect();
- $builder = $db->table('employees e');
- $builder->select('ep.*');
- $builder->join('employee_polices ep', 'e.id = ep.employee_id');
- $builder->join('client_policy cp', 'cp.id = ep.client_policy_id AND cp.policy_type_id IN (2,3,4,5)');
- $builder->where('e.is_active', 1);
- $builder->where('ep.is_active', 1);
- $builder->where('e.emp_code', $self_data['emp_code']);
- if(!empty($client_id)){
- $builder->where('e.client_id', $client_id);
- }
- $builder->groupBy('client_policy_id');
-
- $query = $builder->get();
- $policies = $query->getResultArray();
- } else {
-
- $policies = $this->employeePolicyModel
- ->select('client_policy_id')
- ->where('employee_id', $emp_id)
- ->where('is_active', 1)
- ->where('status', 'active')
- ->findAll();
+ if ($emp_id <= 0) {
+ return $this->respond(['status' => false, 'message' => 'Invalid Employee']);
}
- // Return empty if no policies found
- if (empty($policies)) {
- return [];
+ $policyTypeMap = [
+ 1 => [2, 3, 4, 5], // GMC
+ 2 => [1], // GPA
+ 3 => [6], // EDLI
+ 4 => [7], // GTLI
+ 72 => [72], // OPD
+ ];
+
+ $db = db_connect();
+ $builder = $db->table('employee_polices ep');
+ $builder->select('ep.client_policy_id');
+ $builder->join('employees e', 'e.id = ep.employee_id');
+ $builder->join('client_policy cp', 'cp.id = ep.client_policy_id');
+ $builder->where('ep.employee_id', $emp_id);
+ $builder->where('ep.is_active', 1);
+ $builder->whereIn('ep.status', ['active', 'expired']);
+ $builder->where('e.is_active', 1);
+
+ if ($client_id > 0) {
+ $builder->where('e.client_id', $client_id);
}
-
- // Extract client policy IDs into an array
- $policy_ids = array_column($policies, 'client_policy_id');
-
- // Fetch all policy names and IDs in one query
+
+ if (isset($policyTypeMap[$ticket_type_id])) {
+ $builder->whereIn('cp.policy_type_id', $policyTypeMap[$ticket_type_id]);
+ }
+
+ $policyRows = $builder->groupBy('ep.client_policy_id')->get()->getResultArray();
+ $policy_ids = array_values(array_unique(array_column($policyRows, 'client_policy_id')));
+
+ if (empty($policy_ids)) {
+ return $this->respond(['status' => false, 'message' => 'Policy Not Found']);
+ }
+
$policyNameandID = $this->clientPolicyModel
->select('
- CONCAT(policy_type.policy_type, "-", client_policy.policy_no) as client_policy_name,
- client_policy.id as client_policy_value,
- client_policy.policy_type_id,
- client_policy.policy_no,
- insurers.id as insurer_id,
- insurers.name as insurer_name,
- tpa.name as tpa_name,
- tpa.id as tpa_id,
- ')
+ CONCAT(policy_type.policy_type, "-", client_policy.policy_no) as client_policy_name,
+ client_policy.id as client_policy_value,
+ client_policy.policy_type_id,
+ client_policy.policy_no,
+ insurers.id as insurer_id,
+ insurers.name as insurer_name,
+ tpa.name as tpa_name,
+ tpa.id as tpa_id
+ ')
->join('policy_type', 'policy_type.id = client_policy.policy_type_id AND policy_type.is_active = 1')
->join('insurers', 'insurers.id = client_policy.insurer_id AND insurers.is_active = 1', 'left')
->join('tpa', 'tpa.id = client_policy.tpa_id AND tpa.is_active = 1', 'left')
- // ->where('client_policy.policy_status', 1)
->whereIn('client_policy.id', $policy_ids)
- ->findAll();
-
- // dd($policyNameandID);
- if ($policyNameandID){
+ ->findAll();
- return $this->respond(['status'=>true,'policy_data'=> $policyNameandID]);
- }else{
- return $this->respond(['status'=>false,'message'=> "Policy Not Found"]);
+ if (!empty($policyNameandID)) {
+ return $this->respond(['status' => true, 'policy_data' => $policyNameandID]);
}
+
+ return $this->respond(['status' => false, 'message' => 'Policy Not Found']);
}
public function getCheckListAndConvertArrayToString($ticket_data)
diff --git a/app/Views/ticket_form_gpa.php b/app/Views/ticket_form_gpa.php
index 48665d88..c3d8e80a 100644
--- a/app/Views/ticket_form_gpa.php
+++ b/app/Views/ticket_form_gpa.php
@@ -819,14 +819,31 @@
});
}
- function appendPolicyDropdown(data) {
+ function isGpaFormPolicyType(ticket_type, item) {
+ if (ticket_type == 2) {
+ return item.policy_type_id == 1;
+ }
+ if (ticket_type == 3) {
+ return item.policy_type_id == 6;
+ }
+ if (ticket_type == 4) {
+ return item.policy_type_id == 7;
+ }
+ return ticket_type != 1 && item.policy_type_id != 2;
+ }
- // var ticket_type = $('#ticket_type').val();
+ function appendPolicyDropdown(data) {
hiddenData = $("#empIDHidden").val();
hiddenData = JSON.parse(hiddenData);
console.log("second function is called : ", data);
let ticket_type = $('#ticket_type_id').val();
+
+ if ($('#emp_client_policy').hasClass('select2-hidden-accessible')) {
+ $('#emp_client_policy').select2('destroy');
+ }
+ $('#emp_client_policy').removeClass('readonly-select');
+
$('#emp_client_policy').empty();
$('#emp_client_policy').append($('