Assigned Issues fixes

This commit is contained in:
VE10-Sanjeev 2025-05-16 08:55:22 +00:00
parent e092f3967b
commit 8b1502f6be
2 changed files with 43 additions and 27 deletions

View File

@ -73,8 +73,8 @@
<div class="form-group">
<div class="form-group">
<label for="Basic_Pay">No Of Due(s)</label>
<input type="text" value="0" class="form-control requried num"
id="no_of_due" name="no_of_due" value="" pattern="[0-9]{1,2}"
<input type="text" value="0.00" class="form-control requried num"
id="no_of_due" name="no_of_due" pattern="^[1-9][0-9]?$"
title="Minimum 1 digit,Maximum 2 Digit" onchange="duecalculation();">
</div>
</div>
@ -246,33 +246,35 @@
});
function duecalculation() {
var totaldue = 0;
var loan = document.getElementById('Loan_Amount').value;
var no_of_due = document.getElementById('no_of_due').value;
$('#remaining_due').val(no_of_due);
if (loan != 0) {
if (no_of_due == 0) {
alert("Enter No Of Due");
$('#no_of_due').focus();
} else {
totalDueAmt = loan / no_of_due;
document.getElementById('monthly_due').value = Math.ceil(totalDueAmt);
function duecalculation() {
var loan = parseFloat(document.getElementById('Loan_Amount').value);
var no_of_due_raw = document.getElementById('no_of_due').value.trim();
// Validate: not empty and matches 199 (no 0s or more than 2 digits)
if (no_of_due_raw !== '') {
if (!/^(?:[1-9]|[1-9][0-9])$/.test(no_of_due_raw)) {
alert("Please enter a valid Number of Dues (Minimum 1 digit,Maximum 2 Digit).");
document.getElementById('no_of_due').focus();
document.getElementById('no_of_due').value = '';
$('#monthly_due').val('');
$('#remaining_due').val('');
return;
}
}
var no_of_due = parseInt(no_of_due_raw, 10);
$('#remaining_due').val(no_of_due);
if (!isNaN(loan) && loan > 0) {
var totalDueAmt = loan / no_of_due;
document.getElementById('monthly_due').value = Math.ceil(totalDueAmt);
} else {
$('#monthly_due').val('');
}
dateCalulation(); // Update your dates
}
dateCalulation();
}
function dateCalulation() {
//alert('j');

View File

@ -195,7 +195,7 @@ if (!empty($emppay)) {
<div class="form-group">
<div class="form-group">
<label for="Basic_Pay">No Of Due(s)</label>
<input type="text" class="form-control requried num" id="no_of_due" name="no_of_due" value="<?php echo $No_of_dues; ?>" pattern="[0-9]{1,2}" title="Minimum 1 digit,Maximum 2 Digit" onchange="duecalculation();">
<input type="text" class="form-control requried num" id="no_of_due" name="no_of_due" value="<?php echo $No_of_dues; ?>" pattern="^[1-9][0-9]?$" title="Minimum 1 digit,Maximum 2 Digit" onchange="duecalculation();">
</div>
</div>
</div>
@ -440,7 +440,21 @@ if (!empty($emppay)) {
function duecalculation() {
var totaldue = 0;
var loan = document.getElementById('Loan_Amount').value;
var no_of_due = document.getElementById('no_of_due').value;
var no_of_due_raw = document.getElementById('no_of_due').value.trim();
if (no_of_due_raw !== '') {
if (!/^(?:[1-9]|[1-9][0-9])$/.test(no_of_due_raw)) {
alert("Please enter a valid Number of Dues (Minimum 1 digit,Maximum 2 Digit).");
document.getElementById('no_of_due').focus();
document.getElementById('no_of_due').value = '';
$('#monthly_due').val('');
$('#remaining_due').val('');
$('#balance_due_amount').val('');
return;
}
}
var no_of_due = parseInt(no_of_due_raw, 10);
if (loan != 0) {
if (no_of_due == 0) {