01The challenge
In a pharmacy, the same item from the same supplier arrives with different expiry dates and purchase prices. A single quantity per item cannot answer the two key questions: what expires first, and what did this particular box cost?
The market adds multiple currencies and exchange rates, and accounting that cannot tolerate a single unit of error.
02What we built
We built stock at batch level, and sales automatically dispense the nearest expiry first.
We store the full batch cost with its quantity, so each outgoing cost is calculated proportionally and the total out always equals the total in, to the last unit.
Trust boundaries live in the database: the stock ledger cannot be edited, each pharmacy's data is isolated, and an unbalanced entry is rejected with the exact difference. A desktop app serves each branch.
03The outcome
A pharmacy that knows its stock, costs and expiry dates precisely, with accounting tied to every sale and purchase.