Postman collection
Stock Read

pixiGetChangedItemStock

Returns items whose stock changed in a time window, with physical and available stock, open supplier order quantity and reorder level, paged.

Builds a delta list of stock changes for a stock export.

Time window and locations

  • Since to DateTo defines the window. DateTo defaults to the current time; values up to 1990-01-01 are also replaced by the current time.
  • LocID restricts to one location; empty means all locations.

Candidates

  1. Non-bundle items with entries in InvBinItemLog in the window at the selected locations. StockChange is the sum of the logged quantities, UpdateDate the latest log date.
  2. If IncludeOrderLineChanges = 1, items with order lines updated in the window at the selected locations are added (if not already candidates). They need at least one InvBinItemLog entry; StockChange is then the sum of all logged quantities at the locations, UpdateDate is items.LastCalculateStockDate (fallback: latest log date, then now).
  3. For every candidate that is a component of a bundle (BundleItems), the bundle item is added too, with StockChange = component change divided (integer) by the component quantity.

Sort and paging Candidates are numbered by UpdateDate ascending, then by the latest InvBinItemLog key. Rows with number >= Start + 1 are taken, at most Rowcount. Bundle items that appear without the bundle flag and items no longer in items are skipped. The returned RowNr is renumbered from 1 within the page.

Stock values

  • PhysicalStock = items.Quantity.
  • MinStockQty = sum of non-negative ItemLocationSpecific.MinStockQty for the location (or all locations).
  • For non-bundles: AvailableStock = sum of ItemLocationSpecific.LocationQuantity over all locations without special stock, minus either open order quantities (ANG lines plus HAL lines not older than HalOrdersActiveDays days) or the number of reservations on non-final order lines (excluding states EIN, FUT, FUS), depending on settings. OpenSupplierOrderQTY is the open quantity of supplier order lines whose status is fully open; EstimatedDelivery comes from Item_EstimatedDelivery.ExportEstimatedDelivery.
  • For bundles: AvailableStock stays items.Quantity, OpenSupplierOrderQTY 0, EstimatedDelivery NULL.

Excluded bin groups If ExcludeBinGroups is given (comma-separated), the quantity logged up to DateTo in bins of these groups (locations without special stock) is subtracted from AvailableStock, PhysicalStock and StockChange; for bundles the quantity is derived via the component quantity. PhysicalStockLoc is then the bin quantity at the selected locations outside these groups. Without ExcludeBinGroups, PhysicalStockLoc is the sum of ItemLocationSpecific.LocationQuantity at the selected locations for non-bundles (0 for bundles).

Notes

  • Read-only; all permanent tables are read with NOLOCK, so values may reflect uncommitted data.
  • Passing 1900-01-01 (value 0) as Since turns it into NULL; the window filter then matches nothing and the result is empty.
  • Settings read at runtime: StockExportUsePhysicalStock (if not 0, no order or reservation quantities are subtracted), ReservePrepaymentOrders and ExportAvailableStock_WhenReservationsAreEnabled (choose between open order quantities and reservation count), HalOrdersActiveDays (0 means 7; if the setting is missing, HAL lines are not counted). ExportStock_locations is read but not used.
  • Reservation counts are only applied to items that also have open ANG/HAL order lines, because of the way the intermediate results are joined.
  • AvailableStock for non-bundles uses all locations without special stock, regardless of LocID; only PhysicalStockLoc, MinStockQty and the candidate selection respect LocID.
  • For paging, increase Start by Rowcount for the next page; the returned RowNr always starts at 1. Because UpdateDate ascending is the sort key, new changes during paging can shift positions.

Tables used

Location · Read OrderStates · Read items · Read InvBinItemLog · Read Orderlines · Read BundleItems · Read ItemLocationSpecific · Read SupplierOrderLine · Read SupplierOrder · Read SupplierOrderStatus · Read Reservation · Read Item_EstimatedDelivery · Read InvBin · Read InvBinItem · Read Settings · Read
SQL object:
dbo.pipiGetChangedItemStock
Updated at 2026-10-30