Postman collection
Stock Read

pixiGetItemStockOnLocations

Returns the physical stock of an item per location plus a total row 'All' with physical, available and really available quantities.

Returns stock figures for one item, either on all locations or on a single location.

  1. Item lookup: if ItemKey is given, it is used directly. Otherwise the item is searched in pixi.ItemCode by EAN, ItemNrSuppl or ItemNrInt. A code matches if it equals any of the three values and has code type 1, 2 or 4. The first match is taken (TOP 1).
  2. Total row: from items one row with Location = All is built:
    • PhysicalQTY = item quantity
    • AvailQTY = quantity minus special stock (ItemQtyIBISpecialStock_1) minus open reservations
    • RealQtyAvail = quantity minus special stock minus open order lines
    • SpecialStock = 0
  3. Location rows: for every entry in ItemLocationSpecific of the item, one row with the location ID, the location quantity as PhysicalQTY and the SpecialStock flag of the location is returned. If LocationId is set (not empty), only the location with this LocID is returned.
  4. Location rows and the total row are combined with UNION, so identical rows are removed.

The All row is always part of the result as long as the item exists, even if LocationId is set. If no item is found, the result set is empty.

Notes

  • AvailQTY and RealQtyAvail are item-level totals; they are repeated unchanged on every location row and are not calculated per location.
  • The output parameter Quantity is never assigned by the procedure; it returns only the value passed in (default NULL).
  • The item lookup by code uses TOP 1 without ORDER BY. If several items share a code, which item is used is not deterministic. The meaning of code types 1, 2 and 4 is not defined in the code.
  • No ORDER BY on the result: the order of rows (including the position of the All row) is not guaranteed.
  • All tables are read with NOLOCK, so uncommitted data may be returned.

Tables used

ItemCode · Read items · Read ItemLocationSpecific · Read Location · Read
SQL object:
dbo.pipiGetItemStockOnLocations
Updated at 2026-10-30