# 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.

Checked 2 December 2026. By Bohuslav Poláček. https://meadowstack.com/screens/till-close/

*The demo's open shift at 10:24 with a count typed short, rendered from the kit when the site was built: the difference shows and the reason field has appeared.*

A live screen, rendered from the kit's components on the page: https://meadowstack.com/screens/till-close/

Open it in the live demo: https://meadowstack.com/demo/?lang=en#/riverside/pujcovna/uzaverka

From the example app [An app for a sports club](https://meadowstack.com/examples/sports-club-court-bookings/).

## 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.ts` closes 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](https://meadowstack.com/components/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](https://meadowstack.com/patterns/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](https://meadowstack.com/patterns/form/) with one field and one ink button, and every change of a shift lands in its [history](https://meadowstack.com/patterns/audit-trail/).

## The drawer, worked out

*From the demo's till rules: deposits handed back, sales split by payment, and the cash that should be in the drawer, every sum rounded to the penny.*

From `apps/demo/src/modules/rentals/domain/till.ts` in the Meadowstack repository:

```ts
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

*The example apps whose code renders an overview screen, read from the demo's source.*

| Example app | Modules | Side panel first | Decision card | History |
| --- | --- | --- | --- | --- |
| [An app for a studio or agency](https://meadowstack.com/examples/agency-capacity-planning/) | 5 | Yes | Yes | Yes |
| [An app for a haulage company](https://meadowstack.com/examples/haulage-dispatch-planning/) | 4 | Yes | No | Yes |
| [An app for a roastery with an online shop](https://meadowstack.com/examples/coffee-roastery-production/) | 5 | Yes | No | Yes |
| [An app for a sports club](https://meadowstack.com/examples/sports-club-court-bookings/) | 5 | Yes | Yes | Yes |
| [An app for a construction company](https://meadowstack.com/examples/construction-site-management/) | 8 | Yes | Yes | Yes |
| [An app for an accounting office](https://meadowstack.com/examples/accounting-office-documents/) | 4 | Yes | Yes | Yes |
| [An app for restaurants and venues](https://meadowstack.com/examples/restaurant-staff-rota/) | 5 | Yes | Yes | Yes |
| [An app for one person](https://meadowstack.com/examples/personal-app-for-a-creator/) | 4 | Yes | No | Yes |

Read from the demo's source when the site was built: 8 of 9 example apps render a <Screen archetype="overview">. Side panel first means RecordPeek, the decision card ApprovalPanel, the history AuditTimeline.

## 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 club](https://meadowstack.com/examples/sports-club-court-bookings/) (Example app)
- [A change order that shows its price before anyone approves it](https://meadowstack.com/screens/change-order-form/) (Screens)
- [A fleet cost report that ranks every truck](https://meadowstack.com/screens/fleet-costs/) (Screens)
- [A kitchen's food safety day, kept by the clock](https://meadowstack.com/screens/food-safety-checks/) (Screens)
- [A month close that knows what each step waits for](https://meadowstack.com/screens/month-end-close/) (Screens)
- [Bank lines matched to the documents they paid](https://meadowstack.com/screens/bank-reconciliation/) (Screens)
