Fix failing test: revert quote-based discount to use sourceQuote.DiscountAmount
The quote discount must come from the agreed quote price, not the job's pricing snapshot (which may have DiscountAmount=0 for legacy or unset reasons). The job snapshot fix only applies to direct jobs where no source quote exists. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -469,11 +469,10 @@ public class InvoicesController : Controller
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use the quote's agreed tax rate. For discount, prefer the job's current pricing
|
// Use the quote's agreed tax rate and discount — these represent the customer-approved
|
||||||
// snapshot — it is recalculated on every save and captures any post-conversion edits.
|
// price and must not be recomputed from the job's current state.
|
||||||
// Fall back to the original quote discount only if no snapshot exists.
|
|
||||||
dto.TaxPercent = sourceQuote.TaxPercent;
|
dto.TaxPercent = sourceQuote.TaxPercent;
|
||||||
dto.DiscountAmount = jobBreakdown?.DiscountAmount ?? sourceQuote.DiscountAmount;
|
dto.DiscountAmount = sourceQuote.DiscountAmount;
|
||||||
}
|
}
|
||||||
else if (hadJobItems)
|
else if (hadJobItems)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user