Postman collection
Orders Read

pixiGetOrderHeaderList

Returns header data for several orders identified by their external order numbers, including customer, address, payment, shipping and invoice information.

Takes a list of external order numbers (OrderNrExternal) as XML and returns one row per matching order from OrderHeader.

Steps:

  1. The XML is split into values. Every child element of the root element is read, whatever its name. Duplicate values are removed.
  2. If the list is empty, the procedure prints No Data! and returns no result set.
  3. Two settings are read:
    • UseInitialOrderDate: if 1, OrderDate is the earliest order date of the order lines, otherwise the latest.
    • NumberOfDecimalPlacesForPrices: number of decimals used to round Qty * Price per order line (default 2 if the setting is missing or 0).
  4. Orders are matched on OrderHeader.OrderNrExternal. External numbers that do not match an order are skipped without notice.
  5. An order is returned only if it has a currency, a customer, a billing address (AddrRef) and a shipping address (ShipAdrRef). These joins are inner joins.
  6. Per order, the order lines are aggregated together with their invoice lines, their invoices (only invoices with RefToInvoiceKey IS NULL) and their estimated delivery dates:
    • shipping dates (min/max ScanOutDate), tracking ID, carrier, last invoice number;
    • Paid/PayedSum from the invoices;
    • OrderTotal_OrderCurr = sum of rounded Qty * Price of all lines except status STO and NLB, plus ShipCost, minus Discount.
  7. Gender is derived from the salutation (Anrede) of the shipping address:
    • 1 for Herr, Hr., M., Monsieur, Mr, Mr.
    • 2 for Mrs, Mrs., Ms, Ms., Frau, Fr.
    • 0 for any other value.

The result is sorted by CreateDate ascending.

Notes

  • Read-only. Most tables are read WITH (NOLOCK), so uncommitted data can appear. The subquery for OrderLocked on Addresses runs without NOLOCK.
  • Values are shredded as varchar(256) but stored in a varchar(50) key column. An external order number longer than 50 characters can make the call fail with a truncation error.
  • Empty input does not return an error row. It only produces the PRINT message No Data! and no rows.
  • EstimatedDelivery is filled only if every order line has an estimated delivery date. In that case the latest date is returned. If any line has no date, the column is NULL. Internally, a placeholder date of now + 999 days is used for missing dates and then turned back into NULL.
  • Paid is computed per joined line. Order lines that have no invoice also count as paid, so Paid can be 1 even if the order is not invoiced at all. PayedSum is the highest paid sum among invoices whose PayedSum equals their total rounded to 2 decimals.
  • The order lines are joined to invoice lines and estimated delivery rows. If one order line has several invoice lines or several delivery rows, it is counted more than once in OrderTotal_OrderCurr.
  • Line prices come from Price (not the order-currency price), although the column is called OrderTotal_OrderCurr.
  • The source table of SubShopName and SubShopLogo is not qualified in the code. Most likely they come from OrderHeader.
  • Gender mapping uses exact matches on the salutation. Whether the match is case-sensitive depends on the database collation.

Tables used

OrderHeader · Read Currency · Read Customers · Read Addresses · Read Orderlines · Read Invlines · Read Invoices · Read Orderline_EstimatedDelivery · Read Settings · Read
SQL object:
dbo.pipiGetOrderHeaderList
Updated at 2026-10-30