diff --git a/src/PowderCoating.Web/Controllers/QuotesController.cs b/src/PowderCoating.Web/Controllers/QuotesController.cs index f4d3f12..2f71d8b 100644 --- a/src/PowderCoating.Web/Controllers/QuotesController.cs +++ b/src/PowderCoating.Web/Controllers/QuotesController.cs @@ -365,6 +365,8 @@ public class QuotesController : Controller } // Build pricing breakdown from stored snapshot values — never recalculate on load + // OvenCycleMinutes null means "use company default"; resolve it here so the view + // never displays "× 0 min" when the oven was priced against DefaultOvenCycleMinutes. quoteDto.PricingBreakdown = new QuotePricingBreakdownDto { MaterialCosts = quote.MaterialCosts, @@ -373,7 +375,7 @@ public class QuotesController : Controller ItemsSubtotal = quote.ItemsSubtotal, OvenBatchCost = quote.OvenBatchCost, OvenBatches = quote.OvenBatches, - OvenCycleMinutes = quote.OvenCycleMinutes ?? 0, + OvenCycleMinutes = quote.OvenCycleMinutes ?? operatingCosts?.DefaultOvenCycleMinutes ?? 0, ShopSuppliesAmount = quote.ShopSuppliesAmount, ShopSuppliesPercent = quote.ShopSuppliesPercent, OverheadCosts = quote.OverheadAmount, @@ -539,6 +541,9 @@ public class QuotesController : Controller // Get company info and logo var currentUser = await _userManager.GetUserAsync(User); + var pdfOperatingCosts = currentUser != null + ? await _pricingService.GetOperatingCostsAsync(currentUser.CompanyId) + : null; // Populate pricing breakdown from stored snapshot values — never recalculate on load quoteDto.PricingBreakdown = new QuotePricingBreakdownDto @@ -549,7 +554,7 @@ public class QuotesController : Controller ItemsSubtotal = quote.ItemsSubtotal, OvenBatchCost = quote.OvenBatchCost, OvenBatches = quote.OvenBatches, - OvenCycleMinutes = quote.OvenCycleMinutes ?? 0, + OvenCycleMinutes = quote.OvenCycleMinutes ?? pdfOperatingCosts?.DefaultOvenCycleMinutes ?? 0, ShopSuppliesAmount = quote.ShopSuppliesAmount, ShopSuppliesPercent = quote.ShopSuppliesPercent, OverheadCosts = quote.OverheadAmount, diff --git a/src/PowderCoating.Web/Views/Quotes/Details.cshtml b/src/PowderCoating.Web/Views/Quotes/Details.cshtml index addeace..d4ff49b 100644 --- a/src/PowderCoating.Web/Views/Quotes/Details.cshtml +++ b/src/PowderCoating.Web/Views/Quotes/Details.cshtml @@ -984,8 +984,7 @@
Oven - (@Model.PricingBreakdown.OvenBatches batch@(Model.PricingBreakdown.OvenBatches != 1 ? "es" : "") - × @Model.PricingBreakdown.OvenCycleMinutes min): + (@Model.PricingBreakdown.OvenBatches batch@(Model.PricingBreakdown.OvenBatches != 1 ? "es" : "")@(Model.PricingBreakdown.OvenCycleMinutes > 0 ? $" × {Model.PricingBreakdown.OvenCycleMinutes} min" : "")): @Model.PricingBreakdown.OvenBatchCost.ToString("C")
@@ -1148,7 +1147,7 @@ @if (pb.OvenBatchCost > 0) {
- Oven batch (@pb.OvenBatches batch@(pb.OvenBatches != 1 ? "es" : ""), @pb.OvenCycleMinutes min/cycle) + Oven batch (@pb.OvenBatches batch@(pb.OvenBatches != 1 ? "es" : "")@(pb.OvenCycleMinutes > 0 ? $", {pb.OvenCycleMinutes} min/cycle" : "")) @pb.OvenBatchCost.ToString("C")
}