Postman collection
Suppliers Read

pixiGetHistoricalSupplierPriceMatching

Returns FIFO-matched supplier purchase prices and selling prices for stock movements of one or all items within a date range of up to 31 days.

Returns the historical FIFO matching between stock receipts (with their supplier price) and stock issues (with their selling price), based on the inventory bin item log.

Parameter validation

  • DateFrom and DateTo must both be passed, even though they are declared with a NULL default.
  • Both values are reduced to their date part. The end of the range is DateTo + 1 day.
  • The range from DateFrom to DateTo + 1 day must not exceed 31 days.
  • DateTo must be at most yesterday; data for the current day cannot be requested.

Selection

  • If ItemKey is passed, only that item is returned; otherwise all items.
  • A receipt is included if its creation date or the modification date of its supplier price record lies between DateFrom and DateTo + 1 day (both bounds inclusive, compared as dates at midnight).
  • Receipts are combined with issues in two ways, and the results of both are added together:
    1. issues that reference the receipt record directly,
    2. issues that match the receipt by item and FIFO row number.
  • For each match the supplier price, the selling price, the source descriptions of both prices, the delivery (own delivery or assigned delivery) and the sales document line (invoice line or POS line) are collected.

Output

  • If no rows were found, a single row with Staus = Warning is returned.
  • Otherwise the data rows are returned, sorted by InvBinItemLogId. The supplier delivery note number is looked up from the supplier delivery; the sell document date and number come from the invoice or, if there is none, from the POS receipt.
  • Any error, including the validation errors, is returned as a row with Staus = Error and the error text in Message.

Notes

  • The status column is spelled Staus (not Status) in both the warning and the error row.
  • Errors are never returned as SqlMessage; the RAISERROR calls are caught and returned as a normal row. Check the first column name of the result to distinguish data from status rows.
  • The upper bound is inclusive at midnight of DateTo + 1 day, so records created exactly at 00:00 on the following day are also included.
  • If DateFrom is later than DateTo, no validation error occurs; the call simply returns the Warning row.
  • A receipt/issue pair may appear twice if it matches both join paths (direct reference and item + row number); rows are not de-duplicated.
  • All tables are read with NOLOCK, so uncommitted data may be returned.
  • The temporary table is dropped via util.TempTableDrop, whose definition is not attached.

Tables used

InvBinItemLog_In · Read InvBinItemLog · Read InvBinItemLog_In_Price · Read InvBinItemLog_QuerySource · Read InvBinItemLog_Out · Read InvBinItemLog_Out_Price · Read SDelHeader · Read Invlines · Read Invoices · Read POSitem2 · Read POSheader2 · Read
SQL object:
dbo.pipiGetHistoricalSupplierPriceMatching
Updated at 2026-10-30