Skip to content

Commit

Permalink
add filler columns for easy copy/paste
Browse files Browse the repository at this point in the history
  • Loading branch information
jaroldwong committed Oct 18, 2024
1 parent 32e56f5 commit e245549
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,15 @@ protected void buildExcelDocument(Map<String, Object> 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"));
Expand Down Expand Up @@ -275,14 +283,30 @@ protected void buildExcelDocument(Map<String, Object> model, Workbook workbook,

if(termCodes.contains(expenseItem.getTermCode())){
List<Object> 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);
}
}

}
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/edu/ucdavis/dss/ipa/entities/ExpenseItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit e245549

Please sign in to comment.