Variance Resolution Preview
GET/api/purchase-invoices/:purchaseInvoice/variance-resolution-preview
Preview over-billed quantities per PO line so the UI can prefill a 'Resolve with vendor credit' dialog.
Authentication: Requires Bearer token.
A line is considered over-billed when its effective invoiced quantity (quantity_invoiced minus quantity already credited on this bill via existing vendor credit allocations) exceeds the PO line's effective received quantity. Receipt sources match PurchaseOrderLine::getEffectiveReceivedQuantity() (standard warehouse receipts, FBA/AWD ledgers, accounting for any active short-close event).
The suggested credit quantity is exactly the over-bill delta. The suggested credit amount is over_billed * unit_price (invoice unit price, falling back to PO amount).
Response fields:
invoice_id,purchase_order_id,supplier_id,currency_id,currency_codehas_over_bills: true if any line has over-billed quantitytotal_suggested_credit: sum ofsuggested_credit_amountacross over-billed lineslines[]: only includes lines with over-billed quantity. Each line haspurchase_invoice_line_id,purchase_order_line_id,product_id,sku,product_name,quantity_invoiced,received_quantity,already_credited,over_billed_quantity,suggested_credit_quantity,unit_price,suggested_credit_amount.
Request
Responses
- 200
Successful response