2. Stock Levels and Computed Fields

Stock levels are tracked in real time by product, warehouse, and location. For each stock record the system maintains the quantity on hand, the quantity reserved, and the quantity available, along with reorder levels and reorder quantities and valuation figures for unit cost and total value.

Several of these figures are computed fields maintained by the database rather than entered by hand. Quantity available is a PostgreSQL generated column defined as quantity on hand minus quantity reserved, so available stock always reflects current reservations automatically. Total value is a generated column equal to quantity on hand multiplied by unit cost. For adjustments and counts, variance is computed as the counted quantity minus the system quantity.

Because these values are derived at the database level, they cannot drift out of sync with their inputs. When a reservation is placed or released, available quantity updates; when on-hand quantity or unit cost changes, total value recalculates.

These stock-level figures also drive alerting. The system supports reorder points defined by an opening quantity and a reorder level, and the InventoryListPage and related views can surface items that have fallen below threshold through low-stock alerts, which are configurable and threshold based.