Skip to content

Commit

Permalink
added logic for overhead and CM expense items to remove all budget co…
Browse files Browse the repository at this point in the history
…lumns
  • Loading branch information
npham49 committed Oct 30, 2024
1 parent a3eaea2 commit b3a63d7
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 46 deletions.
3 changes: 0 additions & 3 deletions server/api/utils/constants.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export default {
CHC: {
sheetId: 1,
fiscalYear: "B",
periodReported: "C",
healthAuthority: "D",
Expand Down Expand Up @@ -39,7 +38,6 @@ export default {
reasonForExceptionInPeriodReported: "AK",
},
PCN: {
sheetId: 2,
fiscalYear: "B",
periodReported: "C",
healthAuthority: "D",
Expand Down Expand Up @@ -83,7 +81,6 @@ export default {
reasonForExceptionInPeriodReported: "AP",
},
UPCC: {
sheetId: 3,
fiscalYear: "B",
periodReported: "C",
healthAuthority: "D",
Expand Down
104 changes: 61 additions & 43 deletions server/api/utils/worksheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default {
String(index)
)
.value(formatValue(item.submissionInformation.communityName));
if (initiative === "upcc" || initiative === "chc") {
if (initiative !== "pcn") {
worksheet
.cell(
(initiative === "upcc"
Expand Down Expand Up @@ -211,7 +211,7 @@ export default {
String(index)
)
.value(formatValue(item.submissionInformation.communityName));
if (initiative === "upcc" || initiative === "chc") {
if (initiative !== "pcn") {
worksheet
.cell(
(initiative === "upcc"
Expand Down Expand Up @@ -394,53 +394,71 @@ export default {
}

// PCN specific fields
if (initiative === "pcn") {
worksheet
.cell(constants.PCN.approved4YearFtEs + String(index))
.value(formatValue(item.budget.approved4YearFtEs));
worksheet
.cell(constants.PCN.annualBudget + String(index))
.value(formatValue(item.budget.annualBudget));
} else {
worksheet
.cell(
constants[initiative.toUpperCase() as "UPCC" | "CHC" | "NPPCC"]
.approvedFtes + String(index)
)
.value(
formatValue(item.budget.approvedFtes) ||
formatValue(item.budget.approvedFtesInclRelief)
);
if (
formatValue(report.expenseSubCategory) !== "Overhead" &&
formatValue(report.expenseItem) !== "Change Management"
) {
if (initiative === "pcn") {
worksheet
.cell(constants.PCN.approved4YearFtEs + String(index))
.value(formatValue(item.budget.approved4YearFtEs));
worksheet
.cell(constants.PCN.annualBudget + String(index))
.value(formatValue(item.budget.annualBudget));
} else {
worksheet
.cell(
constants[
initiative.toUpperCase() as "UPCC" | "CHC" | "NPPCC"
].approvedFtes + String(index)
)
.value(
formatValue(item.budget.approvedFtes) ||
formatValue(item.budget.approvedFtesInclRelief)
);
worksheet
.cell(
constants[
initiative.toUpperCase() as "UPCC" | "CHC" | "NPPCC"
].approvedBudget + String(index)
)
.value(formatValue(item.budget.approvedBudget));
}
}

if (
formatValue(report.expenseSubCategory) !== "Overhead" &&
formatValue(report.expenseItem) !== "Change Management"
) {
worksheet
.cell(
constants[initiative.toUpperCase() as "UPCC" | "CHC" | "NPPCC"]
.approvedBudget + String(index)
constants[initiative.toUpperCase() as Initiative]
.approvedAttachmentTarget + String(index)
)
.value(formatValue(item.budget.approvedBudget));
.value(formatValue(item.budget.approvedAttachmentTarget));
}
worksheet
.cell(
constants[initiative.toUpperCase() as Initiative]
.approvedAttachmentTarget + String(index)
)
.value(formatValue(item.budget.approvedAttachmentTarget));

if (initiative === "pcn") {
worksheet
.cell(constants.PCN.fiscalYearAllocation + String(index))
.value(
formatValue(
!!item.budget.fiscalYearAllocation
? Number(item.budget.fiscalYearAllocation) / 100
: null
)
);
worksheet
.cell(constants.PCN.ftesInclRelief + String(index))
.value(formatValue(item.budget.ftesInclRelief));
worksheet
.cell(constants.PCN.totalBudgetAllocation + String(index))
.value(formatValue(item.budget.totalBudgetAllocation));
if (
formatValue(report.expenseSubCategory) !== "Overhead" &&
formatValue(report.expenseItem) !== "Change Management"
) {
worksheet
.cell(constants.PCN.fiscalYearAllocation + String(index))
.value(
formatValue(
!!item.budget.fiscalYearAllocation
? Number(item.budget.fiscalYearAllocation) / 100
: null
)
);
worksheet
.cell(constants.PCN.ftesInclRelief + String(index))
.value(formatValue(item.budget.ftesInclRelief));
worksheet
.cell(constants.PCN.totalBudgetAllocation + String(index))
.value(formatValue(item.budget.totalBudgetAllocation));
}

// Needs clarification on the following fields
worksheet
Expand Down

0 comments on commit b3a63d7

Please sign in to comment.