Rev 37089 |
Last modification |
Compare with Previous |
View Log
| RSS feed
Last modification
- Rev 37274 2026-08-10 11:20:42
- Author: amit
- Log message:
- Freeze margin-scheme purchase price on the invoice line
Refurbished (GST Rule 32(5)) lines re-derived their purchase price by serial on
every read, resolving to the LATEST warehouse.inventoryItem row. A returned
device gets re-GRNed, sometimes at a different price, so a credit note or a
regenerated PDF could reverse a margin the invoice never charged. 11 already-
billed lines resolved to a price they were not sold at; IMEI 353917853695268
has been sold on six invoices at two different purchase prices.
InvoiceService.freezeMarginPurchasePrices now stamps the value onto
transaction.lineitem.margin_purchase_price at billing time (saveInvoice step 0,
inside the billing transaction), and resolveMarginPurchasePrice reads the frozen
value thereafter, falling back to the live lookup only when null so pre-existing
lines behave exactly as before.
Requires the column from db-scripts/add_margin_purchase_price_column.sql, which
must be applied before this is deployed.