Fix oven batch conversion, invoice quantity, AI photo pricing, and enforce pricing flag propagation
- Carry OvenBatches/OvenCycleMinutes from Quote → Job entity (was missing fields; all job pricing recalcs hardcoded 1/null) - Fix invoice creation from job always showing Quantity=1 (was using TotalPrice as UnitPrice with qty 1) - Add IsAiItem to JobItem + migration; map in all 3 JobItemAssemblyService.CreateJobItem overloads so AI photo jobs no longer double-price on first edit after quote→job conversion - Propagate IsAiItem through all existingItemsData JSON blocks in Jobs views (Edit, EditItems, Create) so the wizard preserves AI routing on re-edit - Add PricingRoutingFlags_ExistOnBothQuoteItemAndJobItem structural test + 3 behavioral IsAiItem tests to JobItemAssemblyServiceTests - Consolidate item wizard partials (_ItemWizardModal, _SqFtCalculatorModal) and item-wizard.css into shared locations - Document pricing flag propagation checklist in CLAUDE.md Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -461,7 +461,7 @@ public class JobsController : Controller
|
||||
breakdownItems, job.CompanyId, job.CustomerId,
|
||||
wizardCosts?.TaxPercent ?? 0m,
|
||||
job.DiscountType.ToString(), job.DiscountValue, job.IsRushJob,
|
||||
job.OvenCostId, 1, null);
|
||||
job.OvenCostId, job.OvenBatches, job.OvenCycleMinutes);
|
||||
|
||||
ViewBag.JobPricingBreakdown = new QuotePricingBreakdownDto
|
||||
{
|
||||
@@ -506,6 +506,7 @@ public class JobsController : Controller
|
||||
isGenericItem = ji.IsGenericItem || (!ji.CatalogItemId.HasValue && !ji.Coats.Any() && !ji.IsSalesItem),
|
||||
isLaborItem = ji.IsLaborItem,
|
||||
isSalesItem = ji.IsSalesItem,
|
||||
isAiItem = ji.IsAiItem,
|
||||
sku = ji.Sku,
|
||||
requiresSandblasting = ji.RequiresSandblasting,
|
||||
requiresMasking = ji.RequiresMasking,
|
||||
@@ -1106,6 +1107,7 @@ public class JobsController : Controller
|
||||
CustomerId = dto.CustomerId,
|
||||
QuoteId = dto.QuoteId,
|
||||
AssignedUserId = dto.AssignedUserId,
|
||||
OvenCostId = dto.OvenCostId,
|
||||
Description = dto.Description,
|
||||
JobPriorityId = dto.JobPriorityId,
|
||||
JobStatusId = pendingStatus?.Id ?? 1,
|
||||
@@ -1170,7 +1172,7 @@ public class JobsController : Controller
|
||||
var totals = await _pricingService.CalculateQuoteTotalsAsync(
|
||||
dto.JobItems, companyId, dto.CustomerId,
|
||||
createCosts?.TaxPercent ?? 0m,
|
||||
dto.DiscountType, dto.DiscountValue, dto.IsRushJob, job.OvenCostId, 1, null);
|
||||
dto.DiscountType, dto.DiscountValue, dto.IsRushJob, job.OvenCostId, job.OvenBatches, job.OvenCycleMinutes);
|
||||
|
||||
job.FinalPrice = totals.Total;
|
||||
job.OvenBatchCost = totals.OvenBatchCost;
|
||||
@@ -1262,6 +1264,7 @@ public class JobsController : Controller
|
||||
PowderCostOverride = ji.PowderCostOverride,
|
||||
IsGenericItem = ji.IsGenericItem || (!ji.CatalogItemId.HasValue && ji.Coats.Count == 0),
|
||||
IsLaborItem = ji.IsLaborItem,
|
||||
IsAiItem = ji.IsAiItem,
|
||||
RequiresSandblasting = ji.RequiresSandblasting,
|
||||
RequiresMasking = ji.RequiresMasking,
|
||||
Notes = ji.Notes,
|
||||
@@ -1629,7 +1632,7 @@ public class JobsController : Controller
|
||||
var totals = await _pricingService.CalculateQuoteTotalsAsync(
|
||||
dto.JobItems, companyId, dto.CustomerId,
|
||||
editCosts?.TaxPercent ?? 0m,
|
||||
dto.DiscountType, dto.DiscountValue, dto.IsRushJob, job.OvenCostId, 1, null);
|
||||
dto.DiscountType, dto.DiscountValue, dto.IsRushJob, job.OvenCostId, job.OvenBatches, job.OvenCycleMinutes);
|
||||
job.FinalPrice = totals.Total;
|
||||
job.OvenBatchCost = totals.OvenBatchCost;
|
||||
job.ShopSuppliesAmount = totals.ShopSuppliesAmount;
|
||||
@@ -2926,6 +2929,7 @@ public class JobsController : Controller
|
||||
PowderCostOverride = ji.PowderCostOverride,
|
||||
IsGenericItem = ji.IsGenericItem || (!ji.CatalogItemId.HasValue && ji.Coats.Count == 0),
|
||||
IsLaborItem = ji.IsLaborItem,
|
||||
IsAiItem = ji.IsAiItem,
|
||||
RequiresSandblasting = ji.RequiresSandblasting,
|
||||
RequiresMasking = ji.RequiresMasking,
|
||||
Notes = ji.Notes,
|
||||
@@ -2955,11 +2959,14 @@ public class JobsController : Controller
|
||||
|
||||
var viewModel = new JobEditItemsViewModel
|
||||
{
|
||||
JobId = job.Id,
|
||||
JobNumber = job.JobNumber,
|
||||
CustomerId = job.CustomerId,
|
||||
TaxPercent = costs?.TaxPercent ?? 0m,
|
||||
JobItems = existingItems
|
||||
JobId = job.Id,
|
||||
JobNumber = job.JobNumber,
|
||||
CustomerId = job.CustomerId,
|
||||
TaxPercent = costs?.TaxPercent ?? 0m,
|
||||
OvenCostId = job.OvenCostId,
|
||||
OvenBatches = job.OvenBatches > 0 ? job.OvenBatches : 1,
|
||||
OvenCycleMinutes = job.OvenCycleMinutes,
|
||||
JobItems = existingItems
|
||||
};
|
||||
|
||||
await PopulateJobItemDropDownsAsync(currentUser.CompanyId, costs?.OvenOperatingCostPerHour ?? 45m);
|
||||
@@ -3040,7 +3047,7 @@ public class JobsController : Controller
|
||||
// Calculate full total (overhead, margins, tax) to match what the wizard displays
|
||||
var totals = await _pricingService.CalculateQuoteTotalsAsync(
|
||||
model.JobItems, currentUser.CompanyId, job.CustomerId,
|
||||
model.TaxPercent, "None", 0, false, job.OvenCostId, 1, null);
|
||||
model.TaxPercent, "None", 0, false, job.OvenCostId, job.OvenBatches, job.OvenCycleMinutes);
|
||||
|
||||
job.FinalPrice = totals.Total;
|
||||
job.OvenBatchCost = totals.OvenBatchCost;
|
||||
@@ -3101,6 +3108,7 @@ public class JobsController : Controller
|
||||
CatalogItemId = ji.CatalogItemId,
|
||||
IsGenericItem = ji.IsGenericItem,
|
||||
IsLaborItem = ji.IsLaborItem,
|
||||
IsAiItem = ji.IsAiItem,
|
||||
ManualUnitPrice = ji.ManualUnitPrice,
|
||||
Coats = ji.Coats.Select(c => new CreateQuoteItemCoatDto
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user