Automatic Data Extraction from Invoices and Delivery Notes: From OCR to ERP
Business

Automatic Data Extraction from Invoices and Delivery Notes: From OCR to ERP

Parse e-invoices and e-delivery notes as XML, put the effort into line items, supplier code mapping and order matching, and judge the result line by line.

Short answer

Yes. Invoice data extraction and delivery note reading can be automated, but e-Fatura and e-İrsaliye documents are UBL-TR XML and should be parsed, not run through invoice OCR; OCR is for scanned, photographed or image-only documents. The harder work is line items: mapping supplier codes and units to your stock cards, handling discounts and VAT, and matching each line to the purchase order and goods receipt within tolerance. The system writes draft records to the ERP and an authorised person posts them.

Can invoice data extraction and delivery note reading be automated?

Yes, but in Türkiye much of the incoming paperwork is an XML parsing job rather than an OCR job, and the hard part is not reading: it is tying each line item to your own stock code and matching it to the purchase order. A team keying supplier invoices into the ERP does three things: it reads a value, finds its counterpart in the ERP (supplier account, stock card, order line) and resolves differences. Invoice OCR only speeds up the first; if the other two stay unsolved, the record still ends up with a person.

This article covers the accounts payable and goods receipt flow. General pipeline steps, OCR versus layout and language models, and general validation rules are in our guide to document processing automation.

Which documents arrive through which channel, and which need OCR?

OCR is needed only for scanned or photographed paper and for PDFs without XML; e-invoices and e-delivery notes should be parsed as XML. The Turkish Revenue Administration's e-Arşiv page states that the XML-based UBL-TR standard was adopted for the e-invoice (e-Fatura), that buyers not registered for e-Fatura receive an e-Arşiv invoice, and that it is delivered on paper or electronically as the buyer requests. The e-İrsaliye page explains that General Communiqué No. 509 made the electronic delivery note mandatory for certain groups, including e-Fatura users trading in iron and steel and those with gross sales of 25 million TL or more in 2018 or later. Suppliers outside that scope still send printed delivery notes.

