From 1014033c15f63965317f0faf098e9abd4ce1a5cf Mon Sep 17 00:00:00 2001 From: yoganandhan Date: Thu, 6 Mar 2025 15:11:49 +0530 Subject: [PATCH] updated file --- .../service/DepartmentReceivedService.java | 20 +++--- .../department/newentry/pendency.html | 69 +++++++++++++------ .../newentry/provisionalretirement.html | 4 +- 3 files changed, 62 insertions(+), 31 deletions(-) diff --git a/backend/pensioner/service/DepartmentReceivedService.java b/backend/pensioner/service/DepartmentReceivedService.java index 26f1867..fbf6b21 100644 --- a/backend/pensioner/service/DepartmentReceivedService.java +++ b/backend/pensioner/service/DepartmentReceivedService.java @@ -87,10 +87,18 @@ public class DepartmentReceivedService { String file_entry_type=""; 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)) { - - // filestatus = CheckFieldsInDept(tempId) ? 11 : 9; //noted + 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); 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; } } diff --git a/frontend/pensioner/department/newentry/pendency.html b/frontend/pensioner/department/newentry/pendency.html index c8a7a8e..a69cb7b 100644 --- a/frontend/pensioner/department/newentry/pendency.html +++ b/frontend/pensioner/department/newentry/pendency.html @@ -261,8 +261,9 @@ padding-top: 2%; - @@ -362,7 +363,7 @@ $(document).ready(function (){ $('#pendingDurationInput').val(''); $('#remarks').val(''); $('input[name="pendingDuration"]').prop('checked', false); - document.getElementById("pendingDurationInputContainer").style.display = "none"; + // STEP 1: Check if the employee already exists in the database. $.ajax({ @@ -467,6 +468,34 @@ $(document).ready(function (){ }); 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. $('#employeeno').val(employeeDetails.EMPLOYEE_CODE); @@ -631,21 +660,21 @@ $(document).ready(function (){ 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(), @@ -658,8 +687,8 @@ $(document).ready(function (){ retirementclass: $('#classes').val(), typeOfRetirement: $('#retirement').val(), retirementDate:$('#retirementdate').val(), - pendingDuration: pendingDuration, - reasonPending: pendingDurationReason, + pendingDuration: selectedPendingDurationValue, + reasonPending: selectedReasonPending || null, dateToAudit: convertDateFormat($('#filesentdate').val()?.trim()), remarks: $('#remarks').val(), deptId:$('#deptId').text().trim(), diff --git a/frontend/pensioner/department/newentry/provisionalretirement.html b/frontend/pensioner/department/newentry/provisionalretirement.html index 647c349..f941cb7 100644 --- a/frontend/pensioner/department/newentry/provisionalretirement.html +++ b/frontend/pensioner/department/newentry/provisionalretirement.html @@ -277,11 +277,11 @@ padding-top: 2%;
- +
- +