Cash moves through several branches and nobody trusts the closing numbers. Here’s how to build a system that can’t be argued with.
Typed totals, edited records and change that blurs the sales figure: that's why end-of-day cash numbers start arguments. What a trustworthy cash system does differently, explained for owners, with the cash-control app I built for a four-branch retail group.



Key takeaways
- End-of-day cash numbers start arguments when totals are typed by hand, records can be edited and nothing proves who touched the money.
- A trustworthy cash ledger is append-only: you can add lines but never change or delete them, and a mistake is fixed with a new reverse entry.
- Cashiers should count notes and coins, not type totals, and the server should compute the amounts and check the pieces exist before any cash leaves.
- Money should be stored as whole numbers of the smallest unit, and every write should carry a unique key so a retry on a bad connection can never post twice.
- Al Burhan, the Arabic Android cash-control platform I built for a four-branch retail group, applies all of this and reached a signed beta in four weeks.
It's eight in the evening. A cashier counts the drawer, types a total into a spreadsheet and sends a photo of the receipt book. The total is off. The branch head says the cashier gave wrong change. The cashier says a credit sale was never written down.
Multiply that by several branches, add a courier carrying cash to head office, and the owner gets a different number from every person who touched the money.
Nobody is necessarily stealing. The problem is that the system lets every number be typed, changed and argued about. This post explains how to build one that can't be.
It's for owners and finance managers of retail groups, chains and any business where cash passes through several hands and several locations.
Why does nobody trust the end-of-day numbers?
Because nothing in the process is fixed. When I started on Al Burhan, a cash-control platform for a four-branch retail group in Annaba, the case looked like this:
- Totals were typed by hand. A typed number is a claim, not a count.
- Change and credit sales blurred the numbers. Cash in the drawer and sales on the day stopped meaning the same thing.
- Closings took hours. Paper counts had to be reconciled by people at the end of a long day.
- Disputes couldn't be settled. Nothing was immutable, so there was no version everyone had to accept.
The fix isn't a nicer spreadsheet. It's a few rules about money that the database enforces, whatever the app or the person does.
What is an append-only ledger, and why must it never be edited?
An append-only ledger is a record of money where you can only add lines, never change or delete them. If a cashier makes a mistake, the correction is a new reverse entry linked to the original one. The mistake stays visible, and so does the fix.
This is how careful bookkeepers have always worked. You don't scrub out a line in the book, you write a correcting one. The reason is simple: a balance that someone edited proves nothing. A history nobody can rewrite settles the argument.
In Al Burhan, transactions and denomination movements are never updated or deleted. Balances are never stored in a field someone could change. They're calculated from the ledger every time you read them. Behind that sits an audit log: who did what, when, and from which device, written by the server for every change.
If anyone can edit the number, the number can't settle an argument.
The trade-off is real. Every balance is a calculation over history, so reads are heavier. In exchange, you get tamper evidence and the ability to replay any day exactly.
Why count notes and coins instead of typing a total?
Because a count of pieces can be checked, and a total can't. The client forbade hand-typed totals, so every count in the app is entered per denomination: how many 2,000 notes, how many 1,000 notes, how many coins.
The phone never sends an amount. It sends counts, and the server computes the amounts. Before any cash leaves the drawer, for change or for swapping a big note for smaller ones, the server checks those exact pieces are actually there. The 200-dinar note and the 200-dinar coin are even treated as different items.
A damaged or suspect note has its own protocol: a mandatory photo, the holder's identity, a receipt numbered by the server and a notification to the client, the branch head and the CFO.


