Ingredient Stock Architecture
Overview
Every change to ingredient stock writes the same two records, whether it comes from the admin console, the POS, or a sale:
| Record | Purpose |
|---|---|
| Ingredient Inventory | The current stock for one ingredient at one outlet (Stock Control › Ingredient Inventory). |
| Ingredient Transaction | The ledger line showing what changed, why, and the stock before and after (Stock Control › Ingredient Transactions). A line can't be edited or deleted. |
The ledger is the history. The inventory row is the latest count.
How a change is recorded
A change made in the admin or on the POS, or by receiving a stock order, goes through the same steps: Rewardly checks that the movement's Type and Reason belong together, writes the ledger line with the stock before and after, and updates the outlet's count — both records together or not at all. A sale, void or refund writes the same two records from the order itself.
What creates stock movements
| What you do | Ledger line written (Type · Reason) |
|---|---|
| Create an ingredient inventory row with a starting count | Adjustment · Inventory Count, from 0 to the starting stock. |
| Edit Current Stock in the admin, or update a count in the POS Check Stock | Adjustment · Inventory Count, from the previous count to the new one. Saving the same number writes nothing. |
| Delete an ingredient inventory row that still has stock | Adjustment · Inventory Count bringing the stock to 0, then the row is removed. |
| Create a manual ingredient transaction | In or Out, with a reason that matches the type. Adjustments come only from setting a count. |
| Receive a stock order, in the admin or on the POS | In · Purchase for each line received. |
| Sell a product, modifier option, or combo option that has a recipe and ingredient tracking on | Out · Consumption, linked to the order. If the outlet has no inventory row for the ingredient, it is created at a negative count. |
| Record a batch in Make Stock on the POS, for a product with a recipe and Ingredient tracking off | Out · Consumption at the making outlet, noted Made in-house, MK-…. A missing inventory row is created at a negative count, as for a sale. |
| Cancel entry on that batch | In · Return for each line the entry took, noted Made in-house cancelled, MK-…. |
| Void items, cancel, or refund a sale | Follows the ingredient's On Void: In · Return; In · Return then Out · Waste; or nothing. An order cancelled because it was never paid always gets In · Return. Nothing is returned at an outlet that has no inventory row for the ingredient. |
Movement rules
Each transaction type only accepts reasons that match that type.
| Type | Reasons |
|---|---|
| In | Purchase, Delivery, Return, Transfer In, Production, Other In |
| Out | Consumption, Waste, Expiry, Damage, Transfer Out, Theft, Other Out |
| Adjustment | Inventory Count, Correction, System Adjustment, Quality Check, Other Adjustment |
For example, an Out movement cannot use the reason Purchase, and an In movement cannot use the reason Consumption. An In or Out quantity must be more than 0. The manual Create form offers only In and Out; setting a count is what writes an Adjustment (Inventory Count). The other adjustment reasons appear in the Reason filter of the ledger.
Inventory edit rules
Once an ingredient inventory row exists, its Outlet and Ingredient are locked. Only the current stock count can be changed, and each ingredient has one row per outlet.
This prevents an old inventory row from being reused for a different outlet or ingredient, which would make old ledger entries point at the wrong stock record.
Order receiving rules
When a stock order is received:
- Each received line creates an In · Purchase transaction.
- The inventory count for that outlet and ingredient increases.
- A line cannot receive more than the remaining ordered quantity.
- Only a Confirmed or Partially received order can be received: a Draft has to be confirmed first, and a Received or Cancelled order is closed.
- If only part of the order is received, the order stays partially received until the remaining quantities are received.
Delete guards
Rewardly blocks deletes that would leave broken links:
| Delete action | Blocked when |
|---|---|
| Delete supplier | An ingredient or stock order still uses the supplier. |
| Delete ingredient | The ingredient is in a recipe, still has stock at an outlet, or is on an open stock order (Draft, Confirmed or Partially received). Archive it instead by switching off Is Active. |
| Delete ingredient bundle | A product uses it as its recipe, or a modifier option uses it. |
These guards stop new broken links. They do not repair records that already pointed at something deleted before the guards existed: a recipe line whose ingredient no longer exists is left out of deductions and costs.