fix: review #19 — DealHelper trade allowance in gross profit, FinancingHelper negative equity rollover
Universal: Auto Version Bump / Version Bump (push) Successful in 11s
Universal: Pre-Release / Build Pre-Release (${{ inputs.stability || github.ref_name }}) (push) Successful in 13s

This commit is contained in:
Jonathan Miller
2026-06-21 17:57:57 -05:00
parent 36da5c0845
commit fa8baf4df1
2 changed files with 4 additions and 2 deletions
@@ -57,7 +57,8 @@ class DealHelper
}
$frontGross = (float) $deal->sale_price - (float) $deal->invoice_price
- (float) ($deal->reconditioning_cost ?? 0);
- (float) ($deal->reconditioning_cost ?? 0)
- (float) ($deal->trade_allowance ?? 0);
// F&I back-end gross
$db->setQuery($db->getQuery(true)
@@ -79,7 +79,8 @@ class FinancingHelper
}
$tradeEquity = (float) $deal->trade_value - (float) $deal->payoff;
$effectivePrice = (float) $deal->sale_price - max(0, $tradeEquity);
// Negative equity rolls into financed amount (customer owes more than trade value)
$effectivePrice = (float) $deal->sale_price - $tradeEquity;
$scenarios = [];
$rates = [3.9, 5.9, 7.9];