Postman collection
Invoices Read

pixiReadInvoices

Returns invoice headers from Pixi, filtered by invoice key or number, by creation and/or update date, or as a key-ordered page.

Reads invoice header records from Invoices. The currency code is taken from pixi.Currency, and the highest-level per-invoice reminder from Reminders is used for reminder data. All modes return the same columns, sorted by InvoiceKey ascending.

If RowCount is set to a value other than 0, the number of returned rows is limited to it. A missing InvoiceKey is treated as 0.

The first matching mode is used:

  1. Create or update date: CreateAndUpdateDateFrom or CreateAndUpdateDateTo is set. Returns invoices with InvoiceKey > InvoiceKey whose CreateDate or UpdateDate lies between the two values. Both bounds are inclusive (BETWEEN).
  2. Create date: CreateDateFrom or CreateDateTo is set. Returns invoices with InvoiceKey > InvoiceKey and CreateDate >= from and < to. Either bound may be left out.
  3. Update date: UpdateDateFrom or UpdateDateTo is set. Same logic on UpdateDate.
  4. Key range / paging: RowCount is passed. Returns invoices with InvoiceKey greater than the given InvoiceKey. For paging, pass the last key received as the next InvoiceKey.
  5. Single invoice: otherwise returns the invoices with InvoiceKey = InvoiceKey or InvoiceNr = InvoiceNr.

In modes 1–3 the key condition also applies, so date filters can be combined with InvoiceKey and RowCount for keyset paging. InvoiceNr is only used in mode 5.

The column ReminderLevel returns the highest HighestReminderLevel from Reminders for the invoice, and ReminderCosts returns that reminder's costs. If no such reminder exists, both columns fall back to the values stored on the invoice. VoucherSum_OrderCurr is the gross voucher sum for OrderType B2C and the net voucher sum otherwise.

Notes

  • All reads use NOLOCK, so uncommitted data can be returned.
  • Invoices without a matching record in pixi.Currency (inner join on CurrencyId) are never returned.
  • Pitfall in mode 1: if only one of CreateAndUpdateDateFrom / CreateAndUpdateDateTo is given, the OR condition is always true. All invoices above InvoiceKey are then returned. Always pass both bounds.
  • Pitfall in mode 4: passing InvoiceKey together with RowCount returns the invoices after that key, not the invoice itself. InvoiceNr is ignored as soon as RowCount or a date filter is passed.
  • RowCount = 0 still selects mode 4, but without any row limit. This can return all invoices.
  • Without any parameters, mode 5 searches for InvoiceKey = 0 and normally returns an empty result. The final fallback branch (WHERE 1 = 0) is never reached.
  • The row limit uses SET ROWCOUNT.
  • The columns Total_OrderCurr, Total_ShipCost_OrderCurr, VATBaseHigh_OrderCurr, VATBaseLow_OrderCurr, VATHigh_OrderCurr, VATLow_OrderCurr, VATBaseHigh_ShipCost_OrderCurr and VATBaseLow_ShipCost_OrderCurr are only copies of other columns. Code comments mark them for removal, so they should not be relied on.

Tables used

Invoices · Read Currency · Read Reminders · Read
SQL object:
dbo.pipiReadInvoices
Updated at 2026-10-30