FIX_BDS_REPORT_ISSUE_CHANGE_0_RESTRICT_POLICY_IN_BDS
This commit is contained in:
parent
7e6ecd570d
commit
7c7f3ce07a
@ -1005,6 +1005,7 @@
|
|||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
$('#policy_start_date').val(res.data.policy_start_date);
|
$('#policy_start_date').val(res.data.policy_start_date);
|
||||||
$('#policy_end_date').val(res.data.policy_end_date);
|
$('#policy_end_date').val(res.data.policy_end_date);
|
||||||
|
$('#insurer_id').val(res.data.insurer_branch_id + '-' + res.data.insurer_id);
|
||||||
}, 1500)
|
}, 1500)
|
||||||
|
|
||||||
$('#policy_no').val(res.data.policy_no);
|
$('#policy_no').val(res.data.policy_no);
|
||||||
@ -1347,15 +1348,39 @@
|
|||||||
// $('#co_ter_premium_' + input).val(cotep.toFixed(2));
|
// $('#co_ter_premium_' + input).val(cotep.toFixed(2));
|
||||||
// }
|
// }
|
||||||
|
|
||||||
function checkAndDistributeTax(input)
|
function checkAndDistributeTax(input){
|
||||||
{
|
|
||||||
const event = window.event;
|
const event = window.event;
|
||||||
console.log("Event id:", event.target.id);
|
console.log("Event id:", event.target.id);
|
||||||
|
|
||||||
|
let policy_type_id = $('#client_policy_id').find('option:selected').attr('data-ptid');
|
||||||
|
policy_type_id = parseInt(policy_type_id);
|
||||||
|
console.log('policy_type_id', policy_type_id);
|
||||||
|
|
||||||
let cgst = parseFloat($('#cgst_' + input).val());
|
let cgst = parseFloat($('#cgst_' + input).val());
|
||||||
let sgst = parseFloat($('#sgst_' + input).val());
|
let sgst = parseFloat($('#sgst_' + input).val());
|
||||||
let igst = parseFloat($('#igst_' + input).val());
|
let igst = parseFloat($('#igst_' + input).val());
|
||||||
|
|
||||||
|
// ✅ Allow 0 only for policy types 2, 5, 7
|
||||||
|
const allowZero = [1,2,3,4,5,6,7,38,39,40].includes(policy_type_id);
|
||||||
|
console.log("allowZero", allowZero);
|
||||||
|
|
||||||
|
// 🔒 Validation: Disallow 0 or negative values for other policy types
|
||||||
|
if (!allowZero) {
|
||||||
|
if ((cgst <= 0 && (event.target.id).startsWith('cgst')) ||
|
||||||
|
(sgst <= 0 && (event.target.id).startsWith('sgst')) ||
|
||||||
|
(igst <= 0 && (event.target.id).startsWith('igst'))) {
|
||||||
|
|
||||||
|
toastr.warning('Tax value must be greater than 0 for this policy type.');
|
||||||
|
$('#'+ event.target.id).val('');
|
||||||
|
$('#igst_' + input).val('');
|
||||||
|
$('#cgst_' + input).val('');
|
||||||
|
$('#sgst_' + input).val('');
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (((event.target.id).startsWith('cgst'))) {
|
if (((event.target.id).startsWith('cgst'))) {
|
||||||
|
|
||||||
if (!isFinite(cgst) || isNaN(cgst) || cgst === undefined) {
|
if (!isFinite(cgst) || isNaN(cgst) || cgst === undefined) {
|
||||||
|
|||||||
@ -2322,13 +2322,37 @@
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
function checkAndDistributeTax(input){
|
function checkAndDistributeTax(input){
|
||||||
|
|
||||||
const event = window.event;
|
const event = window.event;
|
||||||
console.log("Event id:", event.target.id);
|
console.log("Event id:", event.target.id);
|
||||||
|
|
||||||
|
let policy_type_id = parseInt($('#policy_type_id').val());
|
||||||
|
console.log('policy_type_id', policy_type_id);
|
||||||
|
|
||||||
let cgst = parseFloat($('#cgst_' + input).val());
|
let cgst = parseFloat($('#cgst_' + input).val());
|
||||||
let sgst = parseFloat($('#sgst_' + input).val());
|
let sgst = parseFloat($('#sgst_' + input).val());
|
||||||
let igst = parseFloat($('#igst_' + input).val());
|
let igst = parseFloat($('#igst_' + input).val());
|
||||||
|
|
||||||
|
// ✅ Allow 0 only for policy types 2, 5, 7
|
||||||
|
const allowZero = [1,2,3,4,5,6,7,38,39,40].includes(policy_type_id);
|
||||||
|
console.log("allowZero", allowZero);
|
||||||
|
|
||||||
|
// 🔒 Validation: Disallow 0 or negative values for other policy types
|
||||||
|
if (!allowZero) {
|
||||||
|
if ((cgst <= 0 && (event.target.id).startsWith('cgst')) ||
|
||||||
|
(sgst <= 0 && (event.target.id).startsWith('sgst')) ||
|
||||||
|
(igst <= 0 && (event.target.id).startsWith('igst'))) {
|
||||||
|
|
||||||
|
toastr.warning('Tax value must be greater than 0 for this policy type.');
|
||||||
|
$('#'+ event.target.id).val('');
|
||||||
|
$('#igst_' + input).val('');
|
||||||
|
$('#cgst_' + input).val('');
|
||||||
|
$('#sgst_' + input).val('');
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (((event.target.id).startsWith('cgst'))) {
|
if (((event.target.id).startsWith('cgst'))) {
|
||||||
|
|
||||||
if (!isFinite(cgst) || isNaN(cgst) || cgst === undefined) {
|
if (!isFinite(cgst) || isNaN(cgst) || cgst === undefined) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user