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 @@
-->
-
+
+
+
+
+
@@ -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));