N NoBullshit.wiki 中文

Breakfast shop purchasing - the ingredient order-quantity calculator: daily average x cycle + safety days, with minimum-order padding recommended by shelf stability

Works with:Claude / GPT-4 classCategories:Breakfast ShopLevel:Intermediate Updated

Build a single-file HTML ingredient order-quantity calculator for
whoever orders stock at a breakfast shop - tomorrow's order comes
out of a formula, not out of memory.

Inputs (per-item ledger, hand-entered):
- Item: name, unit, unit price, shelf life in days (optional for
  dry goods like flour)
- Usage: the last [N] weeks of daily usage (entered or pasted in
  bulk; the tool computes the daily average and the historical
  peak day)
- Stock: on-hand quantity, on-order quantity (ordered but not
  arrived, with expected arrival date)
- Ordering parameters: days between this batch and the next,
  safety days (per item, set by stockout risk)
- Supplier constraints: minimum order amount, which supplier the
  main items belong to

Calculations and output:
- Suggested-order table (the core):
  suggested = max(0, daily average x (cycle days + safety days)
  - stock - on order)
  Each row also shows a "peak-day gear": recomputed with the
  historical peak-day usage replacing the average - the two gears
  side by side; stockout-sensitive items order at the peak gear,
  dead-stock-sensitive ones at the base gear
- Shelf-life check: for items with a shelf life, verify that
  "suggested + stock" is consumable within one cycle - if not,
  flag it red as "will expire on the shelf" and show the maximum
  order back-calculated from the expiry date
- Minimum-order comparison: this order's total against the
  minimum. When short:
  a. List add-on candidates - existing items ranked by shelf
     stability (longest first; short-life items like eggs and
     fresh milk excluded), each with the amount it adds
  b. Never suggest a new item to pad - a new item padded in
     today is next month's dead stock
- Print view: one A4 page formatted as the order sheet to send
  the supplier (item / quantity / unit), all calculation detail
  collapsed

Implementation requirements:
- Single file, no external dependencies, no network calls;
  ledger in localStorage, survives refresh
- Daily averages computed only from my recorded history - no
  built-in "reference values"
- The peak-day gear uses only a peak that actually occurred in
  my records - no scaling factors of any kind
- No login, no cloud sync

Notes for the coding agent:
- Daily usage entry must support partial memory - "I only
  remember some days" - with the average taken over recorded
  days; items with fewer than [7] recorded days get a "thin
  sample" marker in the results
- The shelf-life check's guidance prints on the page: "if
  arrival date + shelf life < the arrival of the batch after
  next, don't order it yet"

Why it is written this way

The real mechanism behind gut-feel ordering is recency bias: last week's shortage inflates this week's order, while the stock sitting in storage goes unremembered - so the errors run systematically one-directional, inventory accumulates, and the stockouts happen anyway. The formula itself (average x (cycle + safety days) - stock - on order) is unremarkable; the point is the two gears side by side: base on the average, ceiling on the historical peak day, making the trade-off between stockout-sensitivity and dead-stock-sensitivity explicit instead of hiding it inside a coefficient. The tool doesn't make that choice for anyone - both gears displayed, eggs at the ceiling and flour at the base is the judgment the buyer is best positioned to make about their own store.

Both "breakfast-specific" designs come from real ordering moments. Ranking add-on candidates by shelf stability when under the minimum targets the randomness of cart-padding: twenty short, pad a box of some new consumable, and that box is next month's dead stock - so the tool only recommends adding existing items, and short-life ones are excluded. The red "will expire on the shelf" check backstops in the other direction: however correct the arithmetic on a fresh item's quantity, it's wrong if it can't be consumed within the cycle - this check turns FIFO common sense into a forced question before submission.

"Peak gear from a real recorded day, no scaling" and "no built-in reference values" are two faces of one discipline: this tool's credibility rests entirely on saying only what the entered data supports. Build in a "reference daily average" or a safety multiplier, and the buyer starts leaning on that number whenever data runs thin - a number with no basis for this store. Flagging thin samples instead of refusing to calculate leaves an honest workspace: a new store or a new item genuinely has no data for its first weeks, and marking that beats refusing to help.

Variables

Variable Notes
Usage window N Weeks of data behind the daily average - two minimum; drop holiday weeks
Safety days Per-item stockout buffer - more where suppliers are unreliable, less with frequent deliveries

order sizingsafety stocksingle-file tool