Postman collection
Statistics Read

pixiGetItemSalesStats

Returns sales statistics for one item: quantities sold in the last 30/120/365 days, open and held quantities, open single-item orders and the ABC class.

Returns one row of sales figures for a single item.

  1. Item lookup: the item is identified by EANUPC or ItemNrInt. The first item (lowest ItemKey) whose EAN matches @EANUPC or whose internal item number matches @ItemNrInt is used.
  2. Open single-item orders (Open1SS): counts all orders that contain at least one order line of this item with status ANG and whose order lines (all lines of the order, any status) add up to a total quantity of exactly 1.
  3. Sales buckets: all order lines of the item with an order date within the last 365 days (relative to the current date and time) are considered, except lines with status STO or NLB.
    • Sales30: quantity ordered in the last 30 days
    • Sales120: quantity ordered in the last 120 days (includes the 30-day range)
    • Sales365: quantity ordered in the last 365 days
    • OrderQtyANG: quantity of lines with status ANG within the last 365 days
    • OrderQtyHAL: quantity of lines with status HAL within the last 365 days
  4. ABC class: determined by the item tags A, B or C (checked in this order); empty string if none of these tags is assigned.

Notes

  • All reads use NOLOCK, so figures may include uncommitted data.
  • If both parameters are passed, they are combined with OR; the item with the lowest ItemKey matching either value is used. Pass only one identifier to avoid ambiguity.
  • If no item is found, no error is returned: Open1SS is 0, ABC and all sales columns are NULL.
  • The sales columns are NULL (not 0) when there are no matching order lines in the respective range.
  • The time ranges are computed from the current date and time (GETDATE() minus n days), not from midnight.
  • Open1SS sums the quantity of all lines of an order, including lines of other statuses (e.g. cancelled lines), when checking for a total of 1.

Tables used

items · Read Orderlines · Read Tag · Read TagMatch · Read
SQL object:
dbo.pipiGetItemSalesStats
Updated at 2026-10-30