From 2d3326c68a87a6bc88b0d5092e4eaa11853e3f80 Mon Sep 17 00:00:00 2001 From: rmroot Date: Mon, 25 Nov 2024 09:24:03 -0600 Subject: [PATCH 1/2] update % change calculation to calculate based on units if no cost --- .../calculations/keyPerformanceIndicatorReport.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/app/shared/reports/calculations/keyPerformanceIndicatorReport.ts b/src/app/shared/reports/calculations/keyPerformanceIndicatorReport.ts index 095c3303..4e90c1e7 100644 --- a/src/app/shared/reports/calculations/keyPerformanceIndicatorReport.ts +++ b/src/app/shared/reports/calculations/keyPerformanceIndicatorReport.ts @@ -27,16 +27,26 @@ export function getKeyPerfomanceIndicatorReport(nebReports: Array): K } if (kpiReportItems[itemExistIndex].keyPerformanceMetric.baselineCost) { kpiReportItems[itemExistIndex].performanceMetricImpact.percentSavings = (kpiReportItems[itemExistIndex].performanceMetricImpact.costAdjustment / kpiReportItems[itemExistIndex].keyPerformanceMetric.baselineCost) * 100; + } else if (kpiReportItems[itemExistIndex].keyPerformanceMetric.baselineValue && kpiReportItems[itemExistIndex].performanceMetricImpact.modificationValue) { + kpiReportItems[itemExistIndex].performanceMetricImpact.percentSavings = (kpiReportItems[itemExistIndex].performanceMetricImpact.modificationValue / kpiReportItems[itemExistIndex].keyPerformanceMetric.baselineValue) * 100; } } else { if (performanceMetric.keyPerformanceMetric.isCustom) { } + let percentSavings: number = 0; + + if (performanceMetric.keyPerformanceMetric.baselineCost) { + percentSavings = (performanceMetric.performanceMetricImpact.costAdjustment / performanceMetric.keyPerformanceMetric.baselineCost) * 100; + } else if (performanceMetric.keyPerformanceMetric.baselineValue && performanceMetric.performanceMetricImpact.modificationValue) { + percentSavings = (performanceMetric.performanceMetricImpact.modificationValue / performanceMetric.keyPerformanceMetric.baselineValue) * 100; + } + kpiReportItems.push({ keyPerformanceMetric: performanceMetric.keyPerformanceMetric, performanceMetricImpact: { ...performanceMetric.performanceMetricImpact, - percentSavings: (performanceMetric.performanceMetricImpact.costAdjustment / performanceMetric.keyPerformanceMetric.baselineCost) * 100, + percentSavings: percentSavings, modifiedCost: (performanceMetric.keyPerformanceMetric.baselineCost - performanceMetric.performanceMetricImpact.costAdjustment) }, // nebsImpacts: [{ From 84d26c1319df02199f80470605949cdd80400486 Mon Sep 17 00:00:00 2001 From: rmroot Date: Mon, 25 Nov 2024 09:46:00 -0600 Subject: [PATCH 2/2] update totals line label in table --- .../performance-metrics-table.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/shared/reports/performance-metrics-table/performance-metrics-table.component.html b/src/app/shared/reports/performance-metrics-table/performance-metrics-table.component.html index 4f1dd734..93ab2c98 100644 --- a/src/app/shared/reports/performance-metrics-table/performance-metrics-table.component.html +++ b/src/app/shared/reports/performance-metrics-table/performance-metrics-table.component.html @@ -65,7 +65,7 @@ - Totals + Cost Totals