Skip to main content

Landed Cost Invoice OCR

πŸ“„οΈGet Extraction

Retrieve a landed cost invoice OCR extraction record. Eager-loads the matched supplier and any extraction→bill pivots created during apply. Returns extracted header data merged with matched supplier info, line items with per-line cost-category matches (6-tier match: mapped → exact_name → name_substring → keyword → fuzzy_name → fuzzy_mapped → unmatched), candidate targets (inbound shipments / POs / warehouse transfers that fit the supplier + ETA window), and inbound-email source metadata.

πŸ“„οΈApply Extraction (Create Bills)

Accept the reviewed/edited extraction and create one or more `Bill` records β€” one per target entity (inbound shipment, purchase order, or warehouse transfer) β€” each with its own apportionment of the cost lines. Marks the extraction as `confirmed` and persists `Bill` rows linked via the polymorphic `bills.link_type` / `link_id` columns. Bridges supplier β†’ vendor via `VendorRepository::firstOrCreateByName($supplier->name)` since Bills require `vendor_id`.