Browse Source

updated files

master
yoganandhan 2 years ago
parent
commit
5f4c27bda8
  1. 2
      backend/pensioner/controller/NewEntryAPIController.java
  2. 26
      backend/pensioner/service/NewEntryService.java
  3. 91
      backend/pensioner/service/ReportApiService.java
  4. 15
      frontend/pensioner/department/completed/gis.html
  5. 26
      frontend/pensioner/department/newentry/gis.html
  6. 15
      frontend/pensioner/pensioner/completed/gis.html
  7. 20
      frontend/pensioner/pensioner/received/gis.html
  8. 48
      frontend/pensioner/pensioner/reports.html

2
backend/pensioner/controller/NewEntryAPIController.java

@ -110,7 +110,7 @@ public class NewEntryAPIController {
Map<String, Object> datalist = newEntryService.fetchEmplyeeDetails(formattedFromDate, formattedToDate, deptId);
System.out.println("datalist="+datalist);
List<String> emps= newEntryService.getRegisteredEmps(deptId,file_category);
List<String> emps= newEntryService.getRegisteredEmps(deptId);
// Format the dates for frontend in "yyyy-MM-dd"
DateTimeFormatter frontendFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");

26
backend/pensioner/service/NewEntryService.java

@ -428,8 +428,21 @@ public class NewEntryService {
}
public List<String> getRegisteredEmps(Integer deptId, Integer file_category) {
String query = "SELECT DISTINCT emp_no FROM pensioner_details WHERE dept_id=? " +
// public List<String> getRegisteredEmps(Integer deptId) {
// String query = "SELECT DISTINCT emp_no FROM pensioner_details WHERE dept_id=? AND file_category <> 5 " +
// "UNION ALL " +
// "SELECT DISTINCT emp_no FROM cps_pensioner_details WHERE dept_id=?";
//
// List<String> emps = jdbcTemplate.queryForList(query, String.class, deptId, deptId);
// System.out.println("emps====" + emps);
//
// return emps;
// }
public List<String> getRegisteredEmps(Integer deptId) {
String query = "SELECT DISTINCT emp_no FROM pensioner_details " +
"WHERE dept_id=? AND (file_category <> 5 OR (file_category = 5 AND file_status != 11)) " +
"UNION ALL " +
"SELECT DISTINCT emp_no FROM cps_pensioner_details WHERE dept_id=?";
@ -439,6 +452,7 @@ public class NewEntryService {
return emps;
}
public Integer getRetirementFileCategoryId() {
String query = "SELECT id FROM file_category_master WHERE file_name = 'Retirement'";
try {
@ -476,7 +490,7 @@ public class NewEntryService {
}
public Integer getPRFileCategoryId() {
String query = "SELECT id FROM file_category_master WHERE file_name = 'Provisional Retirement'";
String query = "SELECT id FROM file_category_master WHERE file_name = 'Provisional Pension'";
try {
return jdbcTemplate.queryForObject(query, Integer.class);
} catch (EmptyResultDataAccessException e) {
@ -573,9 +587,9 @@ public class NewEntryService {
String remarks = (String) requestData.get("remarks");
String serviceDeath =(String) requestData.get("serviceDeath");
String deceased =(String) requestData.get("deceased");
String gisentry = (String) requestData.get("gisentry");
String gisAdvanceamount =(String) requestData.get("gisAdvanceamount");
String gisAdvance = (String) requestData.get("gisAdvance");
String gisentry = requestData.get("gisentry") != null ?(String) requestData.get("gisentry") : null;
String gisAdvanceamount =requestData.get("gisAdvanceamount") != null ?(String) requestData.get("gisAdvanceamount") : null;
String gisAdvance = requestData.get("gisAdvance") != null ? (String) requestData.get("gisAdvance") : null;
String dept_Id = (String) requestData.get("deptId");
int deptId = Integer.parseInt(dept_Id);

91
backend/pensioner/service/ReportApiService.java

@ -445,14 +445,76 @@ public class ReportApiService {
// public List<Map<String, Object>> getReportDetailspension(String startDate, String endDate, List<String> deptIds, Integer fileCatId, List<String> fileStatus) {
// String sql = "";
// List<Object> params = new ArrayList<>();
//
// boolean selectAll = deptIds.contains("ALL");
//
// // ✅ If "ALL" is selected, remove department filtering
// String deptCondition = selectAll ? "1=1" : "pd.dept_id IN (" + String.join(",", Collections.nCopies(deptIds.size(), "?")) + ")";
//
// // ✅ Handle fileStatus as multiple values in IN clause
// String fileStatusCondition = (fileStatus != null && !fileStatus.isEmpty())
// ? " AND pd.file_status IN (" + String.join(",", Collections.nCopies(fileStatus.size(), "?")) + ")"
// : ""; // Skip condition if fileStatus is empty or null
//
// if (fileCatId == 6) {
// sql = "SELECT pd.emp_no, pd.emp_name, pd.designation, pd.type_of_retirement, pd.reason_for_pending,pd.retirement_date, " +
// "fm.file_status AS fst, pd.file_category_name, pd.remarks, DATE(pd.created_date) AS created_date " +
// "FROM cps_pensioner_details pd " +
// "INNER JOIN file_status_master fm ON pd.file_status = fm.id " +
// "WHERE DATE(pd.created_date) BETWEEN DATE(?) AND DATE(?) " + // First: Date filter
// "AND pd.file_category = ? " + // Second: File category filter
// "AND " + deptCondition + // Third: Department condition
// fileStatusCondition; // Last: File status condition
//
// } else {
// sql = "SELECT pd.*, fm.file_status as fst " +
// "FROM pensioner_details pd " +
// "INNER JOIN file_status_master fm ON pd.file_status = fm.id " +
// "WHERE DATE(pd.created_date) BETWEEN DATE(?) AND DATE(?) " + // First: Date filter
// "AND pd.file_category = ? " + // Second: File category filter
// "AND " + deptCondition + // Third: Department condition
// fileStatusCondition; // Last: File status condition
// }
//
// // Add date range parameters first
// params.add(startDate);
// params.add(endDate);
//
// // Add file category next
// params.add(fileCatId);
//
// // Add department filter parameters if not "ALL"
// if (!selectAll) {
// params.addAll(deptIds);
// }
//
// // Add fileStatus parameters if present
// if (fileStatus != null && !fileStatus.isEmpty()) {
// params.addAll(fileStatus);
// }
//
// System.out.println("Executing SQL Query: " + sql);
// System.out.println("Query Parameters: " + params);
//
// return jdbcTemplate.queryForList(sql, params.toArray());
// }
public List<Map<String, Object>> getReportDetailspension(String startDate, String endDate, List<String> deptIds, Integer fileCatId, List<String> fileStatus) {
String sql = "";
List<Object> params = new ArrayList<>();
boolean selectAll = deptIds.contains("ALL");
// ✅ Ensure deptIds is never empty, otherwise fetch nothing
if (deptIds == null || deptIds.isEmpty()) {
return new ArrayList<>();
}
// ✅ If "ALL" is selected, remove department filtering
String deptCondition = selectAll ? "1=1" : "pd.dept_id IN (" + String.join(",", Collections.nCopies(deptIds.size(), "?")) + ")";
// ✅ Construct IN clause for department filtering
String deptCondition = "pd.dept_id IN (" + String.join(",", Collections.nCopies(deptIds.size(), "?")) + ")";
// ✅ Handle fileStatus as multiple values in IN clause
String fileStatusCondition = (fileStatus != null && !fileStatus.isEmpty())
@ -460,23 +522,23 @@ public class ReportApiService {
: ""; // Skip condition if fileStatus is empty or null
if (fileCatId == 6) {
sql = "SELECT pd.emp_no, pd.emp_name, pd.designation, pd.type_of_retirement, pd.reason_for_pending,pd.retirement_date, " +
sql = "SELECT pd.emp_no, pd.emp_name, pd.designation, pd.type_of_retirement, pd.reason_for_pending, pd.retirement_date, " +
"fm.file_status AS fst, pd.file_category_name, pd.remarks, DATE(pd.created_date) AS created_date " +
"FROM cps_pensioner_details pd " +
"INNER JOIN file_status_master fm ON pd.file_status = fm.id " +
"WHERE DATE(pd.created_date) BETWEEN DATE(?) AND DATE(?) " + // First: Date filter
"AND pd.file_category = ? " + // Second: File category filter
"AND " + deptCondition + // Third: Department condition
fileStatusCondition; // Last: File status condition
"WHERE DATE(pd.created_date) BETWEEN DATE(?) AND DATE(?) " +
"AND pd.file_category = ? " +
"AND " + deptCondition +
fileStatusCondition;
} else {
sql = "SELECT pd.*, fm.file_status as fst " +
"FROM pensioner_details pd " +
"INNER JOIN file_status_master fm ON pd.file_status = fm.id " +
"WHERE DATE(pd.created_date) BETWEEN DATE(?) AND DATE(?) " + // First: Date filter
"AND pd.file_category = ? " + // Second: File category filter
"AND " + deptCondition + // Third: Department condition
fileStatusCondition; // Last: File status condition
"WHERE DATE(pd.created_date) BETWEEN DATE(?) AND DATE(?) " +
"AND pd.file_category = ? " +
"AND " + deptCondition +
fileStatusCondition;
}
// Add date range parameters first
@ -486,10 +548,8 @@ public class ReportApiService {
// Add file category next
params.add(fileCatId);
// Add department filter parameters if not "ALL"
if (!selectAll) {
// Add department filter parameters
params.addAll(deptIds);
}
// Add fileStatus parameters if present
if (fileStatus != null && !fileStatus.isEmpty()) {
@ -504,7 +564,6 @@ public class ReportApiService {
public List<Map<String, Object>> getDepartmentpending(int file_category) {
String sql = "SELECT dept_name, emp_name, emp_no, file_category_name, file_status, file_moved_date, remarks " +

15
frontend/pensioner/department/completed/gis.html

@ -248,6 +248,7 @@ margin-top: 10px;
<input type="text" id="classes" class="form-control" readonly>
</div>
<div class="row col-md-12" id="gisentrycontainer" style="display: none;padding-left: 0px;padding-right: 0px;margin-left: 3px;">
<div class="col-md-6">
<label for="gisentry" class="form-label fw-bold">GIS Entry Type</label>
<input type="text" id="gisentry" class="form-control" readonly>
@ -275,6 +276,8 @@ margin-top: 10px;
</div>
</div>
</div>
<div class="col-md-6">
@ -392,7 +395,7 @@ margin-top: 10px;
$('#employeename').val(employeeDetails.emp_name);
$('#department').val(employeeDetails.dept_name);
$('#designation').val(employeeDetails.designation);
$('#gisentry').val(employeeDetails.gis_entry);
$('#classes').val(employeeDetails.relationship_deceased);
$('#datefile_modal').val(employeeDetails.file_moved_date);
@ -409,6 +412,12 @@ margin-top: 10px;
gisAmountInput */
// Populate gis advance Section based on response or data
if(employeeDetails.gis_entry!=null && employeeDetails.gis_advance!=null){
$('#gisentrycontainer').show();
$('#gisentry').val(employeeDetails.gis_entry);
// Populate gis advance Section based on response or data
if (employeeDetails.gis_advance === "yes") {
$('#gisyes').prop('checked', true); // Check Yes radio button
@ -420,6 +429,10 @@ margin-top: 10px;
$('#gisyes').prop('disabled', true); // Disable Yes radio button
$('#gisAmountInputContainer').hide(); // Hide CPS amount input field
}
}
else{
$('#gisentrycontainer').hide();
}
// Update the modal title with the employee code
$('#modalEmployeeCode').text(employeeDetails.emp_no);

26
frontend/pensioner/department/newentry/gis.html

@ -274,6 +274,7 @@ input.form-control {
</div>
<div class="row col-md-12" id="tempcontainer" style="display: none;">
<div class="col-md-6">
<label for="gisentry" class="form-label fw-bold">GIS Entry Type<span class="text-danger">*</span></label>
<select id="gisentry" class="form-select" style="width: 100%;" required>
@ -309,6 +310,9 @@ input.form-control {
</div>
</div>
</div>
<div class="col-md-6">
<label for="filesentdate" class="form-label fw-bold"> File Sent to GD Pension Section On<span class="text-danger">*</span></label>
@ -426,6 +430,8 @@ document.addEventListener("DOMContentLoaded", function () {
$(document).ready(function () {
$('#addNewbutton').on('click', function () {
$('#empCode').val('');
// Show the staff type container
$('#staffTypeContainer').show();
$('#employeeCard').hide();
@ -440,6 +446,8 @@ document.addEventListener("DOMContentLoaded", function () {
// Show the employee card
$('#employeeCard').show();
$('#tempcontainer').hide();
// Pre-fill "GIS" in Employee No and enforce rules
$('#employeeno')
.val('GIS') // Pre-fill with "GIS"
@ -536,6 +544,7 @@ document.addEventListener("DOMContentLoaded", function () {
$('#employeeCard').hide();
$('#newemployeeCard').hide();
$('#gisAmountInput').val('');
$('#tempcontainer').show();
$('input[name="gisamount"]').prop('checked', false);
@ -712,6 +721,8 @@ document.addEventListener("DOMContentLoaded", function () {
function saveEntryDetailsnew() {
const selectedstaffType = $('input[name="staffType"]:checked').val();
console.log("selectedstaffType====="+selectedstaffType);
let selgisamount = $('input[name="gisamount"]:checked').val();
let selgismamountval = null;
@ -738,10 +749,9 @@ document.addEventListener("DOMContentLoaded", function () {
serviceDeath: $('#servicedeath').val(),
dateToPension: convertDateFormat($('#filesentdate').val()?.trim()),
deceased: $('#deceased').val(),
gisentry: $('#gisentry').val(),
//funeralAdvance: $('#funeraladvance').val(),
gisAdvanceamount : selgismamountval,
gisAdvance : selgisamount,
gisentry: $('#gisentry').val() || null,
gisAdvanceamount : selgismamountval || null,
gisAdvance : selgisamount || null,
remarks: $('#remarks').val(),
deptId: $('#deptId').text().trim(),
filemovedby: $('#userId').text().trim(),
@ -802,7 +812,9 @@ document.addEventListener("DOMContentLoaded", function () {
return;
}
if (!entryDetails.gisentry) {
if (selectedstaffType !== 'temporary'){
if (!entryDetails.gisentry || entryDetails.gisentry.trim() === '') {
Swal.fire({
icon: 'warning',
title: 'Validation Error!',
@ -812,7 +824,7 @@ document.addEventListener("DOMContentLoaded", function () {
return;
}
if (!entryDetails.gisAdvance) {
if (!entryDetails.gisAdvance || entryDetails.gisAdvance.trim() === '') {
Swal.fire({
icon: 'warning',
title: 'Validation Error!',
@ -822,6 +834,8 @@ document.addEventListener("DOMContentLoaded", function () {
return;
}
}
if (!entryDetails.remarks) {
Swal.fire({
icon: 'warning',

15
frontend/pensioner/pensioner/completed/gis.html

@ -247,6 +247,7 @@ margin-top: 10px;
<input type="text" id="classes" class="form-control" readonly>
</div>
<div class="row col-md-12" id="gisentrycontainer" style="display: none;padding-left: 0px;padding-right: 0px;margin-left: 3px;">
<div class="col-md-6">
<label for="gisentry" class="form-label fw-bold">GIS Entry Type</label>
<input type="text" id="gisentry" class="form-control" readonly>
@ -274,6 +275,8 @@ margin-top: 10px;
</div>
</div>
</div>
<div class="col-md-6">
@ -391,7 +394,7 @@ margin-top: 10px;
$('#employeename').val(employeeDetails.emp_name);
$('#department').val(employeeDetails.dept_name);
$('#designation').val(employeeDetails.designation);
$('#gisentry').val(employeeDetails.gis_entry);
$('#classes').val(employeeDetails.relationship_deceased);
$('#datefile_modal').val(employeeDetails.file_moved_date);
@ -408,6 +411,12 @@ margin-top: 10px;
gisAmountInput */
// Populate gis advance Section based on response or data
if(employeeDetails.gis_entry!=null && employeeDetails.gis_advance!=null){
$('#gisentrycontainer').show();
$('#gisentry').val(employeeDetails.gis_entry);
// Populate gis advance Section based on response or data
if (employeeDetails.gis_advance === "yes") {
$('#gisyes').prop('checked', true); // Check Yes radio button
@ -419,6 +428,10 @@ margin-top: 10px;
$('#gisyes').prop('disabled', true); // Disable Yes radio button
$('#gisAmountInputContainer').hide(); // Hide CPS amount input field
}
}
else{
$('#gisentrycontainer').hide();
}
// Update the modal title with the employee code
$('#modalEmployeeCode').text(employeeDetails.emp_no);

20
frontend/pensioner/pensioner/received/gis.html

@ -247,12 +247,15 @@ margin-top: 10px;
<input type="text" id="classes" class="form-control" readonly>
</div>
<div class="row col-md-12" id="gisentrycontainer" style="display: none;padding-left: 0px;padding-right: 0px;margin-left: 3px;">
<div class="col-md-6">
<label for="gisentry" class="form-label fw-bold">GIS Entry Type<span class="text-danger">*</span></label>
<label for="gisentry" class="form-label fw-bold">GIS Entry Type</label>
<input type="text" id="gisentry" class="form-control" readonly>
</div>
<!-- Type of Retirement -->
<div class="col-md-6">
<label for="gisamount" class="form-label fw-bold">
Sanctioned GIS Advance
@ -274,6 +277,8 @@ margin-top: 10px;
</div>
</div>
</div>
<!-- Date File Sent to Audit -->
<div class="col-md-6">
<label for="datefile_modal" class="form-label fw-bold">Date File Sent to Pension </label>
@ -444,13 +449,17 @@ margin-top: 10px;
$('#employeename').val(employeeDetails.emp_name);
$('#department').val(employeeDetails.dept_name);
$('#designation').val(employeeDetails.designation);
$('#gisentry').val(employeeDetails.gis_entry);
$('#classes').val(employeeDetails.relationship_deceased);
$('#datefile_modal').val(employeeDetails.file_moved_date);
$('#remarks_modal').val(employeeDetails.remarks);
$('#retirementdate').val(employeeDetails.service_death);
if(employeeDetails.gis_entry!=null && employeeDetails.gis_advance!=null){
$('#gisentrycontainer').show();
$('#gisentry').val(employeeDetails.gis_entry);
// Populate gis advance Section based on response or data
if (employeeDetails.gis_advance === "yes") {
$('#gisyes').prop('checked', true); // Check Yes radio button
@ -462,6 +471,11 @@ margin-top: 10px;
$('#gisyes').prop('disabled', true); // Disable Yes radio button
$('#gisAmountInputContainer').hide(); // Hide CPS amount input field
}
}
else{
$('#gisentrycontainer').hide();
}
// Update the modal title with the employee code
$('#modalEmployeeCode').text(employeeDetails.emp_no);

48
frontend/pensioner/pensioner/reports.html

@ -222,18 +222,11 @@ td, th {
<div class="col-md-3" id="deptDiv" style="display: none;">
<label for="departmentDropdown" class="form-label fw-bold">Department <span class="text-danger">*</span></label>
<!-- Styled Checkbox Container -->
<div class="form-control p-3 border rounded" style="height: 110px; overflow-y: auto; background-color: #f8f9fa;">
<!-- Select All Checkbox -->
<label class="d-block">Select Department
<!-- <input type="checkbox" id="selectAllDept" value="ALL"> <strong>Select All</strong> -->
</label>
<hr> <!-- Separator for better spacing -->
<!-- Departments List (Will be populated dynamically) -->
<hr>
<div id="departmentCheckboxContainer">
<!-- Dynamic Checkboxes will be inserted here -->
</div>
</div>
</div>
@ -541,6 +534,7 @@ td, th {
});
$(document).ready(function () {
function loadDepartments() {
$.ajax({
url: "/getdepartment",
@ -553,7 +547,7 @@ td, th {
// Append "Select All" checkbox
$("#departmentCheckboxContainer").append(`
<label>
<input type="checkbox" id="selectAllDept" value="ALL"> Select All
<input type="checkbox" id="selectAllDept"> Select All
</label><br>
`);
@ -561,17 +555,22 @@ td, th {
response.forEach(dept => {
$("#departmentCheckboxContainer").append(`
<label>
<input type="checkbox" class="deptCheckbox" value="${dept.id}"> ${dept.dept_name}
<input type="checkbox" class="deptCheckbox" value="${dept.dept_id}"> ${dept.dept_name}
</label><br>
`);
});
// Handle "Select All" logic
// Select All logic
$("#selectAllDept").change(function () {
if (this.checked) {
$(".deptCheckbox").prop("checked", false).prop("disabled", true);
$(".deptCheckbox").prop("checked", this.checked); // Check/uncheck all
});
// If any individual checkbox is unchecked, uncheck "Select All"
$(document).on("change", ".deptCheckbox", function () {
if ($(".deptCheckbox:checked").length === $(".deptCheckbox").length) {
$("#selectAllDept").prop("checked", true);
} else {
$(".deptCheckbox").prop("disabled", false);
$("#selectAllDept").prop("checked", false);
}
});
},
@ -1329,20 +1328,6 @@ td, th {
});
// Listen for changes in the Type of Report dropdown
/* $("#typeofreport").change(function () {
let selectedValue = $(this).val();
if (selectedValue === "Detailed") {
$("#categoryDiv").show();
} else {
$("#categoryDiv").hide();
$("#typeofcategory").val("");
$("#statusDiv").show();// Reset category value
}
}); */
$(document).ready(function () {
@ -1454,19 +1439,18 @@ td, th {
console.log("typeOfCategory", typeOfCategory);
// Ensure selectedDeptIds is defined inside the click event
let selectedDeptIds = [];
if ($("#selectAllDept").is(":checked")) {
selectedDeptIds = ["ALL"]; // ✅ Set "ALL" when selected
} else {
$(".deptCheckbox:checked").each(function () {
selectedDeptIds.push($(this).val());
});
}
console.log("Selected Department IDs:", selectedDeptIds);
console.log("statusArray", statusArray);
if (!startDate || !endDate) {
Swal.fire({
icon: "warning",

Loading…
Cancel
Save