N NoBullshit.wiki 中文

Deli stall inventory count specialist - book-versus-actual gap calculator: paste in purchases, sales, and the count, get the gap ranking and the gap rate

Works with:Claude / GPT-4 classCategories:Deli StallLevel:Intermediate Updated

Build a single-file HTML book-versus-actual gap calculator for
a cooked-food stall, for the count specialist (or the owner
doubling in) on count night: paste three tables in, get the
gap ranking out.

Input (typed or pasted whole-table; three fixed column
schemas):
- Purchases: item / opening stock / inbound this period /
  returns (raw-weight terms; cost optional)
- Sales: item / weight sold this period (as-sold, cooked) -
  discounted and written-off weight in separate columns;
  write-offs must leave theoretical stock, not hide inside
  sales
- Count: item / counted quantity (raw items as raw; finished
  and WIP via conversion, below)
- Yield configuration (the key, self-calibrated): one entry
  per product, sourced from a measured batch - "100 raw in,
  X cooked out," X typed by me. Products with no yield
  entered show "missing yield - cannot convert" in the gap
  column; filling it with any built-in benchmark is banned
- Finished/WIP conversion: what's in the pot, on the rack, or
  back in the chiller at count time gets entered at cooked
  weight and converted back to raw terms by the tool before
  hitting the gap - one misplaced decimal in manual
  conversion bends the whole sheet

Calculations and output:
- Theoretical stock = opening + inbound − returns − cooked
  sales converted to raw (sold weight / yield) − write-offs
  converted − discounted sales converted
- Gap ranking (the core): item / theoretical / counted-and-
  converted / difference / gap value / direction (shortage in
  red, overage in yellow - an overage is not a win; it
  usually means missed sales or a stale yield)
- Sort fixed by absolute gap value, descending - the top five
  are tonight's five investigations
- Summary bar: total gap value / share of period revenue -
  over [Z]% the whole bar goes red, with the standing note
  "chase the directional first (one product drifting), the
  random second (small gaps scattered across products)"
- Open-items print view: the top five gaps each with an entry
  point for investigation (which day's slips / the write-off
  log / whether the yield has drifted), one A4 page to carry
  into the storeroom

Implementation requirements:
- Single file, no external dependencies, no network calls;
  the three tables and yield settings persist in localStorage
  across refreshes, ready for next period
- Yields accept multiple measured batches and use the recent
  median - supplier specs and seasons drift, and the freshest
  batches know the current truth
- Unit conversion limited to the stall's own weight system,
  set globally at entry and never mixed inside a table -
  mixed units are the gap sheet's second-biggest pollutant
- No built-in "reference yield" for any product - yield is a
  measured property of this stall's pot; one invented
  universal number and nobody believes this sheet again

Notes for the coding agent:
- Tolerant whole-table paste: skip blank rows, auto-recognize
  headers, and list unrecognized rows for manual confirmation
  - never silently drop them
- Gap values need unit prices; unpriced items show gap weight
  only and sit outside the money sort under a "no price set -
  sorted by weight" notice

Why it is written this way

The gap sheet is hard to build at a deli stall because of the seam in units: the books track raw (birds in), the register tracks cooked (braised duck out), and the seam between them is a yield ratio - one that drifts with supplier sizing, thaw method, and braise craft. A generic coefficient produces a sheet that never reconciles, and twice is all it takes for nobody to open it again. So this tool lives or dies on self-calibrated yield: fed by the stall's own measured batches ("100 raw in, X cooked out"), allowed multiple batches with a recent median, biased toward the newest - the supplier changes spec, the yield follows, and the sheet stops systematically accusing honest people.

Splitting write-offs and discounted sales out of the sales column closes the sheet's hidden pothole: write-offs folded into sales book discarded product at full sales value, inflating theoretical stock and manufacturing a permanent "unexplained" shortage; discounted sales convert like any other but stay listed separately, so month-end can see markdown leakage's own line. The finished/WIP back-conversion (what's in the pot, cooling on the rack, back in the chiller) belongs to the tool for a simple reason: human conversion reliability - one slipped decimal flips the direction of the entire sheet.

Overages flagged yellow instead of green, and the printed note "directional before random," are the tool's two concessions to its user's judgment: an overage is almost never found money - it's the same signal as a shortage, one leg of the ledger limping (a missed sale, or a yield ratio gone stale). And the chase order - a single product drifting consistently (usually a leaking process) before scattered small gaps (usually counting grain) - is the sequence this trade learned the hard way, and it belongs printed on the page rather than in one specialist's head. No built-in yields and globally-unified units share one discipline: every number on this sheet draws its authority from having a home-store source.

Variables

Variable Notes
Gap-rate red line Z Total gap as a share of revenue that turns the bar red - set against this stall's margin structure; a loose line equals none
Yield batch window How many recent measured batches feed the median - stale batches describe the previous supplier, not this one

book-to-actual gapstheoretical stocksingle-file tool