Half the invoices were missing
The tax authority keeps a list of every invoice a supplier issues to a company. One month, that list showed 195 purchase invoices. The company's accounting system had 98 of them.
Nobody was careless. Invoices got into the system only when someone took a photo of the paper copy. If the paper never reached the office, the invoice never reached the books.
So I stopped depending on the paper. I built a small tool that downloads the official list and compares it, line by line, with the accounting system. For every invoice that is missing, it creates one with the right taxes, and leaves it for a person to review.
Two details mattered more than the code. First, it finds invoices that were loaded twice, once from the photo and once from the list, and it fixes small rounding differences. Second, every run can be undone with one command. When you change someone's books, the way back is part of the job.
That month went from 98 of 195 invoices to 195 of 195, and the total matched the tax authority exactly. Next month, I can simply run it again.