From 0c85b8ec728764d8ac41fb08273eb26497ef46f4 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Tue, 23 Dec 2025 12:42:11 +0530 Subject: [PATCH 1/8] BDS_CHANGE_NEW --- .../PolicyTransactionController.php | 6 + .../policy_transaction_endorsement_form.php | 12 +- .../policy_transaction_inception_form.php | 140 ++++++++++++++---- app/Views/report_bds.php | 7 +- 4 files changed, 131 insertions(+), 34 deletions(-) diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php index 385a4bff..2fdfe255 100644 --- a/app/Controllers/PolicyTransactionController.php +++ b/app/Controllers/PolicyTransactionController.php @@ -732,6 +732,11 @@ // dd($data); + //Fetch POS + $data['pos_data'] = db_connect()->table('partner_pos') + ->where('is_active', 1) + ->get() + ->getResultArray(); // Load view $this->loadLayout('policy_transaction_inception_list', $data); @@ -2382,6 +2387,7 @@ 'service_person_branch_id' => $issue_type['service_person_branch_id'] ?? null, 'agent_id' => $issue_type['agent_id'] ?? null, 'agent_code' => $issue_type['agent_code'] ?? null, + 'pos_id' => $issue_type['pos_id'] ?? null, ]; $data['client_branch_id'] = $client_branch_id; diff --git a/app/Views/policy_transaction_endorsement_form.php b/app/Views/policy_transaction_endorsement_form.php index 98f20c0b..2d6a5bd8 100644 --- a/app/Views/policy_transaction_endorsement_form.php +++ b/app/Views/policy_transaction_endorsement_form.php @@ -447,7 +447,7 @@ Co-Share % - Non Commissional
Premium Amount + Non-Commissionable
Premium Amount Base Premium @@ -1580,6 +1580,16 @@ let terrisom_premium = ($('#bro_payable_by').val() == 1) ? tep : cotep; let tpTotal = base_premium + third_part_premium + terrisom_premium; + if($('#bro_payable_by').val() == 2){ + + if($('#co_share_type_' + input).val() == 1){ + base_premium = bp; + third_part_premium = tp; + terrisom_premium = tep; + tpTotal = base_premium + third_part_premium + terrisom_premium; + } + } + // Co-premium defaults if ($('#cop_yes').val() == 0) { if (!rawVal('co_premium')) $('#co_premium_' + input).val(bp); diff --git a/app/Views/policy_transaction_inception_form.php b/app/Views/policy_transaction_inception_form.php index 9fb5cbfe..6a0cb78c 100644 --- a/app/Views/policy_transaction_inception_form.php +++ b/app/Views/policy_transaction_inception_form.php @@ -790,7 +790,7 @@ --> -
+
-
+ + +
+ +
@@ -912,6 +921,20 @@
+
+ + +
+ @@ -977,7 +1000,7 @@ Co-Share % - Non Commissional
Premium Amount + Non-Commissionable
Premium Amount Base Premium @@ -1594,6 +1617,7 @@ $('#owner').select2(); $('#owner_branch').select2(); $('#vehicle_no').select2(); + $('#pos_id').select2(); var today = new Date(); var dob = flatpickr("#dob", { @@ -1671,7 +1695,7 @@ $('#table_tr_34').show(); $('#table_tr_37').show(); - $("select[name='cd_ac_no_for_child[]']").attr('required', 'required'); + // $("select[name='cd_ac_no_for_child[]']").attr('required', 'required'); }else{ @@ -1680,7 +1704,7 @@ $('#table_tr_34').hide(); $('#table_tr_37').hide(); - $("select[name='cd_ac_no_for_child[]']").removeAttr("required"); + // $("select[name='cd_ac_no_for_child[]']").removeAttr("required"); } @@ -2010,7 +2034,7 @@ $('#table_tr_34').hide(); $('#table_tr_37').hide(); - $("select[name='cd_ac_no_for_child[]']").removeAttr("required"); + // $("select[name='cd_ac_no_for_child[]']").removeAttr("required"); }else{ @@ -2018,7 +2042,7 @@ $('#table_tr_34').show(); $('#table_tr_37').show(); - $("select[name='cd_ac_no_for_child[]']").attr('required', 'required'); + // $("select[name='cd_ac_no_for_child[]']").attr('required', 'required'); } if(value == 8){ @@ -2049,6 +2073,8 @@ let val = $(this).val(); let uniqueid = $(this).data('id'); let insurer = $('#follow_insurer_id_'+uniqueid).val() + let policy_type_id = $('#policy_type_id').val(); + let client_type = $('#client_type').val(); var client_id = $('#client_id').val() var insurer_id = $('#follow_insurer_id_'+uniqueid).find('option:selected').attr('data-id'); @@ -2099,6 +2125,27 @@ $('[id^="cd_current_balance_"]').show(); } + if(policy_type_id > 7 || client_type == 1){ + $('[name="cd_ac_no_for_child[]"]').removeAttr('onchange'); + $('#cd_ac_no_' + uniqueid).attr('onchange', 'addCDAccountNumber(this); restrictCDACNO(this);'); + + if ($(this).is(':checked')) { + + $('[name="cd_ac_no_for_child[]"]').each(function () { + $(this).prop('required', false).parsley().reset(); + }); + + $('#cd_ac_no_' + uniqueid).prop('required', true).parsley().reset(); + + } else { + + $('[name="cd_ac_no_for_child[]"]').each(function () { + $(this).prop('required', false).parsley().reset(); + }); + } + + } + }); $(document).on('change', 'select[name="relationship[]"]', function() { @@ -2141,6 +2188,7 @@ $(document).on('change', '[name="follow_insurer_id[]"]', function() { + let currentSelect = $(this); let insurer = $(this).val(); let unique_id = $(this).data('count'); let client_id = $('#client_id').val(); @@ -2154,8 +2202,24 @@ $('#insurer_id').val(insurer) if (!policy_type_id || !client_id) { - $(this).val('').select2(); + $(this).val('').select2(); toastr.warning(!policy_type_id ? 'Please select the Policy Type' : 'Please select the Client', 'WARNING'); + return false; + } + + let isDuplicate = false; + + $('[name="follow_insurer_id[]"]').not(currentSelect).each(function () { + if ($(this).val() === insurer) { + isDuplicate = true; + return false; // break loop + } + }); + + if (isDuplicate) { + $(this).val('').select2(); + toastr.warning('Do not select the same insurer and branch again'); + return false; } }); @@ -2352,8 +2416,7 @@ $('#serviced_by').val(res.data.serviced_by ?? '').change(); $('#base_cd_amount').val(res.data.base_cd_amount); $('#issuer_branch').val(res.data.issuer_branch); - console.log('res.data.base_cd_amount', res.data.base_cd_amount); - console.log('res.data.issuer_branch', res.data.issuer_branch); + $('#pos_id').val(res.data.pos_id ?? '').change(); // Additional form handling logic @@ -2417,11 +2480,12 @@ } // Handle brokerage pay by - if (res.data.bro_payable_by == 1) { - $('#bro_payable_by').prop('checked', true); - } else { - $('#bro_payable_by').prop('checked', false); - } + // if (res.data.bro_payable_by == 1) { + // $('#bro_payable_by').prop('checked', true); + // } else { + // $('#bro_payable_by').prop('checked', false); + // } + $('#bro_payable_by').val(res.data.bro_payable_by); // Policy transaction status handling if (res.data.status == "completed") { @@ -2457,7 +2521,7 @@ $('#client_branch_id').prop('required', false); $('#table_tr_34').hide(); $('#table_tr_37').hide(); - $("select[name='cd_ac_no_for_child[]']").removeAttr("required"); + // $("select[name='cd_ac_no_for_child[]']").removeAttr("required"); } else { $('#policyholdernamediv').hide(); @@ -2465,7 +2529,7 @@ $('#client_branch_id').prop('required', true); $('#table_tr_34').show(); $('#table_tr_37').show(); - $("select[name='cd_ac_no_for_child[]']").attr('required', 'required'); + // $("select[name='cd_ac_no_for_child[]']").attr('required', 'required'); } //Vehicle File Upload Tab Hide And show @@ -2711,7 +2775,8 @@ let terrisom_premium = cotep; let tpTotal = cop + cotp + cotep; - if($('#bro_payable_by').is(':checked')){ + // if($('#bro_payable_by').is(':checked')){ + if($('#bro_payable_by').val() == 1){ tpTotal = bp + tp + tep; @@ -2719,6 +2784,19 @@ third_part_premium = tp; terrisom_premium = tep; + }else if($('#bro_payable_by').val() == 2){ + + console.log("$('#bro_payable_by').val()", $('#bro_payable_by').val()); + console.log("$('#co_share_type_' + input).is(':checked')", $('co_share_type_' + input).is(':checked')) + + if($('#co_share_type_' + input).is(':checked')){ + + tpTotal = bp + tp + tep; + + base_premium = bp; + third_part_premium = tp; + terrisom_premium = tep; + } } if (!$('#cop_yes').is(':checked')) { @@ -2812,7 +2890,7 @@ let policy_type_id = $('#policy_type_id').val(); if(policy_type_id > 7 && name == "base_premium[]"){ - checkCDAmountForBasePremium(input); + // checkCDAmountForBasePremium(input); }else{ console.log("First Skip the Ajax Call these are group policies"); } @@ -3372,7 +3450,6 @@ $('input[name="co_ter_premium[]"]').addClass('readonly-select'); $('#co_ter_premium_' + value).removeClass('readonly-select'); - $('[name="cd_ac_no_for_child[]"]').hide(); $('[id^="cd_current_balance_"]').hide(); @@ -3382,7 +3459,6 @@ // $('input[name="cd_ac_no_for_child[]"]').addClass('readonly-select'); // $('#cd_ac_no_' + value).removeClass('readonly-select'); - } } }); @@ -4386,11 +4462,11 @@ 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){ $('#table_tr_34').hide(); $('#table_tr_37').hide(); - $("select[name='cd_ac_no_for_child[]']").removeAttr("required"); + // $("select[name='cd_ac_no_for_child[]']").removeAttr("required"); }else{ $('#table_tr_34').show(); $('#table_tr_37').show(); - $("select[name='cd_ac_no_for_child[]']").attr('required', 'required'); + // $("select[name='cd_ac_no_for_child[]']").attr('required', 'required'); } } @@ -4468,13 +4544,13 @@ $('#owner_branch').prop('required', false); $('#table_tr_34').hide(); $('#table_tr_37').hide(); - $("select[name='cd_ac_no_for_child[]']").removeAttr("required"); + // $("select[name='cd_ac_no_for_child[]']").removeAttr("required"); } else { $('.ownerbranchdiv').show(); $('#owner_branch').prop('required', true); $('#table_tr_34').show(); $('#table_tr_37').show(); - $("select[name='cd_ac_no_for_child[]']").attr('required', 'required'); + // $("select[name='cd_ac_no_for_child[]']").attr('required', 'required'); } // console.log('selected Owner type', selectedClientType); @@ -4767,7 +4843,7 @@ newCell = ``; break; case 8: // Base Premium - newCell = ``; + newCell = ``; break; case 9: // TP Premium newCell = ``; @@ -4912,7 +4988,7 @@ newCell = ``; break; case 8: // Base Premium - newCell = ``; + newCell = ``; break; case 9: // TP Premium newCell = ``; @@ -5458,10 +5534,12 @@ }); if(index != 0){ - if(data.co_share_type != 0 && data.co_share_type != 1){ - let co_share_index = index + 1; - select_leader_disable_premium_amt_in_edit(co_share_index); - } + // if(data.co_share_type != 0 && data.co_share_type != 1){ + // let co_share_index = index + 1; + // select_leader_disable_premium_amt_in_edit(co_share_index); + // } + select_leader_disable_premium_amt_in_edit(); + } }); diff --git a/app/Views/report_bds.php b/app/Views/report_bds.php index 23636b9b..40283cfa 100644 --- a/app/Views/report_bds.php +++ b/app/Views/report_bds.php @@ -685,13 +685,16 @@ $(document).ready(function() { var totalRewards = getTotal(24); var totalIrda = getTotal(25); var totalBilled = getTotal(26); - var totalRevenue = parseFloat(totalIrda) + parseFloat(totalRewards); var totalUnbilled = getTotal(27); + var totalIrdaAmt = parseFloat(totalBilled) - parseFloat(totalRewards); + var totalRevenue = parseFloat(totalIrdaAmt) + parseFloat(totalRewards); + // Update the totals section above the table $('#total_premium').text(totalPremium.toFixed(2)); $('#total_rewards').text(totalRewards.toFixed(2)); - $('#total_irda').text(totalIrda.toFixed(2)); + // $('#total_irda').text(totalIrda.toFixed(2)); + $('#total_irda').text(totalIrdaAmt.toFixed(2)); $('#total_revenue').text(totalRevenue.toFixed(2)); // $('#total_revenue').text(totalIrda.toFixed(2)); $('#total_billed').text(totalBilled.toFixed(2)); From 64ac479c30c8013786811b232fe4c8711110ed41 Mon Sep 17 00:00:00 2001 From: "sanjeev.p" Date: Tue, 23 Dec 2025 16:30:05 +0530 Subject: [PATCH 2/8] FIX_Velmurugan told me to add postDB[encrypt] in DataBase.php config Folder And View Member Client dropdown fixes and Dashbaord SSession Enrollment_data removed --- app/Config/Database.php | 4 + app/Controllers/DashboardController.php | 2 +- app/Views/employee_list.php | 249 ++++++++++++++---------- app/Views/insurer_or_tpa_data.php | 2 +- 4 files changed, 153 insertions(+), 104 deletions(-) diff --git a/app/Config/Database.php b/app/Config/Database.php index dcc1c2dd..c0f91c65 100755 --- a/app/Config/Database.php +++ b/app/Config/Database.php @@ -134,6 +134,10 @@ class Database extends Config 'ssl_ca' => ROOTPATH . 'ca.pem', 'ssl_verify' => true, ]; + $this->preDB['encrypt'] = [ + 'ssl_ca' => ROOTPATH . 'ca.pem', + 'ssl_verify' => true, + ]; } } diff --git a/app/Controllers/DashboardController.php b/app/Controllers/DashboardController.php index 8958c26d..50a9e4c1 100755 --- a/app/Controllers/DashboardController.php +++ b/app/Controllers/DashboardController.php @@ -238,7 +238,7 @@ class DashboardController extends AdminController $data['client_branch_emp_list'] = $results; $session = \Config\Services::session(); - $session->set('enrollment_data', json_encode($data)); + // $session->set('enrollment_data', json_encode($data)); $data['pendingActionsData'] = $pendingActionsData; $data['businessTeamCount'] = count($businessTeamData) ?? 0; diff --git a/app/Views/employee_list.php b/app/Views/employee_list.php index 45ad39a0..6f6d74dc 100755 --- a/app/Views/employee_list.php +++ b/app/Views/employee_list.php @@ -355,11 +355,54 @@ // } }); + + var client_list = ''; // local variable for storing the client branch list + var branch_list = ''; // local variable for storing the client branch list + var policy_list = ''; // local variable for storing the client policy list + var branch_policy = ''; + var policy_list_by_client = ''; + + $(document).ready(function() { + getClientAndBranchAndPolicy(); + }) + + //featch client and branch and policy + function getClientAndBranchAndPolicy() { + $.ajax({ + url: '', + type: "GET", + dataType: 'json', + success: function(res) { + + console.log('getClientAndBranchAndPolicy', res); + if (res.status == true) { + + client_list = res.client_data; + branch_list = res.branch_data; + policy_list = res.policy_data; + policy_list_by_client = res.policyListByClient; + + appendClients(client_list); + // appendBranch(branch_list); + // appendPolicies(policy_list); + + } else { + console.log('No data found'); + } + + }, + error: function(xhr, status, error) { + console.error(xhr.responseText); + console.error(status, error); + } + }); + } + // Declare a global variable to store API response data - var clientPolicies = []; - var clientPoliciesWithBranch = { - policies: [] - }; + // var clientPolicies = []; + // var clientPoliciesWithBranch = { + // policies: [] + // }; var client_id = ''; var client_branch_id = ''; @@ -376,91 +419,91 @@ }); - $(document).ready(function() { - console.log("document loaded"); - //fetchClientPolicies(); - }); + // $(document).ready(function() { + // console.log("document loaded"); + // //fetchClientPolicies(); + // }); - $(window).on("load", function() { - console.log("window loaded"); - fetchClientPolicies(); - }); + // $(window).on("load", function() { + // console.log("window loaded"); + // fetchClientPolicies(); + // }); - function fetchClientPolicies() { - $('#loader').show(); - var apiURL = '' + 'util/clients-with-policies'; - console.log('fetchClientPolicies'); - // console.log(apiURL); - $.ajax({ - url: apiURL, - method: 'GET', - headers: { - "Content-Type": "application/json", - "X-Requested-With": "XMLHttpRequest" - }, - success: function(response) { - // console.log(response.code); - // console.log(response.dataStatus); - // console.log(response.data); - if (response.code === 200 && response.dataStatus === true && response.data !== "") { - try { - clientPolicies = (response.data); + // function fetchClientPolicies() { + // $('#loader').show(); + // var apiURL = '' + 'util/clients-with-policies'; + // console.log('fetchClientPolicies'); + // // console.log(apiURL); + // $.ajax({ + // url: apiURL, + // method: 'GET', + // headers: { + // "Content-Type": "application/json", + // "X-Requested-With": "XMLHttpRequest" + // }, + // success: function(response) { + // // console.log(response.code); + // // console.log(response.dataStatus); + // // console.log(response.data); + // if (response.code === 200 && response.dataStatus === true && response.data !== "") { + // try { + // clientPolicies = (response.data); - response.data.forEach(policy => { - // console.log('policies', policy.policies); - policy.policies.forEach(p => { - clientPoliciesWithBranch.policies.push(p); - }); - }); + // response.data.forEach(policy => { + // // console.log('policies', policy.policies); + // policy.policies.forEach(p => { + // clientPoliciesWithBranch.policies.push(p); + // }); + // }); - // console.log('1',clientPolicies); - appendClients(clientPolicies); + // // console.log('1',clientPolicies); + // appendClients(clientPolicies); - //this function for reselect the policy - setTimeout(function() { - if (client_id != 0) { - var foundPolicies = clientPolicies.find(function(item) { - // console.log(typeof item.id) - return item.id == client_id; - }); - appendBranch(foundPolicies.branchs); - } - }, 500); + // //this function for reselect the policy + // setTimeout(function() { + // if (client_id != 0) { + // var foundPolicies = clientPolicies.find(function(item) { + // // console.log(typeof item.id) + // return item.id == client_id; + // }); + // appendBranch(foundPolicies.branchs); + // } + // }, 500); - setTimeout(function() { - if (client_branch_id != 0) { + // setTimeout(function() { + // if (client_branch_id != 0) { - var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) { - // console.log('item', item); - return item.branch_id === client_branch_id; - }); + // var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) { + // // console.log('item', item); + // return item.branch_id === client_branch_id; + // }); - if (foundPolicies) { - // console.log('foundPolicies', foundPolicies); - appendPolicies(foundPolicies); - } else { - console.log('No policies found for the selected client'); - } - } - }, 500); - //end + // if (foundPolicies) { + // // console.log('foundPolicies', foundPolicies); + // appendPolicies(foundPolicies); + // } else { + // console.log('No policies found for the selected client'); + // } + // } + // }, 500); + // //end - } catch (error) { - console.error('Error parsing API response data:', error); - } - } else if (response.code === 404 && response.dataStatus === false) { - console.error('no data found', response); - } else { - console.error('Something went wrong!'); - } - }, - error: function(xhr, status, error) { - console.error('Error fetching data from API:', error); - } - }); + // } catch (error) { + // console.error('Error parsing API response data:', error); + // } + // } else if (response.code === 404 && response.dataStatus === false) { + // console.error('no data found', response); + // } else { + // console.error('Something went wrong!'); + // } + // }, + // error: function(xhr, status, error) { + // console.error('Error fetching data from API:', error); + // } + // }); - $('#loader').hide(); - } + // $('#loader').hide(); + // } function appendClients(data) { var clientID = ; @@ -507,8 +550,9 @@ // console.log(PolicyID) $.each(data, function(index, item) { var option = $('