Postman collection
Reports Read

pixiReportGetStockItems

Returns a stock evaluation per item with stock quantity, average purchase price, stock value, stock age, last order date and sales quantities for three periods.

Builds a stock evaluation report for all items that have at least one bin entry in InvBinItem. According to the header comment it was made for stock evaluation and price recalculation for a specific customer (GCH).

Filter

  • If SupplNr is set, only items whose Items.SupplNr equals this value are included. If it is NULL (default), all items with bin entries are returned.
  • Items without any InvBinItem row are not returned. Items whose bin rows add up to 0 are still returned.

Calculated values per item

  • EK: average supplier price from fPixi_GetAverageSupplPrice. It averages AddItems.SupplPrice of all supplier records linked through the item's IntLinkNr1, ignoring NULL and 0 prices and the supplier MGS. If no such price exists, 0 is returned.
  • AnzahlArtikelAufLager: sum of BinItemQty over all bin locations of the item.
  • EKGesamt: stock quantity multiplied by EK.
  • AufLagerSeit / AufLagerSeitTage: earliest UpdateDate in InvBinItemLog with a positive quantity, and the number of days since then.
  • LetzteBestellung / LetzteBestellungTage: latest OrderDate of any order line for the item, and the number of days since then.
  • soldRange1, soldRange2, soldRange3: sum of Orderlines.Qty for order lines with an OrderDate within the last SoldRange1, SoldRange2 or SoldRange3 days, counted back from the current server time.

The result has no defined sort order and no paging.

Notes

  • All tables are read with NOLOCK, so the figures can include uncommitted data.
  • Sales quantities and the last order date count all order lines of the item, regardless of order or line status (for example cancelled lines are not excluded).
  • soldRange*, LetzteBestellung, AufLagerSeit and the day columns are NULL if there are no matching order lines or log entries.
  • The average purchase price always excludes the supplier MGS; this is hard-coded in fPixi_GetAverageSupplPrice. The function's fallback query is identical to the first query, so it effectively returns 0 if no price is found.
  • Each item triggers several correlated subqueries and a scalar function call. Without a SupplNr filter the call can run for a long time on large catalogues.

Tables used

Items · Read InvBinItem · Read InvBinItemLog · Read Orderlines · Read AddItems · Read
SQL object:
dbo.pipiReportGetStockItems
Updated at 2026-10-30