## TL;DR

When extraction skips the line-discount column, net amounts compute wrong and the invoice fails the gross-minus-discount-equals-net check. Detect it by validating every line: gross minus discount should equal net within rounding, and the sum of nets should match the invoice total. When the check fails systematically, the discount column is being missed: retrain or reconfigure the extractor to capture it, including discount-as-percentage vs fixed-amount variants. Until the extractor is fixed, flag affected invoices for manual review rather than posting wrong nets.

## The query

```text
invoice line discount not extracted: net vs gross amount mismatches
```

## Use this when

- Extracted invoice amounts not reconciling
- Line discounts missing from OCR output
- Net vs gross mismatches on invoice lines

## Not for

- Header-level or invoice-level discounts (different handling)
- Tax-inclusive vs exclusive confusion (separate check)

## Steps

1. Run the line-level arithmetic check: gross minus discount equals net, per line.
   Expected output: Failures pinpoint the missed discount column.
2. Confirm the pattern: discounts present on the image but absent in output.
   Expected output: The extractor is skipping the column, not the data being absent.
3. Reconfigure the extraction template or model to capture the discount field.
   Expected output: Discounts appear in the output.
4. Handle both percentage and fixed-amount discount presentations.
   Expected output: Both variants extract correctly.
5. Hold affected invoices for review until the fix is verified on samples.
   Expected output: No wrong nets post in the meantime.

## Variant phrasings

### invoice line discount not extracted OCR

### net gross mismatch invoice extraction

### discount column missing invoice OCR

## Root cause

The arithmetic check catches it because gross, discount, and net are a closed triple: if one is missing, the equation breaks. This makes line discounts self-diagnosing, which is why the validation-first approach finds the problem faster than eyeballing output.

## Edge cases

- Stacked discounts (line plus header) need both captured; check the invoice total too
- Discounts shown as negative lines rather than columns need a different extraction rule

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_a6sXpC30KwPcPGp8SaeCAA
