From 0316908e677fb1827e495a7242015c51a7cacc32 Mon Sep 17 00:00:00 2001 From: Srinivas-Saravanan Date: Thu, 5 Jun 2025 10:23:07 +0530 Subject: [PATCH 1/3] FIX_IRDA_NEGATIVE_VALUES --- app/Controllers/PolicyTransactionController.php | 3 ++- app/Views/policy_transaction_endorsement_form.php | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php index c6c9aaa8..4efcd7dd 100644 --- a/app/Controllers/PolicyTransactionController.php +++ b/app/Controllers/PolicyTransactionController.php @@ -462,7 +462,8 @@ class PolicyTransactionController extends BaseController } if($data['bro_payable_by'] == 1){ - $cop_amt = isset($data['co_premium'][$index]) && ($data['co_premium'][$index] != "0.00" || !empty($data['co_premium'][$index]) ) ? $data['co_premium'][$index] : ($data['base_premium'][$index] ?? 0); + $cop_amt = isset($data['co_premium'][$index]) && ($data['co_premium'][$index] != "0.00" && !empty($data['co_premium'][$index]) ) ? $data['co_premium'][$index] : ($data['base_premium'][$index] ?? 0); + // print_r($cop_amt);die(); }else{ $cop_amt = $data['co_premium'][$index] ?? 0; } diff --git a/app/Views/policy_transaction_endorsement_form.php b/app/Views/policy_transaction_endorsement_form.php index 91e024f1..515d6a36 100644 --- a/app/Views/policy_transaction_endorsement_form.php +++ b/app/Views/policy_transaction_endorsement_form.php @@ -121,8 +121,8 @@ - - + + From 853647df781a3079b49f0b58cf4dfc1263726637 Mon Sep 17 00:00:00 2001 From: Srinivas-Saravanan Date: Thu, 5 Jun 2025 12:25:49 +0530 Subject: [PATCH 2/3] FEAT_POLICY_LIST_FOR ENDORSEMENT --- .../PolicyTransactionController.php | 85 ++++++++++++++----- .../policy_transaction_endorsement_form.php | 3 + .../policy_transaction_endorsement_list.php | 17 ++-- 3 files changed, 80 insertions(+), 25 deletions(-) diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php index fdb8a0d5..6622d0fa 100644 --- a/app/Controllers/PolicyTransactionController.php +++ b/app/Controllers/PolicyTransactionController.php @@ -461,10 +461,10 @@ class PolicyTransactionController extends BaseController $insurer_id = null; } - if($data['bro_payable_by'] == 1){ - $cop_amt = isset($data['co_premium'][$index]) && ($data['co_premium'][$index] != "0.00" && !empty($data['co_premium'][$index]) ) ? $data['co_premium'][$index] : ($data['base_premium'][$index] ?? 0); - // print_r($cop_amt);die(); - }else{ + if ($data['bro_payable_by'] == 1) { + $cop_amt = isset($data['co_premium'][$index]) && ($data['co_premium'][$index] != "0.00" && !empty($data['co_premium'][$index])) ? $data['co_premium'][$index] : ($data['base_premium'][$index] ?? 0); + // print_r($cop_amt);die(); + } else { $cop_amt = $data['co_premium'][$index] ?? 0; } @@ -1099,13 +1099,19 @@ class PolicyTransactionController extends BaseController $data['endorsement_data_list'] = $this->policyTransactionModel->getEndorsementTranctionListData($start_date, $end_date, $client_id, $insurer_id, $policy_type_id, $date_type, $issuer, $status); $data['client'] = $this->clientModel->where('is_active', 1)->findAll(); - $data['policy_type'] = $this->policyTypeModel->where('is_active', 1)->findAll(); + $data['policy_types'] = $this->policyTypeModel->where('is_active', 1)->findAll(); $data['insurer'] = $this->insurerModel->where('is_active', 1)->findAll(); // $data['tpa'] = $this->tpaModel->where('is_active', 1)->findAll(); $data['insurer_branch'] = $this->insurerBranchModel->getInsurerBranchesWithInsurerNames(); $data['tpa'] = $this->tpaBranchModel->getTpaBranchesWithTpaNames(); + list($policyList, $policyListByClient) = $this->getPolicyForEndorsment(); + $data['endorsementPolicies'] = $policyList; + $data['endorsementPolicyListByClient'] = $policyListByClient; + + // dd($data); + // print_r($data['endorsementPolicies']);die(); $this->loadLayout('policy_transaction_endorsement_list', $data); } @@ -2822,11 +2828,9 @@ class PolicyTransactionController extends BaseController try { $bdsInstallmentData = $this->BdsPlacementModel->getClientInstallmentDetails(); - - }catch (Exception $e) { + } catch (Exception $e) { $this->myLogger->logme('error', 'Exception: ' . $e->getMessage() . 'Page: ' . $e->getFile() . ' Line: ' . $e->getLine()); - } $this->myLogger->logme("error", "Data for BDS Installment " . json_encode($bdsInstallmentData)); // dd($bdsInstallmentData); @@ -2906,17 +2910,17 @@ class PolicyTransactionController extends BaseController 'message' => $message, 'subject' => $subject ]; - } catch (Exception $e) { $this->myLogger->logme('error', 'Exception: ' . $e->getMessage() . 'Page: ' . $e->getFile() . ' Line: ' . $e->getLine()); } } - public function getMoreInfo() { + public function getMoreInfo() + { $pt_id = $this->request->getPost("pt_id"); - $data_to_send['bds_data'] = $this->BdsPlacementModel->where("is_active",1)->where("pt_id",$pt_id)->findAll(); + $data_to_send['bds_data'] = $this->BdsPlacementModel->where("is_active", 1)->where("pt_id", $pt_id)->findAll(); foreach ($data_to_send['bds_data'] as &$data) { @@ -2925,23 +2929,23 @@ class PolicyTransactionController extends BaseController if (!empty($data_to_send)) { - return $this->respond(['status' => true , "data" => $data_to_send],200); - }else { + return $this->respond(['status' => true, "data" => $data_to_send], 200); + } else { - return $this->respond(['status' => false,"No Data Found For the Policy Transaction"],404); + return $this->respond(['status' => false, "No Data Found For the Policy Transaction"], 404); } - } - public function saveInstallment() { - + public function saveInstallment() + { + $installments = $this->request->getPost('installments'); - + if (!$installments || !is_array($installments)) { return $this->respond(['status' => false, 'message' => 'No data received'], 400); } - $this->myLogger->logme("error",json_encode($installments)); + $this->myLogger->logme("error", json_encode($installments)); // die(); foreach ($installments as &$row) { @@ -2958,6 +2962,49 @@ class PolicyTransactionController extends BaseController return $this->respond(['status' => true, 'message' => 'Data saved successfully'], 200); } + protected function getPolicyForEndorsment() + { + + $policyList = []; + $policyListByClient = []; + $clients = $this->clientModel + ->select("*, DATE_FORMAT(dob, '%d-%m-%Y') as dob") + ->where('is_active', 1) + ->findAll(); + + $clientIds = array_column($clients, 'id'); + + $policies = $this->clientPolicyModel + ->select(" + client_policy.*, + policy_type.policy_type, + policy_type.ebp, + policy_type.etp, + policy_type.iep, + policy_type.itp, + policy_type.bap, + policy_type.allocg, + 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_end_date + ") + ->join('policy_type', 'policy_type.id = client_policy.policy_type_id') + ->join('policy_transaction pt', 'pt.client_policy_id = client_policy.id and pt.action_type = "inception" and pt.is_active = 1 and pt.client_policy_id is not null') + ->whereIn('client_policy.client_id', $clientIds) + ->where('client_policy.is_active', 1) + ->findAll(); + + foreach ($policies as $policy) { + $policyList[$policy['client_branch_id']][] = $policy; + $policyListByClient[$policy['client_id']][] = $policy; + if (isset($policyCount[$policy['client_id']])) { + $policyCount[$policy['client_id']]++; + } else { + $policyCount[$policy['client_id']] = 1; + } + } + + return [$policyList, $policyListByClient]; + } } diff --git a/app/Views/policy_transaction_endorsement_form.php b/app/Views/policy_transaction_endorsement_form.php index 515d6a36..eaab26ee 100644 --- a/app/Views/policy_transaction_endorsement_form.php +++ b/app/Views/policy_transaction_endorsement_form.php @@ -560,7 +560,10 @@ $(document).ready(function(){ if(policyListByClient != '') { // console.log(branch_list[client_id]); let data = policyListByClient[client_id]; + if (data) { appendPolicies(data); + + } } }) diff --git a/app/Views/policy_transaction_endorsement_list.php b/app/Views/policy_transaction_endorsement_list.php index c6b285c8..52eb4fea 100644 --- a/app/Views/policy_transaction_endorsement_list.php +++ b/app/Views/policy_transaction_endorsement_list.php @@ -445,10 +445,11 @@ document.addEventListener("DOMContentLoaded", function () {