Selling with change shows why this matters. A customer pays 2,000 for a 1,750 item. The drawer receives 2,000 and gives back 250, but the sale is 1,750. The app records both movements in one operation, nets them to the item value and issues an auto-numbered receipt. It can't half-finish and leave the drawer wrong.
Which two small rules stop cents and sales from going missing?
Store money as whole numbers, and make every write safe to repeat. They sound like details. They are easy to get wrong and expensive to fix later.
Whole numbers. Computers store decimals like 0.10 approximately, and tiny errors add up. Ask most programming languages for 0.1 + 0.2 and you get 0.30000000000000004. Across thousands of entries, that's how cents go missing in a report.
The fix is to store every amount as a whole number of the smallest unit. In Al Burhan every amount is an integer number of centimes, and no floating-point number ever touches money. It's one of those decisions that costs nothing on day one and a lot to change later. I keep it as a short note on my engineering notes page, because I apply it everywhere money is stored.
Safe to repeat. What happens when the connection drops in the middle of a sale? With a careless app, the sale can be recorded twice. The phone sends the entry, the network drops before the answer comes back, and the app tries again. Now the drawer shows money that was never there.
The fix is called idempotency: sending the same operation twice has the same effect as sending it once. In Al Burhan, every write carries a unique ID created on the phone, and the database refuses a second entry with the same ID. Think of it as a ticket number the server remembers.
Branch networks drop mid-request, so this was built in before the offline mode even exists. The planned offline queue will reuse the same keys, so replaying a day of entries later is safe by construction. Online payments need the same care, and I cover that side in when a customer pays but doesn't get access.
How did I build it for a four-branch retail group?
I built Al Burhan as an Arabic-only Android app for the three roles that work on a phone: cashier, courier and field collector. It went from specification to a signed beta in four weeks, in August 2026. The rules live in a Postgres database that owns the money, so the phone can't bend them.
Here's how cash moves from the drawer to the treasury:
- Open.The cashier counts the drawer by denomination and the server opens the financial day.
- Operate.Every cash intake needs a reason: sales, debt settlement, other, or a collection for another branch. Expenses leave only against orders the CFO has already approved, with a photo of the invoice.
- Declare blind.At closing, the cashier enters the commercial figures before seeing the counted cash. The server compares them and shows the difference. Credit sales are declared separately as debts, not hidden in the cash figure.
- Hand over.Cash leaves the branch only by courier, and only after the day is closed. Each step, from assigned to received by treasury, is a state the server checks.
- Settle.The CFO settles balances between branches and reviews the ledger and the audit log.


Sign-in has two gates. The client asked for a second password before anyone touches money, so after the normal login there's a real password check that sends each person straight to their own screens.
Who is allowed to write to the money tables?
Nobody, directly. Row-level security is the database checking who may read or change each row. In Al Burhan it's on for all 25 tables, with no write permission at all for the app. Every write goes through a server function that checks the rules first.
So if the app's public key ever leaked, it still couldn't write a single entry. A hardening pass, prompted by a security advisor warning, also removed the default public permission to call those functions. I apply the same principle to subscription limits, enforced in the database rather than on the pricing page, and I wrote about it in plans, roles and limits in a marketplace.
The cost: all the permission logic lives in SQL, so reviewing those functions becomes the security boundary.
Checklist: can you trust your cash numbers?
Ask these about your current system, whether it's paper, a spreadsheet or an app:
- Can anyone edit or delete a cash entry after it's saved?
- Is any balance stored as a number someone can type over?
- Do cashiers count notes and coins instead of typing totals?
- Are credit sales and change kept separate from the cash figure?
- Does the cashier see the counted cash before declaring the day's sales?
- If the connection drops and the app retries, can a sale be recorded twice?
- Can you see who made each change, when, and from which device?
- Can cash leave a branch without a recorded handover?
Each “yes” to questions 1, 2, 5, 6 or 8, and each “no” to the rest, is a place where a dispute can start.
What does it cost, and what isn't finished?
These rules have a price in effort. Server functions are larger, because each one does a whole operation or nothing. Requests carry more detail, because they send counts instead of amounts. Every write needs its idempotency key from day one.
I'm also honest about Al Burhan's gaps. The debt I'd pay first is adding tests around the server functions, setting up automated signed builds and keeping the live database changes mirrored in the repository. On the roadmap: the offline queue, push notifications and web dashboards for the CFO, treasurer and branch heads.
For your business, I agree scope, timeline and price in writing before any work starts.
What should you do next?
Run the checklist this week with one branch. You'll usually find the first two or three problems in a single closing.
To see how it fits together, read the Al Burhan case study. If cash in your company moves through several hands and you want numbers nobody argues with, look at what I build and tell me how money moves in your business. I'll reply with questions or a plan for a first call.
About the screenshots: the images are from the Al Burhan Android app, which is Arabic-only by design.
Questions people ask
Why don't my branches' cash totals match at the end of the day?
What is an append-only ledger?
Why should an app store money as integers?
What does idempotent mean for a payment or cash entry?
Can you build a cash-control app for my business?





