Managing Stock Periods

There is a full API collection that allows creating, closing and reopening stock periods, to reconcile an outlet's stock between two full counts and lock the result. These endpoints require the stock periods module to be enabled for the library.

Stock periods and variance

A stock period is the window between two full counts. Across the period, Apicbase tracks the theoretical stock it derives from every movement in the window: goods received, production, transfers, waste and sales. The full count at the start sets the period's opening value, and the full count at the end records what was actually on the shelves.

The variance is the difference between that counted closing stock and the theoretical stock. It is the number a manager acts on, and Get Stock Period Summary returns it together with the movement totals behind it.

Closing a period freezes its figures, so the reconciled result cannot drift as events are added or edited afterwards.

Period statuses

StatusDescription
OPENThe period is running. Its figures are computed live.
CLOSEDThe period has been closed against its closing count. Its figures are frozen.
REOPENEDA closed period was reopened so a correction can be made. It behaves like an open period until it is closed again.

An outlet can have more than one open period at a time. A monthly accounting period running alongside a weekly operational one is normal.

Step by step instructions

These steps should be followed in this order to reconcile a stock period via the Apicbase API:

  1. Create a stock period, passing the finalised full count that opens it as opening_count_id. See Recording Count Events for how to submit a full count.
  2. At the end of the period, submit the full count that closes it.
  3. Check the period's warnings. They list what still needs attention before the period can close: negative stock, orders still outstanding and events still open. Make sure POS sales have synced as well: sales that arrive after the close cannot be applied to the period.
  4. Close the stock period, passing the closing count as closing_count_id. The count can also be attached beforehand with Edit Stock Period.
  5. Get the stock period summary to read the frozen figures.

The figures are only frozen at step 4, when the period is closed.

To record a period that has already run its course, pass both opening_count_id and closing_count_id when creating it. The period is then created already closed.

Closing and undoing in order

Periods close oldest-first: an earlier open period in the outlet must be closed before a later one can be.

Undoing runs the other way. To reopen or delete a period, start from the most recent period and work backwards. A period cannot be deleted while it is closed, or while a later period is closed.

Reopening a closed period

Reopen a stock period to correct it. Only periods that ended within the last 180 days can be reopened. Make the correction, then close the period again to refreeze it.

Changing a reopened period's contents also re-derives the figures of every later period.

📘

A closed period's figures are recomputed when an earlier period is closed or a historical period is inserted before it.

The figures are stable in normal use, but they are not guaranteed to be immutable. If you store them downstream, re-read the period after any change to an earlier one.


Did this page help you?