Document and channelFormatReading routeWhat to watch
e-Fatura (integrator, portal or the ERP's e-document module)UBL-TR XMLXML parser; no OCRItem codes are the supplier's; different VAT rates and withholding arrive as separate tax entries
e-Arşiv invoice (email attachment)PDF, sometimes with XML attachedParser if XML is attached; otherwise the PDF text layerAn image-only PDF needs OCR
e-İrsaliyeUBL-TR XMLXML parserStates the quantity dispatched; the quantity received is recorded separately at the warehouse
Printed delivery note signed at the gatePaper, scan or phone photoOCR plus a handwriting checkQuantities corrected by hand, stamps and signatures; the highest review rate
Foreign supplier invoicePDFPrebuilt invoice model or layout modelLanguage, currency, units such as inches and pounds, proforma versus commercial invoice

Count the last three months of documents against these rows; the OCR budget goes only to the share that arrives as images.

Why is line-item extraction the hardest part?

Because header fields appear once, whereas line items form a table whose length, layout and meaning change from supplier to supplier. Research treats this as a separate task: the DocILE benchmark defines line item recognition apart from key information extraction and describes it as a highly practical task in which information has to be assigned to the right item in a table. In practice the trouble comes from:

  • Tables spanning pages: the header is not repeated on page two, and a subtotal gets read as an item.
  • Units: the supplier bills by the box, coil or tonne; your stock card holds pieces or kilograms, and the conversion factor is not printed.
  • Discounts: line, second and invoice-level discounts can coexist, and whether the unit price is net is often unclear.
  • Several VAT rates and withholding: separate tax amounts that post to separate accounts.

Prebuilt models help, and their schemas show where they stop. Microsoft's Document Intelligence invoice model schema lists amount, date, description, quantity, product code, tax, tax rate, unit and unit price per line item; discount appears only as a document-level total, with no line-level discount or withholding field. The product code is the one printed on the document, which is the supplier's. Line discounts, withholding and code mapping need your own rules.

How do supplier codes map to your stock cards, and why is master data the bottleneck?

Through a mapping table linking the supplier's item code to your stock code and a unit conversion factor; it is the most valuable and most labour-intensive output of the project. Past order lines and description similarity can suggest mappings, but a person confirms each one, because a wrong mapping silently books goods into the wrong stock item. A code seen for the first time goes to review as a "new mapping" and, once confirmed, is reused automatically.

Master data is the real bottleneck: a reading error belongs to one document, while a master data error repeats on every invoice from that supplier. Typical problems are duplicate supplier accounts, missing tax numbers, several stock cards for one material, wrongly defined units and inactive codes that are still ordered. Until these are fixed, accuracy measurements describe your master data, not the model.

How does delivery note and invoice matching work?

Invoice lines are compared with the purchase order (two-way match) and, for stocked materials, also with the delivery note and goods receipt (three-way match); within tolerance the record moves on, outside it stops with a reason. Article 230 of the Turkish Tax Procedure Law requires the delivery date and delivery note number to appear on the invoice, and Article 231 provides that the invoice is issued within at most seven days of delivery. So one invoice can cover several delivery notes, and the delivery note numbers on it are the matching key.

The Revenue Administration's e-İrsaliye application guide lists the order number and the delivery note lines among the mandatory UBL-TR fields, so an e-İrsaliye carries its link to the order. The same guide lets the buyer send a delivery note response within seven days of actual dispatch, accepting all goods or accepting some and rejecting the rest; the response is optional. Write these rules down:

  • Tolerance: separate for quantity and unit price, as an amount or a percentage.
  • Partial delivery: each delivery note updates the order line's open quantity; the invoice cannot exceed it.
  • One invoice, several delivery notes: every referenced delivery note must be found, and line totals must equal their sum.
  • Rejected goods: if a rejected quantity appears on the invoice, the record stops.

Our article on a procurement document agent covers matching from the agent's side, with difference explanations and approval limits.

For automated invoice entry, should the ERP receive draft or posted records?

At first, write only draft records awaiting approval and let an authorised person post them; fully automatic posting comes only after a measured period, and only for low-risk items. Logo, Mikro, Netsis, SAP and similar systems each take records in differently; whether to use an API, an import file or a staging table is decided in discovery against your version. The handover layer needs:

  • Duplicate check: the universal unique identifier (ETTN) for e-documents; the supplier's tax number with series and sequence number for paper. A document arriving by email and portal stops the second time.
  • Approval authority: who approves up to which amount and who accepts out-of-tolerance differences, taken from the ERP's existing approval flow.
  • Audit trail: source document, value read, corrected value, matching result, approver and time.
  • Uncertain lines: never filled with a guess; the document goes to review with its reason (new code, price out of tolerance, delivery note not found).

What data and access are needed from you?

Real documents from every channel, their correct ERP records, a master data export and a named person in accounting; not new scanners, a model trained from scratch or years of archive.

  • Documents sampled across channels, each with its purchase order, delivery note and posted ERP record.
  • Supplier accounts, stock cards, unit definitions and any existing code mappings.
  • A written tolerance policy and approval limits, or time in discovery to write them.
  • Access to an ERP test company; nothing is written to live records during the pilot.

Delivery notes also carry personal data: the same guide says carrier details such as vehicle plate and driver go into the shipment information. Article 4 of Turkey's Personal Data Protection Law (KVKK, Law No. 6698) requires data to be relevant, limited and proportionate to the purpose and kept only as long as necessary, so skip fields that matching does not need.

How should the pilot be measured?

Use four measures, each against today's measured baseline:

  • Field-level accuracy: the share of header fields (invoice number, date, tax number, totals) read correctly.
  • Line-level accuracy: a line is correct only if stock code, quantity in the stock unit, net unit price, VAT rate and matched order line are all right.
  • Straight-through rate: the share of documents that become draft records untouched and prove correct in the sample audit.
  • Time per document: timed with a stopwatch on real documents before the pilot, matching included.

Report by channel and supplier, not as one average. Set targets from what an error costs you and today's error rate, not from a brochure: a wrong stock booking, under-claimed input VAT and a double payment do not weigh the same.

Hypothetical example: a distributor receiving 1,200 invoices a month

This example is hypothetical; the numbers only illustrate the method. A building materials distributor receives about 1,200 supplier invoices a month. Before the pilot, the team times 50 invoices: 6.5 minutes on average, matching included. A four-week pilot processes 400 invoices with 1,600 lines; 236 invoices become draft records untouched, and 164 go to review.

MeasureCalculationResult
Line-level accuracy1,472 correct lines / 1,600 lines92%
Source of wrong lines84 unmapped codes + 26 unit conversions + 18 reading errors128 lines
Straight-through rate(236 untouched - 2 found wrong in the audit) / 40058.5%
Average time per invoice(236 × 0.5 min + 164 × 3 min) / 400 = 610 / 400about 1.5 min (6.5 today)
Team time per month1,200 × 6.5 min against 1,200 × 1.525 minfrom 130 to about 30.5 hours

The key row is the second: 110 of 128 wrong lines are master data problems, not reading problems. The next step is not a new model but completing code mappings and unit factors for the highest-volume suppliers. And the two wrong invoices that passed straight through surfaced only through the sample audit.

What drives the cost, and what should a quote itemise?

Cost depends less on volume than on channel mix, supplier variety, master data quality and the route into the ERP. Bigger: many scanned delivery notes, many supplier layouts, unmapped codes, complex discount and withholding rules, an ERP without an open interface, data that cannot leave the company. Smaller: a high e-Fatura and e-İrsaliye share and clean stock cards. A quote should itemise intake and XML parsing, OCR and line-item extraction, the mapping table and master data clean-up support, matching rules, ERP integration, the review screen, the pilot and its measurement, and post-go-live monitoring, with any cloud per-document fee on its own line.

Where do these projects usually get stuck?

  • Measuring the pilot on header fields only.
  • Postponing code mapping, so the system reads but people still finish the record.
  • Late goods receipts: a delivery note left in the warehouse for days makes the three-way match stop the invoice for no reason.
  • Unwritten tolerance rules, so each accountant accepts differences differently and correct behaviour is never defined.
  • Treating supplier-specific discount and withholding rules as exceptions instead of defining them up front.

Start with three numbers: monthly documents per channel, today's time per document, and how many of last month's invoice lines could be tied directly to a stock card. They show how the job splits between XML parsing, OCR and master data clean-up.

Hatson Tech builds workflows that read supplier invoices and delivery notes, match them with order and goods receipt records and write them into the ERP as records awaiting approval, as part of our AI agent development service. If you would like to count your document mix together, the first meeting and the discovery work are free.

Key takeaways

  • Count your invoices and delivery notes by channel first: e-Fatura and e-İrsaliye are parsed as XML, and only image documents need OCR.
  • Build a mapping table from supplier item codes and units to your own stock codes, and let a person confirm every new mapping.
  • Match invoice lines to the purchase order and, for stocked goods, to the delivery note and goods receipt, using written quantity and price tolerances.
  • Write draft records to the ERP with a duplicate check on ETTN or tax number plus series and number, and keep posting with an authorised person.
  • Measure the pilot on line-level accuracy, straight-through rate and time per document against a stopwatch baseline, by channel and supplier.
  • Expect master data errors to outnumber reading errors, and budget for cleaning supplier and stock cards.

Frequently asked questions

Is an off-the-shelf invoice reading tool enough?

It usually reads header fields and often line items. Whether that is enough shows only when you measure it line by line on your own invoices. Supplier code mapping, tolerance rules and writing draft records to the ERP are normally built on your side whichever tool you choose.

Do we need to change our ERP to import invoices automatically?

Usually not. Records go in through the ERP's existing interface, an import file or a staging table. Which route is possible depends on your version and licence, so it is tested in a test company during discovery, before anything touches live records.

Can a phone photo of a delivery note be read?

Often yes, but sharpness, lighting, folds and handwritten corrections decide the result. Give whoever takes the photo a short rule (whole page, flat, no shadow) and always send handwritten quantity fields to review, because they are the values the three-way match relies on.

How long does it take and what does it cost?

There is no single answer. The channel mix, the number of supplier layouts, the state of supplier and stock cards and the route into the ERP drive both. A quote is written after discovery, itemised by scope, so that you can see which part goes to reading, matching, integration and master data.

Will the accounts team still be needed?

Yes. The work shifts from keying records to resolving differences, confirming new code mappings and auditing samples of records that passed straight through. Posting and payment decisions stay with authorised people under your existing approval rules.

Is sending invoice and delivery note images to a cloud service a KVKK issue?

It can be. Documents may contain personal data such as driver names, signatures or a sole trader's ID number. Assess the transfer and security obligations under KVKK, extract only the fields you need and consider on-premise processing where data cannot leave. This is general information; confirm your set-up with your own legal adviser.

All articles