Man hours uses subtotal
CI / build (push) Has been skipped
CI / deploy (push) Successful in 47s

This commit is contained in:
2026-03-18 10:44:13 -05:00
parent a9e0bafef0
commit 716a06ee28
2 changed files with 51 additions and 2 deletions
+8 -2
View File
@@ -12,6 +12,10 @@ export interface ModifierModule {
calculateDisplay?: (modifier: Modifier, subScopeTotalWithMarkup: number, subScopeItems: EstimateItem[]) => number;
}
const getPreMarkupSubtotal = (items: EstimateItem[]) => {
return items.reduce((sum, item) => sum + item.quantity * item.unitPrice, 0);
};
const TaxModule: ModifierModule = {
id: 'tax',
name: 'Tax',
@@ -34,9 +38,11 @@ const ManHoursModule: ModifierModule = {
defaultValueType: 'unit',
defaultUnitLabel: 'factor',
calculate: () => 0,
calculateDisplay: (m, base) => {
calculateDisplay: (m, _, items) => {
const factor = m.value || 1;
return base / factor;
if (factor === 0) return 0;
const subtotal = getPreMarkupSubtotal(items);
return subtotal / factor;
}
};