Postman collection
Stock Read

pixiDispoGetItemBinLog

Returns aggregated stock movements from the bin item log for an external disposition software (LogControl), optionally summed up per item in inventory mode.

Exports stock movements from InvBinItemLog for an external disposition tool (LogControl).

Selection

  • Only log entries with IBILKEY > @ItemBinLogKeyStart, Qty <> 0 and UpdateDate between @DateStart and @DateEnd (both inclusive). If @DateStart is NULL, 1900-01-01 is used; if @DateEnd is NULL, the current date and time is used.
  • Entries are grouped by update timestamp, ForOrderline, location, item, reason, update employee and stock movement type. Groups whose quantity sum is 0 are dropped.
  • The first @RowCount groups (default 10000), ordered by their lowest log key, are taken. The lowest log key of a group is returned as ItemBinLogKey and PItemBinLogKey.

Movement type code A hard-coded type is derived per group:

  • 0300: outflow (negative sum) not related to an order line
  • 2000: outflow related to an order line (ForOrderline set and not 0)
  • 0200: inflow booked by an employee whose name starts with the value of setting DispoInventoryUser
  • 1000: all other movements

If setting DispoExportAllImportTypes is 1, mode 0 returns the Type of the joined StockMovementTypes record instead.

Supplier order data If the reason contains Picco Del.Nr. followed by a numeric delivery number and the movement has no order line, the procedure looks up the supplier delivery (SDelHeader/SDelDetail), its buying match and the related supplier order line. Order date, internal supplier order number and estimated delivery date are returned; if nothing is found, these columns contain '0'.

Output modes

  • @InventoryMode = 0: one row per group, ordered by ItemBinLogKey, with the absolute quantity and the location.
  • @InventoryMode = 1: movements without order line are summed up per item (type 0300 for a negative total, otherwise 0200); movements with order line are returned individually (type 2000 for outflow, 1000 for inflow). Both parts are combined with UNION and ordered by Type. This mode returns no EstimatedDeliveryDate and no LocationID.

For incremental export, pass the highest ItemBinLogKey of the previous call as @ItemBinLogKeyStart.

Notes

  • All reads use NOLOCK, so uncommitted data may be included.
  • SET NOCOUNT is intentionally not set; the intermediate SELECT ... INTO statements produce row-count messages.
  • fpixi_GetSetting returns '0' when a setting does not exist. If DispoInventoryUser is missing, the inventory user prefix becomes '0', not NULL, so inflows by employees whose name starts with 0 are typed 0200.
  • @DateEnd is compared with the full timestamp: a date like 20110820 means midnight, so movements later on that day are excluded.
  • UpdateDate is returned as text in format dd.mm.yyyy. In inventory mode, MAX(UpdateDate) compares these strings alphabetically, so the result is not necessarily the latest date.
  • In inventory mode, sums run across all locations of an item, @RowCount limits the underlying groups (not the output rows), and UNION removes identical rows. The column order differs from mode 0 (SupplOrderNr before SupplOrderDate) and the item column is named ItemKey instead of ITemKey.
  • The delivery number is taken from position 14 of Reason, which assumes the reason starts with Picco Del.Nr. .
  • An unused LEFT JOIN on SDelHeader via the part of UpdateEmp after / could multiply rows and inflate sums if several deliveries share that number.
  • Temporary tables are dropped via util.TempTableDrop (definition not attached).

Tables used

InvBinItemLog · Read Items · Read StockMovementTypes · Read SDelHeader · Read SDelDetail · Read BuyingMatch · Read SupplierOrderLine · Read SupplierOrder · Read Settings · Read
SQL object:
dbo.pipiDispoGetItemBinLog
Updated at 2026-10-30