Postman collection
Invoices Read

pixiGetInvoiceLinesPrinted

Returns the lines of an invoice prepared for printing, grouped per order line, with optional bundle combining and a fallback line for invoices without lines.

The call passes InvoiceNr to the internal procedure GOS_PrintInvLine and returns its single result set.

Steps:

  1. The invoice is looked up by InvoiceNr in Invoices (joined with pixi.Currency). Its key, pick list header (PLHref), credit-note reference (RefToInvoiceKey) and DiscountTotal are read.
  2. All invoice lines (Invlines) of the invoice are joined with their order lines, items, country of origin and the item code of type 3 (InternalItemNumber). Lines are grouped by the parent order line (OriginalOrderlineRef, or the order line itself if it was not split) plus price, VAT, discount, serial number, batch, best-before date and further attributes. Quantities and amounts are summed per group.
  3. For each line the first bin name and the number of pick list items are taken from the pick list of the invoice (BinName, QtyFromBin).
  4. Bundles: if the setting CombineBundles = 1 and the invoice is not a credit note (RefToInvoiceKey is NULL), all component lines of a bundle are combined into one line with the data of the bundle order line (BundleOrderlines) and the bundle item. The number of bundles is derived from the component quantity divided by the quantity per bundle from BundleItemsHistDetail (or the bundle order line quantity if no history exists). Otherwise every component line is returned on its own.
  5. If no line results (invoice without lines), one pseudo line is built from the invoice header: text from TextIfNoInvlines, OrderQty = 1, price = invoice total minus shipping cost, VAT code and tax rate derived from the high/low VAT bases. In this row OrderNr holds the invoice key and OrderNrExternal the invoice number.
  6. The result is sorted by ArtName. Each row additionally carries the invoice-level discount as InvoiceTotalDiscount.

The setting UseInitialOrderDate controls OrderDate: 0 returns the latest order date of the grouped order lines, 1 the earliest.

Notes

  • The parameter is declared as varchar(50), but the internal procedure accepts only varchar(25); longer invoice numbers are silently truncated.
  • If the invoice number does not exist (or the invoice has no matching currency in pixi.Currency), the result set is empty; no error is returned.
  • All reads use NOLOCK, so uncommitted data may be returned.
  • The settings CombineBundles and UseInitialOrderDate are read at runtime via fpixi_GetSetting; ItemTagList is built by fpixi_GetItemTAGsNamesAsString. Neither function is attached.
  • Columns such as itemprice_ordercurr, ItemAmount_OrderCurr, USDamount and EURamount are legacy duplicates (comments mark them for removal); they contain the same values as the invoice-currency columns.
  • ItemAmount includes the line amount differences (InvLineAmountDiff), whereas ItemAmountNoVAT_OrderCurr is the plain sum of the net line amounts.

Tables used

Invoices · Read Currency · Read Invlines · Read Orderlines · Read items · Read Countries · Read ItemCode · Read InvBin · Read InvBinItem · Read PLitem · Read BundleOrderlines · Read BundleItemsHistDetail · Read
SQL object:
dbo.pipiGetInvoiceLinesPrinted
Updated at 2026-10-30