From 8c30d5bf5aa416e4976308b624d464073cd6111b Mon Sep 17 00:00:00 2001 From: Scott Pouliot Date: Wed, 6 May 2026 16:47:48 -0400 Subject: [PATCH] Restore IncludePrepCost pricing for catalog items with abnormal prep MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The flag should default off (catalog DefaultPrice used as-is) but remain functional so users can opt in when a job needs exceptional prep time (e.g. 120-min outgassing vs. the typical 30 min baked into the catalog price). Previous commit removed this entirely — restoring with correct default behavior. Co-Authored-By: Claude Sonnet 4.6 --- .../Services/PricingCalculationService.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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.