From fd0d4064674668a5e7965ae2ba193471b2152ec5 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Sat, 20 Sep 2025 19:08:57 +0530 Subject: [PATCH 1/6] CHANGE_BDS --- app/Views/policy_transaction_inception_form.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/Views/policy_transaction_inception_form.php b/app/Views/policy_transaction_inception_form.php index c505a1e4..a2867ce6 100644 --- a/app/Views/policy_transaction_inception_form.php +++ b/app/Views/policy_transaction_inception_form.php @@ -2336,8 +2336,13 @@ // console.log('variance', variance); // $('#variance_' + input).val(!isNaN(variance) && isFinite(variance) ? variance.toFixed(2) : '0.00'); + let policy_type_id = $('#policy_type_id').val(); - checkCDAmountForBasePremium(input); + if(policy_type_id > 7){ + checkCDAmountForBasePremium(input); + }else{ + console.log("First Skip the Ajax Call these are group policies"); + } setCoPremiums(input); console.log('############################## END AMOUNT CALCULATION ############################################') @@ -4833,6 +4838,9 @@ console.log('#################################### Check CD Amount For Base Premium ####################################'); + let policy_type_id = $('#policy_type_id').val(); + console.log("policy_type_id ", policy_type_id); + console.log(input) let client_type = $('#client_type').val(); console.log('client type', client_type); @@ -4845,7 +4853,7 @@ // return; - if(client_type == 1){ + if(client_type == 1 && policy_type_id > 7){ let current_total_amt = $('#base_cd_amount').val() ?? 0; console.log('current_total_amt', current_total_amt); @@ -4930,6 +4938,8 @@ toastr.error('An error occurred while checking the CD amount.', 'ERROR'); }); + }else{ + console.log("Skip the Ajax Call these are group policies"); } console.log('#################################### END Check CD Amount For Base Premium ####################################'); From e291e81f3340f2baca72861ee9316b3410fb9073 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Mon, 22 Sep 2025 09:57:21 +0530 Subject: [PATCH 2/6] CHANGE_BDS --- .../PolicyTransactionController.php | 15 ++--- .../policy_transaction_endorsement_form.php | 61 +++++++++++++------ 2 files changed, 50 insertions(+), 26 deletions(-) diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php index 09274d01..8b2a80bb 100644 --- a/app/Controllers/PolicyTransactionController.php +++ b/app/Controllers/PolicyTransactionController.php @@ -1193,9 +1193,6 @@ class PolicyTransactionController extends BaseController // $data['is_cd_reduce_from_bds'] = 1; // } - $data['is_cd_reduce_from_bds'] = ($data['policy_type_id'] > 7 && $data['client_type'] == 1) ? 1 : 0; - - if (empty($data['data_received_date'])) { $data['data_received_date'] = null; } else { @@ -1255,6 +1252,8 @@ class PolicyTransactionController extends BaseController $client_branch_id = $issue_type['client_branch_id']; } + $data['is_cd_reduce_from_bds'] = (isset($issue_type['policy_type_id']) && $issue_type['policy_type_id'] > 7 && $data['client_type'] == 1) ? 1 : 0; + // if($data['bro_payable_by'] == ""){ // $data['bro_payable_by'] = $issue_type['bro_payable_by']; // } @@ -1324,13 +1323,16 @@ class PolicyTransactionController extends BaseController } private function updateEndorsementTransaction($id, $data) - { + { + $old_endorse_data = $this->policyTransactionModel->where('id', $id)->where('is_active', 1)->first(); $update = $this->policyTransactionModel->where('id', $id)->set($data)->update(); if ($update) { $this->insertTransactionStatus($id, $data, 1); - $this->handleCompletedStatus($data, $id); + if($old_endorse_data['status'] != "completed"){ + $this->handleCompletedStatus($data, $id); + } $this->insertOrUpdateCoShareDetails($data, $id); @@ -1344,11 +1346,10 @@ class PolicyTransactionController extends BaseController { if ($data['client_type'] == 1 && $data['status'] == 'completed' && $data['is_cd_reduce_from_bds'] == 1) { - $tolamt = $data['total'][0] ?? 0; + $tolamt = (int) $data['total'][0] ?? 0; $description = 'The following amount of Rs. ' . round($tolamt, 2) . '/- has been' . ($data['action_type'] == 'deletion' ? ' Credit ' : ' Debit ') . 'from the policy transaction (BDS)'; - $cd_tranction_data = [ 'amount' => $tolamt, 'sub_type_id' => $data['action_type'] == 'deletion' ? 3 : 4, diff --git a/app/Views/policy_transaction_endorsement_form.php b/app/Views/policy_transaction_endorsement_form.php index bb1b877d..b15d5cc0 100644 --- a/app/Views/policy_transaction_endorsement_form.php +++ b/app/Views/policy_transaction_endorsement_form.php @@ -363,11 +363,11 @@ Is Leader? - + CD Acc No - + CD Amount @@ -602,20 +602,32 @@ $(document).ready(function(){ var end_date = $(this).find('option:selected').attr('data-ed'); var policy_type_id = $(this).find('option:selected').attr('data-ptid'); - if(policy_type_id == 1 || policy_type_id == 2 || policy_type_id == 3 || policy_type_id == 4 || policy_type_id == 5 || policy_type_id == 6 || policy_type_id == 7){ - $('#is_cd_reduce_from_bds').prop('disabled',true).prop('checked', false) - }else{ - $('#is_cd_reduce_from_bds').prop('disabled',false) - } + // if(policy_type_id == 1 || policy_type_id == 2 || policy_type_id == 3 || policy_type_id == 4 || policy_type_id == 5 || policy_type_id == 6 || policy_type_id == 7){ + // $('#is_cd_reduce_from_bds').prop('disabled',true).prop('checked', false) + // }else{ + // $('#is_cd_reduce_from_bds').prop('disabled',false) + // } if( policy_type_id > 7 ){ $('#tpa_endorse_div').hide(); - $('#no_of_insured_endorse_div').hide(); - $('#no_of_dependents_endorse_div').hide(); + $('#table_tr_34').show(); + $('#table_tr_37').show(); }else{ $('#tpa_endorse_div').show(); + $('#table_tr_34').hide(); + $('#table_tr_37').hide(); + } + + + if(policy_type_id == 2 || policy_type_id == 3 || policy_type_id == 4 || policy_type_id == 5){ $('#no_of_insured_endorse_div').show(); $('#no_of_dependents_endorse_div').show(); + }else if(policy_type_id == 1 || policy_type_id == 6 || policy_type_id == 7) { + $('#no_of_insured_endorse_div').show(); + $('#no_of_dependents_endorse_div').hide(); + }else{ + $('#no_of_insured_endorse_div').hide(); + $('#no_of_dependents_endorse_div').hide(); } @@ -822,8 +834,13 @@ $('#client_type').on('change', function() { if (selectedClientType == 2) { $('.branchdiv').hide(); + $('#table_tr_34').hide(); + $('#table_tr_37').hide(); } else { $('.branchdiv').show(); + $('#table_tr_34').show(); + $('#table_tr_37').show(); + } console.log('selectedClientType', selectedClientType); @@ -850,8 +867,14 @@ $('#client_type').on('change', function() { } + $('#client_policy_id').empty().append($('