Añadir nuevas columnas para generar el reporte de Empleados
Some checks failed
PR Builder / Build-PR (pull_request) Failing after 27s

This commit is contained in:
Melina Gutierrez 2024-11-27 13:26:27 -04:00
parent e38c47c0e7
commit 69ac876d58

View File

@ -56,7 +56,14 @@ public class EmployeesListView extends BaseView {
try (Workbook workbook = new XSSFWorkbook(); ByteArrayOutputStream out = new ByteArrayOutputStream()) {
Sheet sheet = workbook.createSheet("Employees");
Row headerRow = sheet.createRow(0);
String[] headers = {"ID", "First Name", "Last Name", "Status", "Team"};
String[] headers = {
"ID", "Nombres", "Apellidos", "Status", "Genero", "Fecha de Nacimiento", "Edad",
"Ciudad y Pais de Nacimiento", "Dirección de Residencia", "Departamento y Provincia de Residencia", "Marital Status",
"Numero de Hijos", "CI", "Expedido en", "Teléfono", "E-mail",
"Teléfono Laboral", "E-mail Laboral", "Codigo de Empleado", "Cargo",
"Equipo", "Lead/Manager", "Fecha de Ingreso", "Fecha de Retiro", "Tipo de Contrato",
"Otro Tipo de Contrato", "Antiguedad", "Salario Total"
};
for (int i = 0; i < headers.length; i++) {
Cell cell = headerRow.createCell(i);
cell.setCellValue(headers[i]);
@ -73,7 +80,30 @@ public class EmployeesListView extends BaseView {
row.createCell(1).setCellValue(employee.getFirstName());
row.createCell(2).setCellValue(employee.getLastName());
row.createCell(3).setCellValue(employee.getStatus().toString());
row.createCell(4).setCellValue(employee.getTeam().toString());
row.createCell(4).setCellValue(employee.getGender() != null ? employee.getGender().toString() : "");
row.createCell(5).setCellValue(employee.getBirthday() != null ? employee.getBirthday().toString() : "");
row.createCell(6).setCellValue(employee.getAge() != null ? employee.getAge().toString() : "");
row.createCell(7).setCellValue(employee.getBirthCity() != null ? employee.getBirthCity() : "");
row.createCell(8).setCellValue(employee.getResidenceAddress() != null ? employee.getResidenceAddress() : "");
row.createCell(9).setCellValue(employee.getLocalAddress() != null ? employee.getLocalAddress() : "");
row.createCell(10).setCellValue(employee.getMaritalStatus() != null ? employee.getMaritalStatus().toString() : "");
row.createCell(11).setCellValue(employee.getNumberOfChildren() != null ? employee.getNumberOfChildren().toString() : "");
row.createCell(12).setCellValue(employee.getCi() != null ? employee.getCi() : "");
row.createCell(13).setCellValue(employee.getIssuedIn() != null ? employee.getIssuedIn() : "");
row.createCell(14).setCellValue(employee.getPhoneNumber() != null ? employee.getPhoneNumber() : "");
row.createCell(15).setCellValue(employee.getPersonalEmail() != null ? employee.getPersonalEmail() : "");
row.createCell(16).setCellValue(employee.getPhoneNumberProfesional() != null ? employee.getPhoneNumberProfesional() : "");
row.createCell(17).setCellValue(employee.getProfesionalEmail() != null ? employee.getProfesionalEmail() : "");
row.createCell(18).setCellValue(employee.getCod() != null ? employee.getCod() : "");
row.createCell(19).setCellValue(employee.getPosition() != null ? employee.getPosition() : "");
row.createCell(20).setCellValue(employee.getTeam() != null ? employee.getTeam().getName() : "");
row.createCell(21).setCellValue(employee.getLeadManager() != null ? employee.getLeadManager() : "");
row.createCell(22).setCellValue(employee.getDateOfEntry() != null ? employee.getDateOfEntry().toString() : "");
row.createCell(23).setCellValue(employee.getDateOfExit() != null ? employee.getDateOfExit().toString() : "");
row.createCell(24).setCellValue(employee.getContractType() != null ? employee.getContractType().toString() : "");
row.createCell(25).setCellValue(employee.getCustomContractType() != null ? employee.getCustomContractType() : "");
row.createCell(26).setCellValue(employee.getSeniority() != null ? employee.getSeniority() : "");
row.createCell(27).setCellValue(employee.getSalarytotal() != null ? employee.getSalarytotal() : "");
}
workbook.write(out);
return new ByteArrayInputStream(out.toByteArray());
@ -83,6 +113,7 @@ public class EmployeesListView extends BaseView {
}
}
private void configureTable() {
table.setColumns("firstName", "lastName", "status");
addEditButtonColumn("View", this::navigateToEmployeeView);