blog·5 min read

In, booked or still waiting: the status of every purchase invoice

An invoice sitting in your accounting is not the same as an invoice that has been booked. How we derive a status per document from three questions, and flag anything that waits too long.

I want to see per purchase invoice whether it has arrived, has been booked
or is still waiting, without having to open the accounting.

A cafe sends its purchase invoices to the accounting. Some suppliers mail them straight there, the rest get uploaded. After that they vanish from view, and the question "has that beer invoice been processed?" can only be answered by calling someone.

We built an overview for that on Nmbrs Accounting. It is built. The client stays anonymous and there are no amounts, prices or margins here.

The interesting part of this job is that the answer does not live in one field. There is no status field. The status follows from three questions you ask in three different places.

Three places, one document

In the accounting a purchase invoice exists in three ways side by side:

  • as a document in the archive, in the Purchasing folder, with a file name, a date, a supplier and the supplier's invoice number;
  • as a ledger entry on the creditors account, as soon as someone has processed it;
  • as an outstanding item with the creditors, for as long as it has not been paid.

What makes this workable: those three parts carry the same document ID. The ID of the archive document is the same ID on the ledger entry and the same ID on the outstanding item. That is not a given in accounting integrations, and here it is the whole key.

The status from three questions

That turns the status into a small decision tree. Three questions per document:

  1. Does the accounting see this document as a purchase invoice?
  2. Is there a ledger entry on the creditors account with this document ID?
  3. Is it among the outstanding items?

And then:

  • Waiting to be processed: recognised as an invoice, but no ledger entry yet. It has arrived and nothing has happened to it.
  • Booked, open: a ledger entry and still outstanding. Processed, not yet paid.
  • Booked, settled: a ledger entry and no longer outstanding.
  • Not recognised as an invoice: not an invoice type and not booked. Usually an attachment or a document dropped in the wrong folder.

That last one matters as a separate case. Without it such a document would stay "waiting to be processed" forever and raise a flag every week, while there is nothing to process.

The flag: not when it fails, but when it stays quiet

An invoice that says "waiting to be processed" is not a problem. An invoice that says that for three weeks is.

So we raise a flag once a document has been waiting longer than a configurable number of days, seven by default. That default is not arbitrary: during a period we were watching, invoices from one kind of supplier sat untouched for weeks without anyone noticing. Seven days is short enough to fix it in the same month and long enough not to produce noise during a normal working week.

Who submitted it

The archive tells you per document who supplied it. If that says the name of the accounting software itself, the invoice was mailed directly by the supplier. Otherwise it is the name of whoever uploaded it.

That is a small field with a lot of value. The difference between "the supplier mails it himself" and "someone on our side has to upload this every month" is exactly what you need to know when you want to find where the manual work sits.

Two things we had wrong at first

The date filter works on the day the document arrived, not on the invoice date. Ask for a period and you get what was supplied in that period. An invoice from last month that arrives today is in today's list. That is obvious once you know it and costs you half a day of searching if you do not.

The window for the ledger entries has to be wider than the window for the documents. An invoice from two months ago can be booked today. So we look at the entries from the oldest document date minus a month, capped at two years back, up to today. That is one call, and without that extra month you miss precisely the invoices that were processed just in time.

Uploading with a double check

The app uploads to the purchasing folder as well, and that is where most of the nerves sit. Putting an invoice into the accounting twice is worse than submitting it a day later.

The check has three layers:

  1. The same content as an earlier file blocks outright. That is a comparison on the hash of the file, so a file that has ever been submitted cannot go in again.
  2. The same file name and the same size as a document already in the archive raises a warning: this is probably already there.
  3. For an invoice XML the invoice number, compared against the references in the archive and against the invoice numbers already booked. If the number occurs, we warn.

One thing matters with checks like these: if the accounting cannot be read, there is no check, and then we submit nothing. An unknown outcome is not a green light. That is the difference between a check that works and a check that is merely present.

Common mistakes

Assuming an invoice that sits in the accounting has been booked. Those are two different things, and the client only sees the first.

Matching on a name instead of an ID. Supplier names come in several spellings and are sometimes double encoded.

Using a date filter without knowing which date it filters on. Invoice date and arrival date drift weeks apart.

Treating every document as an invoice. Then you flag something forever that will never be booked.

Reading an unknown outcome as "no duplicate". With unreachable accounting you submit nothing.

What an integration on this package can do is on connecting Nmbrs. The quirks of that API are in the Nmbrs Accounting API, and how we make alerts disappear once they are resolved is in alerts that clean up after themselves. If you want this for your own bookkeeping, have a look at custom software.

MK
Maarten Keizer

Founder of Invoker. Over twenty years in hosting, system administration and web development; builds the Claude hosting himself and tests everything on our own servers first.

about maarten