A practical way to turn a folder of mainland electronic invoices (数电票 XML) into one ledger total, including the duplicate that makes a hand total too high.
A month of China mainland electronic invoices arrives as a folder of XML files, sometimes with a few PDFs mixed in. Each file already contains the invoice number, the parties, the amount, and the tax. The bookkeeping question is: what is the total of the distinct invoices, not the total of the files?
Opening every XML in a browser and typing amounts into Excel works for a handful of invoices. The same habit double-counts a file that was downloaded twice, and it has no separate mark for a PDF field you are not sure about.
Not generic OCR. The steps below are for China mainland e-invoice XML and for PDF layouts that actually contain those fields. A photo of a receipt, an overseas invoice, or a scanned PDF with no text layer is a different job.
Five XML files, all at 13% VAT. Tax is exactly 13% of the amount excluding tax, so each line can be checked with amount + tax = total.
| File | Invoice number | Amount excl. tax | Tax (13%) | Total |
|---|---|---|---|---|
| 1 | 24317000000010000001 | 1000.00 | 130.00 | 1130.00 |
| 2 | 24317000000010000002 | 2500.00 | 325.00 | 2825.00 |
| 3 | 24317000000010000003 | 800.00 | 104.00 | 904.00 |
| 4 | 24317000000010000004 | 600.00 | 78.00 | 678.00 |
| 5 | 24317000000010000001 | 1000.00 | 130.00 | 1130.00 |
File 5 is the same invoice as file 1. The number matches, and so do the amounts. A sixth file, a PDF, is sitting in the same folder with one amount field you cannot confirm. Leave that PDF out of both totals until a person checks it.
1000.00 + 130.00 = 1130.00
2500.00 + 325.00 = 2825.00
800.00 + 104.00 = 904.00
600.00 + 78.00 = 678.00
Adding the five file totals, which is what you get if you sum the folder without looking at invoice numbers:
1130 + 2825 + 904 + 678 + 1130 = 6667.00
Match on invoice code and invoice number. 24317000000010000001 appears twice, so it counts once. Subtract the repeated total:
6667.00 − 1130.00 = 5537.00
Build the same number from the four distinct invoices:
Amount excl. tax: 1000 + 2500 + 800 + 600 = 4900.00
Tax: 130 + 325 + 104 + 78 = 637.00
4900.00 + 637.00 = 5537.00
The folder total was 1130.00 too high. 1130 ÷ 5537 is about 20.4% over the real total, from a single repeated download.
| Method | Files | Distinct invoices | Total |
|---|---|---|---|
| Sum every file | 5 | 5 (wrong) | 6667.00 |
| One row per invoice number | 5 | 4 | 5537.00 |
The Excel file you hand to the books should list four invoices, show the duplicate, and omit the unchecked PDF. The number on that sheet is 5537.00.
Five files are easy to check by hand. A client folder for the month is not. InvoiceOrganizer is a Windows desktop app built only for this job:
¥68 one-time on the Microsoft Store (China market). Point it at a real invoice folder and compare the distinct total with the sum of the files.
Get InvoiceOrganizer on Microsoft StoreCheck amount + tax on each file, add the file totals, then subtract any invoice number that appears more than once. In the example, 6667.00 − 1130.00 = 5537.00.
Compare invoice code and invoice number. File 1 and file 5 share 24317000000010000001, so they are one invoice of 1130.00.
No. It is for China mainland electronic invoices. A scanned image-only PDF, a photo, or an overseas invoice is not this calculation.
Keep that invoice out of the total until you have checked the field. Do not fill in a guess to make the column add up.
Yes. InvoiceOrganizer imports XML and supported PDF layouts, highlights duplicate invoice codes and numbers, flags uncertain fields, and exports Excel. ¥68 one-time on the Microsoft Store in the China market. Files stay on your PC.