From e245549d943a34b465ffec81d0d04bedfbcb001a Mon Sep 17 00:00:00 2001 From: Jarold Wong Date: Thu, 17 Oct 2024 17:01:59 -0700 Subject: [PATCH] add filler columns for easy copy/paste --- .../budget/views/BudgetExcelView.java | 42 +++++++++++++++---- .../ucdavis/dss/ipa/entities/ExpenseItem.java | 16 +++++++ 2 files changed, 49 insertions(+), 9 deletions(-) diff --git a/src/main/java/edu/ucdavis/dss/ipa/api/components/budget/views/BudgetExcelView.java b/src/main/java/edu/ucdavis/dss/ipa/api/components/budget/views/BudgetExcelView.java index 167396d4..da4bb083 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/api/components/budget/views/BudgetExcelView.java +++ b/src/main/java/edu/ucdavis/dss/ipa/api/components/budget/views/BudgetExcelView.java @@ -96,7 +96,15 @@ protected void buildExcelDocument(Map model, Workbook workbook, fundsSheet = ExcelHelper.setSheetHeader(fundsSheet, Arrays.asList("Year", "Department", "Scenario Name", "Term", "Type", "Category", "Description", "Notes", "Comments", "Account Number", "Document Number", "Amount")); Sheet expensesSheet = workbook.createSheet("Other Costs"); - expensesSheet = ExcelHelper.setSheetHeader(expensesSheet, Arrays.asList("Year", "Department", "Scenario Name", "Term", "Type", "Description", "Amount")); + expensesSheet = ExcelHelper.setSheetHeader(expensesSheet, + Arrays.asList("Year", "Department", "Scenario Name", "Term", "", "", "Description", + "", "", "", "", "", "", "", "", + "Instructor Type", + "", "", "", "", "", "", "", + "", // TAs + "", "", "", "", + "Cost" + )); Sheet instructorSalariesSheet = workbook.createSheet("Instructor Salaries"); instructorSalariesSheet = ExcelHelper.setSheetHeader(instructorSalariesSheet, Arrays.asList("Year", "Department", "Instructor", "Type", "Cost")); @@ -275,14 +283,30 @@ protected void buildExcelDocument(Map model, Workbook workbook, if(termCodes.contains(expenseItem.getTermCode())){ List cellValues = Arrays.asList( - year, - budgetScenarioExcelView.getWorkgroup().getName(), - scenarioName, - Term.getRegistrarName(expenseItem.getTermCode()), - expenseItem.getExpenseItemTypeDescription(), - expenseItem.getDescription(), - expenseItem.getAmount()); - expensesSheet = ExcelHelper.writeRowToSheet(expensesSheet, cellValues); + year, + budgetScenarioExcelView.getWorkgroup().getName(), + scenarioName, + Term.getRegistrarName(expenseItem.getTermCode()), + "", "", + expenseItem.getDescription(), + "", "", "", "", "", "", "", "", + expenseItem.getExpenseItemInstructorTypeDescription(), + "", "", "", "", "", "", "", + "", // TAs value + "", // Readers value + "", "", "", + expenseItem.getAmount() + // "", "", "" + ); + + ExcelHelper.writeRowToSheet(expensesSheet, cellValues); + + expensesSheet.setColumnHidden(4, true); + expensesSheet.setColumnHidden(5, true); + for (int colIndex = 7; colIndex < 28; colIndex++) { + if (colIndex == 15) { continue; } // Instructor Type + expensesSheet.setColumnHidden(colIndex, true); + } } } diff --git a/src/main/java/edu/ucdavis/dss/ipa/entities/ExpenseItem.java b/src/main/java/edu/ucdavis/dss/ipa/entities/ExpenseItem.java index 73316410..921f53d7 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/entities/ExpenseItem.java +++ b/src/main/java/edu/ucdavis/dss/ipa/entities/ExpenseItem.java @@ -104,6 +104,22 @@ public String getExpenseItemTypeDescription() { } } + @Transient + public String getExpenseItemInstructorTypeDescription() { + if(expenseItemType != null) { + String instructorType = expenseItemType.getDescription().replace(" Cost", ""); + if (instructorType.contains("Augmentation")) { + return instructorType.replace(" Augmentation", " - Augmentation"); + } else if (instructorType.contains("Emeriti")) { + return instructorType.replace("Emeriti", "Emeriti - Recalled"); + } else { + return instructorType; + } + } else { + return ""; + } + } + @JsonProperty("termDescription") @Transient public String getTermDescription() {