Browse Source

updated file

master
yoganandhan 2 years ago
parent
commit
1014033c15
  1. 18
      backend/pensioner/service/DepartmentReceivedService.java
  2. 69
      frontend/pensioner/department/newentry/pendency.html
  3. 4
      frontend/pensioner/department/newentry/provisionalretirement.html

18
backend/pensioner/service/DepartmentReceivedService.java

@ -88,9 +88,17 @@ public class DepartmentReceivedService {
boolean check = checkTempPresent(tempId); boolean check = checkTempPresent(tempId);
if (check) {
String updateQuery1 = "UPDATE pension_benefits SET file_pending = ?, pension_number = ?, ledger_number = ?, benefit_pension = ?, benefit_pension_amount = ?, benefit_dcrg = ?, benefit_dcrg_amount = ?, benefit_commutation = ?, benefit_commutation_amount = ?, updated_date = CURRENT_TIMESTAMP WHERE temp_id = ?";
int rowsUpdated3 = jdbcTemplate.update(updateQuery1, file_pending, pension_number, ledger_number, benefit_pension, benefit_pension_amount, benefit_dcrg, benefit_dcrg_amount, benefit_commutation, benefit_commutation_amount, tempId);
} else {
String benefitQuery = "INSERT INTO pension_benefits (emp_no, temp_id, file_pending, pension_number, ledger_number, benefit_pension, benefit_pension_amount, benefit_dcrg, benefit_dcrg_amount, benefit_commutation, benefit_commutation_amount) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
int rowsUpdated2 = jdbcTemplate.update(benefitQuery, empNo, tempId, file_pending, pension_number, ledger_number, benefit_pension, benefit_pension_amount, benefit_dcrg, benefit_dcrg_amount, benefit_commutation, benefit_commutation_amount);
}
if ("yes".equalsIgnoreCase(benefit_dcrg)) { if ("yes".equalsIgnoreCase(benefit_dcrg)) {
// filestatus = CheckFieldsInDept(tempId) ? 11 : 9; //noted
filestatus = CheckFieldsInDept(tempId) ? (CheckFieldsInPensioner(tempId) ? getFileStatus.getFileStatus11Id() : getFileStatus.getFileStatus10Id() ) : getFileStatus.getFileStatus9Id(); filestatus = CheckFieldsInDept(tempId) ? (CheckFieldsInPensioner(tempId) ? getFileStatus.getFileStatus11Id() : getFileStatus.getFileStatus10Id() ) : getFileStatus.getFileStatus9Id();
@ -124,13 +132,7 @@ public class DepartmentReceivedService {
int rowsUpdated1 = jdbcTemplate.update(historyQuery, empNo, dateToAudit, filestatus, filemovedby, remarks, tempId); int rowsUpdated1 = jdbcTemplate.update(historyQuery, empNo, dateToAudit, filestatus, filemovedby, remarks, tempId);
if (rowsUpdated1 > 0) { if (rowsUpdated1 > 0) {
if (check) {
String updateQuery1 = "UPDATE pension_benefits SET file_pending = ?, pension_number = ?, ledger_number = ?, benefit_pension = ?, benefit_pension_amount = ?, benefit_dcrg = ?, benefit_dcrg_amount = ?, benefit_commutation = ?, benefit_commutation_amount = ?, updated_date = CURRENT_TIMESTAMP WHERE temp_id = ?";
int rowsUpdated3 = jdbcTemplate.update(updateQuery1, file_pending, pension_number, ledger_number, benefit_pension, benefit_pension_amount, benefit_dcrg, benefit_dcrg_amount, benefit_commutation, benefit_commutation_amount, tempId);
} else {
String benefitQuery = "INSERT INTO pension_benefits (emp_no, temp_id, file_pending, pension_number, ledger_number, benefit_pension, benefit_pension_amount, benefit_dcrg, benefit_dcrg_amount, benefit_commutation, benefit_commutation_amount) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
int rowsUpdated2 = jdbcTemplate.update(benefitQuery, empNo, tempId, file_pending, pension_number, ledger_number, benefit_pension, benefit_pension_amount, benefit_dcrg, benefit_dcrg_amount, benefit_commutation, benefit_commutation_amount);
}
return true; return true;
} }
} }

69
frontend/pensioner/department/newentry/pendency.html

@ -261,8 +261,9 @@ padding-top: 2%;
<label for="no" class="form-check-label">No</label> <label for="no" class="form-check-label">No</label>
</div> </div>
</div> </div>
<div class="dropdown" id="pendingDurationInputContainer" style="display: none; margin-top: 10px;">
<input type="text" id="pendingDurationInput" name="pendingDurationValue" class="form-control" placeholder="Enter details for pending duration">
<div id="clickyesdiv" style="display: none; margin-top: 10px;">
<label for="clickyes" class="form-label">Please specify:<span class="text-danger">*</span></label>
<input type="text" id="Clickyes" class="form-control" placeholder="Enter reason">
</div> </div>
</div> </div>
</div> </div>
@ -362,7 +363,7 @@ $(document).ready(function (){
$('#pendingDurationInput').val(''); $('#pendingDurationInput').val('');
$('#remarks').val(''); $('#remarks').val('');
$('input[name="pendingDuration"]').prop('checked', false); $('input[name="pendingDuration"]').prop('checked', false);
document.getElementById("pendingDurationInputContainer").style.display = "none";
// STEP 1: Check if the employee already exists in the database. // STEP 1: Check if the employee already exists in the database.
$.ajax({ $.ajax({
@ -468,6 +469,34 @@ $(document).ready(function (){
return; return;
} }
// Function to handle radio button state based on retirement date
function handlePendingDurationState() {
const currentDate = new Date().toISOString().split('T')[0]; // Get today's date in YYYY-MM-DD format
const retirementDate = employeeDetails.RETIREMENT_DATE; // Assuming this comes in YYYY-MM-DD format
const yesRadio = document.getElementById("yes");
const noRadio = document.getElementById("no");
const inputFieldDiv = document.getElementById('clickyesdiv');
if (retirementDate <= currentDate) {
// If retirement date is less than or equal to current date, disable 'Yes' option
yesRadio.checked = true;
inputFieldDiv.style.display = 'block';
noRadio.disabled = true; // Default to 'No'
} else {
// If retirement date is greater than current date, disable 'No' option
noRadio.checked = true;
yesRadio.disabled = true; // Default to 'Yes'
}
}
// Call the function after fetching `employeeDetails`
handlePendingDurationState();
// Populate the form fields with the fetched employee details. // Populate the form fields with the fetched employee details.
$('#employeeno').val(employeeDetails.EMPLOYEE_CODE); $('#employeeno').val(employeeDetails.EMPLOYEE_CODE);
$('#employeename').val(employeeDetails.EMPLOYEE_NAME); $('#employeename').val(employeeDetails.EMPLOYEE_NAME);
@ -631,21 +660,21 @@ $(document).ready(function (){
function saveEntryDetails() { function saveEntryDetails() {
let pendingDuration= $('input[name="pendingDuration"]:checked').val();
let pendingDurationReason=null;
if (pendingDuration === 'yes' ) {
pendingDurationReason = $('#pendingDurationInput').val(); // Retrieve the amount if available, else null
if (!pendingDurationReason) {
Swal.fire({
icon: 'warning',
title: 'Validation Error',
text: 'Please Enter Pending Reason',
confirmButtonText: 'OK'
});
return; // Stop further execution if validation fails
}
}
let selectedPendingDurationValue = $('input[name="pendingDuration"]:checked').val();
let selectedReasonValue = $('#reason').val();
// Check for "Yes" in Pending Duration
if (selectedPendingDurationValue === 'yes') {
selectedReasonPending = $('#Clickyes').val()?.trim() || null;
if (!selectedReasonPending) {
Swal.fire({
icon: 'warning',
title: 'Validation Error',
text: 'Please specify the reason for selecting "Yes" for Pending Duration.',
confirmButtonText: 'OK'
});
return;
}
}
//pendencyCategory:$('#typeofcategory').val(), //pendencyCategory:$('#typeofcategory').val(),
@ -658,8 +687,8 @@ $(document).ready(function (){
retirementclass: $('#classes').val(), retirementclass: $('#classes').val(),
typeOfRetirement: $('#retirement').val(), typeOfRetirement: $('#retirement').val(),
retirementDate:$('#retirementdate').val(), retirementDate:$('#retirementdate').val(),
pendingDuration: pendingDuration,
reasonPending: pendingDurationReason,
pendingDuration: selectedPendingDurationValue,
reasonPending: selectedReasonPending || null,
dateToAudit: convertDateFormat($('#filesentdate').val()?.trim()), dateToAudit: convertDateFormat($('#filesentdate').val()?.trim()),
remarks: $('#remarks').val(), remarks: $('#remarks').val(),
deptId:$('#deptId').text().trim(), deptId:$('#deptId').text().trim(),

4
frontend/pensioner/department/newentry/provisionalretirement.html

@ -277,11 +277,11 @@ padding-top: 2%;
<div class="d-flex align-items-center"> <div class="d-flex align-items-center">
<div class="form-check" style="padding-right:10px;"> <div class="form-check" style="padding-right:10px;">
<input type="radio" id="yespen" name="pendingDuration" value="Yes" class="form-check-input" onclick="toggleInputField(this)"> <input type="radio" id="yespen" name="pendingDuration" value="Yes" class="form-check-input" onclick="toggleInputField(this)">
<label for="yespen" class="form-check-label">yes</label>
<label for="yespen" class="form-check-label">Yes</label>
</div> </div>
<div class="form-check"> <div class="form-check">
<input type="radio" id="nopen" name="pendingDuration" value="No" class="form-check-input" onclick="toggleInputField(this)"> <input type="radio" id="nopen" name="pendingDuration" value="No" class="form-check-input" onclick="toggleInputField(this)">
<label for="nopen" class="form-check-label">no</label>
<label for="nopen" class="form-check-label">No</label>
</div> </div>
</div> </div>
<div id="clickyesdiv" style="display: none; margin-top: 10px;"> <div id="clickyesdiv" style="display: none; margin-top: 10px;">

Loading…
Cancel
Save