diff --git a/src/PowderCoating.Application/Services/PricingCalculationService.cs b/src/PowderCoating.Application/Services/PricingCalculationService.cs index c86fef6..77c9de0 100644 --- a/src/PowderCoating.Application/Services/PricingCalculationService.cs +++ b/src/PowderCoating.Application/Services/PricingCalculationService.cs @@ -391,8 +391,17 @@ public class PricingCalculationService : IPricingCalculationService baseSubtotal = baseUnitPrice * item.Quantity; _logger.LogInformation("Catalog base: ${Price} × {Qty} = ${Base}", baseUnitPrice, item.Quantity, baseSubtotal); - // Catalog DefaultPrice is always the base — prep service labor is never added on top. - // PrepServices on catalog items are used for scheduling only, not pricing. + // Optionally add prep service labor for catalog items when the job requires abnormal + // prep time (e.g. 120-min outgassing on a part that normally takes 30). The flag + // defaults to false so the DefaultPrice is used as-is for typical jobs. + if (!item.IsAiItem && item.IncludePrepCost && item.PrepServices != null && item.PrepServices.Any()) + { + var totalPrepMinutes = item.PrepServices.Sum(ps => ps.EstimatedMinutes); + var prepLaborCost = (totalPrepMinutes / 60m) * costs.StandardLaborRate; + baseSubtotal += prepLaborCost; + totalLaborCost += prepLaborCost; + _logger.LogInformation("Catalog item extra prep: {Min} min × ${Rate}/hr = ${Cost}", totalPrepMinutes, costs.StandardLaborRate, prepLaborCost); + } // Custom (non-inventory) powder coats must be purchased separately — add their material // cost on top of the catalog base price. Inventory powder is assumed baked into DefaultPrice.