diff --git a/src/PowderCoating.Application/Services/PricingCalculationService.cs b/src/PowderCoating.Application/Services/PricingCalculationService.cs index 5fbc1c6..8756c2a 100644 --- a/src/PowderCoating.Application/Services/PricingCalculationService.cs +++ b/src/PowderCoating.Application/Services/PricingCalculationService.cs @@ -299,15 +299,14 @@ public class PricingCalculationService : IPricingCalculationService } // Custom formula items (FixedRate mode): the wizard evaluated the NCalc formula server-side - // and stored the result as ManualUnitPrice. The formula result IS the total price — it already - // incorporates any quantity-like fields the user entered (e.g. numWheels, numParts). Do NOT - // multiply by Quantity again; doing so double-counts when the formula itself accounts for qty. + // and stored the per-item result as ManualUnitPrice. Multiply by Quantity for the total, + // exactly like every other item type that uses ManualUnitPrice. // SurfaceAreaSqFt mode: ManualUnitPrice is null; the formula produced sqft which was stored // in SurfaceAreaSqFt, so the item falls through to the standard calculated path below. if (item.IsCustomFormulaItem && item.ManualUnitPrice.HasValue) { - var formulaTotal = item.ManualUnitPrice.Value; - var formulaUnitPrice = item.Quantity > 0 ? formulaTotal / item.Quantity : formulaTotal; + var formulaUnitPrice = item.ManualUnitPrice.Value; + var formulaTotal = formulaUnitPrice * item.Quantity; return new QuoteItemPricingResult { MaterialCost = 0,