FIX_ENDO_STATUS_(+)(-)_ISSUE

This commit is contained in:
VENKATESHWARAN 2025-11-13 11:09:56 +05:30
parent 5bd385adf0
commit a1a177ecb9

View File

@ -1346,6 +1346,41 @@
// $('#co_premium_' + input).val(cop.toFixed(2));
// $('#co_tp_premium_' + input).val(cotp.toFixed(2));
// $('#co_ter_premium_' + input).val(cotep.toFixed(2));
// }
// Apply Deletion (Negative) Values
// function applyDeletionSymbolsToFields(input, isDeletion) {
// console.log('========== APPLYING DELETION SYMBOLS ==========');
// if (!isDeletion) return;
// const fieldIds = [
// 'base_premium',
// 'tp_premium',
// 'ter_premium',
// 'co_premium',
// 'co_tp_premium',
// 'co_ter_premium',
// 'gst_amount',
// 'agreed_amount',
// 'non_comm_per_amt',
// 'total_amt',
// 'exp_amt'
// ];
// fieldIds.forEach(field => {
// const $el = $('#' + field + '_' + input);
// console.log('$el', '#' + field + '_' + input);
// console.log('$el', $el);
// let val = $el.val()?.trim();
// console.log('$val', val);
// if (!val || val.startsWith('-')) return;
// let num = parseFloat(val);
// if (!isNaN(num) && num > 0) $el.val(-num);
// });
// console.log('========== COMPLETED DELETION SYMBOL APPLICATION ==========');
// }
function checkAndDistributeTax(input){
@ -1432,11 +1467,9 @@
let bap = selectedOption.data('bap') || '';
let allocg = selectedOption.data('allocg') || '';
let endorsement_type = $('#action_type').val();
let isDeletion = endorsement_type === "deletion";
// let isDeletion = false; // REF : VR,SVR and SVM remove "-" forenoon, they all said to revert it i don't know the reason 12/N/25 3:47pm .
console.log("bap:", bap, "allocg:", allocg, "isDeletion:", isDeletion);
let isDeletion = false;
// let isDeletion = endorsement_type === "deletion" || endorsement_type === "policy_cancellation";
console.log({bap, allocg, isDeletion});
const event = window.event || {};
@ -1460,7 +1493,20 @@
let cotp = (allocg !== 'EB') ? absNum('co_tp_premium') : 0;
let cotep = (['Fire', 'Marine Cargo', 'Marine Hull'].includes(bap)) ? absNum('co_ter_premium') : 0;
console.log({ bp, tp, tep, cop, cotp, cotep, ncpa });
console.log('premiums :', { bp, tp, tep, cop, cotp, cotep, ncpa });
let bp_raw_val = parseFloat($('#base_premium_' + input).val());
console.log('bp_raw_val', bp_raw_val);
// handel the positive(+), negative(-) symbole add the value
if(endorsement_type === "addition" || endorsement_type === "baby_addition" || endorsement_type === "addition_inception"){
isDeletion = false
}else if(endorsement_type === "deletion" || endorsement_type === "policy_cancellation"){
isDeletion = true
}else if(bp_raw_val < 0){
isDeletion = true;
console.log('Value is negative:', bp_raw_val);
}
let co_share_type_val = numVal('co_share_type');
console.log('co_share_type_val :', co_share_type_val);
@ -1542,40 +1588,6 @@
}
// Apply Deletion (Negative) Values
// function applyDeletionSymbolsToFields(input, isDeletion) {
// console.log('========== APPLYING DELETION SYMBOLS ==========');
// if (!isDeletion) return;
// const fieldIds = [
// 'base_premium',
// 'tp_premium',
// 'ter_premium',
// 'co_premium',
// 'co_tp_premium',
// 'co_ter_premium',
// 'gst_amount',
// 'agreed_amount',
// 'non_comm_per_amt',
// 'total_amt',
// 'exp_amt'
// ];
// fieldIds.forEach(field => {
// const $el = $('#' + field + '_' + input);
// console.log('$el', '#' + field + '_' + input);
// console.log('$el', $el);
// let val = $el.val()?.trim();
// console.log('$val', val);
// if (!val || val.startsWith('-')) return;
// let num = parseFloat(val);
// if (!isNaN(num) && num > 0) $el.val(-num);
// });
// console.log('========== COMPLETED DELETION SYMBOL APPLICATION ==========');
// }
function applyDeletionSymbolsToFields(input, isDeletion) {
console.log('========== APPLYING DELETION SYMBOLS ==========');
@ -1615,7 +1627,6 @@
console.log('========== COMPLETED DELETION SYMBOL APPLICATION ==========');
}
function setCoPremiums(input) {
// Get base, TP, and TEP premiums for the given input row
let bp = parseFloat($('#base_premium_' + input).val()) || 0;