Braised-deli buyer - have a coding agent build a single-file reorder calculator
Build me a single-file HTML reorder calculator for a braised-deli buyer to run
before placing an order. Double-click to open, no network, data never leaves the
machine.
Input (one row per material, pasteable straight from a spreadsheet with a fixed
column order):
- Material name, unit
- Trailing 7-day usage total, trailing 14-day usage total
- Current stock, inbound quantity
- Lead time (days), safety stock (days), order cycle (days)
Logic:
- Forecast daily usage defaults to the higher of the 7-day and 14-day daily
averages (rather overstock before a push); a toggle switches to "lower of the
two", and any material where the two bases differ by more than 20% gets
highlighted
- Suggested order = forecast daily x (lead time + safety days + order cycle)
- current stock - inbound
- Negative suggestions display as 0 with a "skip this order" flag
- Each row has a manual override box the buyer can edit; totals respect
overridden values only
Output area:
- Table: material / forecast daily / suggested / overridden / status
- Status is one of: fine / "bases disagree, confirm manually" / "incomplete
input" (any blank required field)
- One-click copy of a plain-text order sheet, formatted to paste into a chat
message to the supplier
Hard requirements:
- Single file, no build step, no external CDN, fonts or libraries
- If pasted data has the wrong number of columns or a shifted order, surface it
loudly in the UI - never silently compute on misaligned data
- No accounts, no cloud save, refresh clears everything - this is deliberate,
do not add localStorage on your own initiative
Why it is written this way
The reorder formula itself is trivial; the cost is the data shuffling in front of it every single time: export sales from the POS, copy stock from freezer records, dig the last order email for inbound quantities, then rebuild the formula in a scratch spreadsheet. Get one sign wrong and next week one material stocks out. Freezing the derivation into a tool moves the buyer's attention to the only judgment call left - whether to override a number.
The formula carries lead time, safety days and order cycle together because the standard shop mistake is provisioning only to the next arrival: the order covers until this delivery, but this delivery has to last until the one after - that gap is where recurring stockouts come from. Baking all three terms into the formula beats putting them in a training slide.
The manual override box is where the human stays. Any forecast basis (higher of two averages) is blind to things the buyer knows: a neighborhood event next week, a product about to be discontinued. The tool's job is arithmetic that is right, not decisions - which is also why totals only respect overridden values and overrides are flagged on the export.
The two "do not add" lines (no accounts, no persistence) come from real experience with coding agents: ask for "a calculator" and you will likely receive a "complete solution" with localStorage settings pages. For a use-and-discard daily tool, persistence is negative value - yesterday's stale row leaking into today's order is worse than not having the tool. Saying "this is deliberate" is what stops the agent from helpfully adding it back.
Variables
This prompt has no blanks to fill in; material data is entered or pasted inside the tool at use time.