InvoiceOrganizer › Guides

How to Total China E-Invoice XML Files

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.

The problem: many files, one number the books need

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.

A worked example

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.

FileInvoice numberAmount excl. taxTax (13%)Total
1243170000000100000011000.00130.001130.00
2243170000000100000022500.00325.002825.00
324317000000010000003800.00104.00904.00
424317000000010000004600.0078.00678.00
5243170000000100000011000.00130.001130.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.

Step 1: Check each line, then add every file

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

Step 2: Drop the duplicate invoice number

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.

Step 3: Write the ledger only after that check

MethodFilesDistinct invoicesTotal
Sum every file55 (wrong)6667.00
One row per invoice number545537.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.

Tips for a folder of 数电票

Let InvoiceOrganizer do the ledger

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 Store

FAQ

How do I total a folder of China e-invoice XML files?

Check 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.

How do I spot a duplicate electronic invoice?

Compare invoice code and invoice number. File 1 and file 5 share 24317000000010000001, so they are one invoice of 1130.00.

Does this method work on any PDF receipt?

No. It is for China mainland electronic invoices. A scanned image-only PDF, a photo, or an overseas invoice is not this calculation.

What should I do with a field that looks uncertain?

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.

Is there software that totals China e-invoice XML offline?

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.