Closing the till at the end of a shift
At the end of a shift the app works out what should be in the drawer from the shift's own sales: the starting cash, cash sales and hire fees, cash deposits taken, less cash deposits given back. The person at the desk types only the count, sees the difference at once, and gives a reason before a shift that is off can close.
By Bohuslav PoláčekChecked
What the screen shows
- The headline: what the shift took and how many hires are still out, the sentence every overview opens with.
- The open shift: who opened it and when, then four figures: takings with the number of sales, cash, card with what is held on cards (a hold is not takings), and the deposits in the drawer for the hires still out.
- Count the cash beside Cash in the drawer: one field for the count, what should be there, the difference, and Close the shift.
- Shifts: every shift with its takings and its difference, the running one on top, and the shift's history beside them.
Worked out, not typed
The drawer is arithmetic nobody at the desk has to do:
| Line | Why it is there |
|---|---|
| Starting cash | The float the shift opened with. |
| plus cash sales and hire fees | Card payments never touch the drawer. |
| plus cash deposits taken | A deposit is not takings, but its cash sits in the drawer until the things come back. |
| less cash deposits given back | Less the part kept for damage, which became takings. |
| Should be in the drawer | What the count is compared with. |
A deposit paid by card is a hold, released when the things are back, and a sale cancelled in its own shift never happened for the till. These rules are pure functions in the rentals module's domain/till.ts, shared by the sale screen, the stock page, the close and the api, and pinned by unit tests in apps/demo/test/rentals-till.test.ts. Every sum is rounded to the penny (cents()), because to a float three times 0.6 is not 1.8.
The count and the close
- The only thing typed is the count. The field's placeholder is the expected amount, and the difference shows as it is typed: Matches, Short by or Over by.
- A count that is off brings up "Reason for the difference", and the shift does not close without it.
- Close the shift is the form's ink button. After it nothing can be sold or hired in that shift, and the closed shift keeps its report: counted, expected, the difference, the reason and who closed it.
- Only the site manager opens a closed shift again (
rental.shift.reopen). The front desk opens and closes shifts but never reopens one;e2e/riverside-rentals.spec.tscloses a shift as the desk with a difference and a reason, then reopens it as the manager.
Who sees which shifts
The front desk sees its own shifts, and the table says so; the site manager sees every cashier's (rental.shift.all), so the table gains a Cashier column. The data table hides columns by its own width, not the screen's: beside the count form the expected and counted amounts give way and the difference stays, and where it is narrower the cashier folds under the shift's name. On a phone the count comes first and the history after it, because the count is what the person came for.
What AI coding tools get wrong here
Asked for a cash-up screen, a coding assistant tends to give the cashier an Expected field to fill in, add card payments to the cash, count deposits as takings, add money as floating point and round it only on screen, and let anyone press Close whatever the count says.
In Meadowstack the figures come from one domain file that the screen, the api and the tests share; a drawer keeps its pence whatever the amount (the rentals module's money(), where a price list may drop them); the screen asks can() and the rules live in domain/permissions.ts; and an overview cannot leave out its headline, a required prop of the screen type, so the screen opens with what the shift took. The close itself is a form with one field and one ink button, and every change of a shift lands in its history.
The drawer, worked out
const returns = sales.filter(
(sale) => sale.status === "paid" && sale.hire?.status === "returned" && sale.hire.returnedShiftId === shift.id,
);
const charge = (sale: Sale) => sale.hire?.charge ?? 0;
const chargesCash = sum(byPayment(returns, "cash"), charge);
const chargesCard = sum(byPayment(returns, "card"), charge);
const salesCash = sum(byPayment(paid, "cash"), saleFee);
const salesCard = sum(byPayment(paid, "card"), saleFee);
const depositsInCash = sum(byPayment(paid, "cash"), saleDeposit);
const depositsOutCash = sum(byPayment(returns, "cash"), (sale) => saleDeposit(sale) - charge(sale));
const heldNow = sales.filter((sale) => isOutAt(sale, at));
return {
salesCash,
chargesCash,
revenueCash: cents(salesCash + chargesCash),
revenueCard: cents(salesCard + chargesCard),
revenue: cents(salesCash + chargesCash + salesCard + chargesCard),
salesCount: paid.length,
cancelledCount: cancelled.length,
cancelledTotal: sum(cancelled, (sale) => saleFee(sale) + saleDeposit(sale)),
depositsInCash,
depositsOutCash,
cardHoldsPlaced: sum(byPayment(paid, "card"), saleDeposit),
charges: cents(chargesCash + chargesCard),
depositsHeld: sum(byPayment(heldNow, "cash"), saleDeposit),
cardHolds: sum(byPayment(heldNow, "card"), saleDeposit),
float: shift.float,
expectedCash: cents(shift.float + salesCash + depositsInCash - depositsOutCash),Where to open an overview screen
| Example app | Modules | Side panel first | Decision card | History |
|---|---|---|---|---|
| An app for a studio or agency | 5 | Yes | Yes | Yes |
| An app for a haulage company | 4 | Yes | No | Yes |
| An app for a roastery with an online shop | 5 | Yes | No | Yes |
| An app for a sports club | 5 | Yes | Yes | Yes |
| An app for a construction company | 8 | Yes | Yes | Yes |
| An app for an accounting office | 4 | Yes | Yes | Yes |
| An app for restaurants and venues | 5 | Yes | Yes | Yes |
| An app for one person | 4 | Yes | No | Yes |
Questions
Does the cashier type the expected amount?
No. The app works out what should be in the drawer from the shift's sales. The cashier types only what they counted, and the expected amount is the field's placeholder.
What happens when the count does not match?
The difference shows as soon as the count is typed, short or over, and a field for the reason appears. The shift does not close until the reason is written.
Do card payments count towards the cash in the drawer?
No. Card takings and deposit holds on cards never touch the drawer. The figures show them apart, and a hold is not counted as takings.
Can a closed shift be opened again?
Only by the site manager. The front desk opens and closes shifts, and after a close nothing can be sold or hired in that shift until the manager reopens it.
Why are the till's sums rounded to the penny?
Because floating point does not add money exactly: to a float, three times 0.6 is not 1.8. Every sum in the till's rules is rounded to the penny, and a unit test checks that very case.
Related
- An app for a sports clubExample app
- A change order that shows its price before anyone approves itScreens
- A fleet cost report that ranks every truckScreens
- A kitchen's food safety day, kept by the clockScreens
- A month close that knows what each step waits forScreens
- Bank lines matched to the documents they paidScreens
Two ways
Build it yourself, or have it built
Build it yourself
Build your app on the framework
Get the codebase these apps stand on and build yours with Claude Code, Cursor or Codex.
One payment, lifetime updates
Get the frameworkHave it built
Have us build your app
Tell us how your team works. We plan the app with you and build it on the same framework at a fixed price.
After launch, Care keeps it improving, from €99 a month.
from €1,990
Describe your app