Fresh-food store owner-operator - have a coding agent build the single-file daily true P&L calculator (cash-in is not profit)
Build me a single-file HTML daily P&L calculator for the owner-operator of
a neighborhood fresh-food store, used on a phone right after close. It
opens straight to the entry screen; one minute records one day.
Fields recorded each day (all may be left blank - but blanks have
consequences, see below):
- Today's purchases (credit purchases count too: goods arrived = booked)
- Today's takings: cash and card/QR in two separate boxes
- Yesterday's and today's inventory valuation (the owner's own rough
estimate, at cost)
- Today's spoilage, at cost
- Today's household & gift usage, at cost, rounded is fine
Calculation logic (fixed in code, explained to the owner in one plain
sentence on screen):
- Cost of goods sold today = yesterday's inventory + today's purchases
- today's inventory - spoilage - household usage
- Gross profit today = cash + card - cost of goods sold
- Daily fixed cost = (monthly rent + utilities + wages + other fixed) / 30,
entered monthly in settings, amortized automatically
- Net result today = gross profit - daily fixed cost
- Break-even line = daily fixed cost / target gross margin (set in
settings, default 25%), displayed as "takings must pass $X today to
break even"
- If either inventory figure is missing: no gross profit for that day.
Show "can't compute today - fill in the inventory estimates first."
Better no number than a wrong number
Output area (one screen, large type):
- Today: gross profit, net result (green if positive, red if negative),
takings vs. break-even line
- This month: cumulative net result, days recorded, daily average
- Savings prompt: on any positive net day, show "consider transferring $X
out today" at the ratio set in settings (default 50%). On negative days
this line disappears entirely
Hard requirements:
- Single file, no build step, no CDN of any kind, opens directly in a
phone browser
- Daily records and settings live in localStorage and never leave the
device; no accounts, no cloud sync, no "export to server" - this is
deliberate
- A "copy month summary" button outputs plain text (one line per day:
date / takings / gross / net) that pastes cleanly to an accountant or
an archive note
- Implausible entries (negative takings, inventory swing larger than
purchases) turn the box red with one plain-language sentence; never
silently absorb bad input
Why it is written this way
The owner-operator's biggest accounting error is reading the till as profit. Takings ignore the unsold portion of today's purchases, the vegetables eaten at home, and a day of rent and power - skip all three and every single day "feels profitable." The formula forces inventory valuation into cost of goods sold because that is the silent drain behind "I keep making money but the savings never grow": goods pile up on the shelf, the cash looks great, the net worth shrinks nightly.
"Better no number than a wrong number" is the tool's floor, not a slogan. Miss one day of inventory estimates and that day's gross profit is wrong - and one wrong day corrupts the whole month-to-date. Most bookkeeping apps plug a zero into the gap and keep computing, producing a complete-looking wrong number. This spec demands the gap be shown as a gap, so it gets filled tonight instead of discovered at month-end.
Deriving the break-even line from a target margin gives the owner a daily anchor: "takings must pass $2,300 today" outperforms "watch your costs" by a mile. The 25% default is only a starting value - margins vary wildly between stores - which is why it lives in settings, not in code.
The savings prompt looks like scope creep but addresses the real owner-operator pain: shop money and household money share one pocket, so the month "was profitable" yet ends empty. A nightly one-line nudge to transfer a share out turns saving from a monthly resolution into a ten-second daily action. And localStorage-only, cloud explicitly banned: this ledger is the store's medical record - it is sensitive, so the tool must work fully offline.
Variables
| Variable | Notes |
|---|---|
| Target gross margin | Default 25%; affects only the break-even line, never the P&L itself; set per your mix |
| Fixed-cost stack | Rent / utilities / wages / other, entered monthly, refreshed at month end |
| Transfer ratio | Default 50%; lower it if household and shop money are already separated |