Postman collection
Invoices Read

pixiDatevExportPosInvoices

Returns POS sales and POS payments of a date range as DATEV booking lines (revenue per VAT rate and payment entries) for export to accounting.

Wrapper for the internal procedure Pixi_DatevExportPOSInvoices. It builds DATEV booking lines from point-of-sale documents (POSheader2/POSitem2) and POS payments (POSPayment).

Date range: DateFrom is moved to the start of its day and DateTo to the end of its day. Both are compared with the POS document date PHdate.

Revenue lines (Source = INV)

  • One line per POS document and VAT rate, sign, item booking account and some other grouping attributes. Line amounts are PIQty * PIEndPrice. A header discount (amount or percent) is spread proportionally over the lines.
  • MwstSatz is the item VAT rate (1 = high, 2 = low, 3 = zero). It is set to 3 if the customer address has AddrNoChargeVAT.
  • BookKeepingAccount depends on the VAT rate and comes from the settings AccountNumberPOSInvoice, AccountNumberPOSInvoiceVatLow and AccountNumberPOSInvoiceVatZero.
  • VatCode and BookKeepingAccount can then be overridden by DatevVatCodeOverrideHigh/Low and DatevAccountOverrideHigh/Low from the VATs table. A country-specific entry valid on the document date wins over a generic one. Accounts that appear as values of settings named like book%accounteucompanies% are not overridden.
  • Groups whose sum is 0 are skipped.

Payment lines (Source = PAY)

  • One line per POS payment amount, except payment codes B and -. The amount is POSPayment.Amount.
  • BookKeepingAccount is the BookkeepingAccountPos of the payment type, or the setting AccountNumberPOSPayment as fallback.
  • Gegenkonto comes from the shop (Shops.Gegenkonto) of the customer (Customers.CustomerOf) linked through the invoice with the same number.

Filters (each one is ignored when NULL):

  • ShopId: shop of the address. For INV lines this is the POS customer address. For PAY lines it is the address of the invoice with the same number.
  • Country: country of the POS customer address.
  • InvoiceNr: POS document number (PHdocNr).
  • OrderNrExternal: external order number of the order line (INV) or of the order header (PAY).
  • BookKeepingAccount: works as an all-or-nothing switch, not as a per-row filter. INV lines are returned only if the value equals one of the three POS invoice account settings. PAY lines are returned only if it equals AccountNumberPOSPayment.

Output

  • With ShowOnlySums = 0, all lines are returned. Only lines whose country exists in Countries are included.
  • Price and PriceInCents are absolute values; the direction is in Sign.
  • CustomerNr falls back to the setting DefaultCustomerAccountNumber.
  • Sort order: InvoiceNr, Source, InvText, Price.

With ShowOnlySums = 1, only one placeholder row with ReportName = DATEVExportInvoices is returned. All its sum columns are NULL.

Notes

  • Read-only. All tables are read with NOLOCK, except POSheader2 and Addresses in the payment part. Uncommitted data can therefore appear.
  • Many settings change the output:
    • BookExportDatevPro: sign s/h instead of +/-.
    • BookExportDatevHomeCountry: home country, default D.
    • BookExportDatevUseOrderNrExternal: comma list of payment types for which InvoiceNr holds the external order number instead of the POS document number.
    • BookExportBookAccountAsKostenStelle: puts the item booking account into Empty2.
    • ExportPaymentTypeAsKostenStelle2: Empty3 gets the payment type (1). With 2 it gets NULL for INV lines and the shop Gegenkonto for PAY lines.
    • VAT code settings BookEu*VatCode, BookGer*VatCode and BookNonEuVatCode.
  • VAT code settings are cast to int. A non-numeric value causes a conversion error.
  • Country falls back to the country of the POS location (Location.LocCountry). VatCode and AccountNrItems, however, are derived only from the customer address country, so they can be NULL for anonymous POS sales.
  • Payment lines are joined to the POS items. A payment can therefore be split into several lines if the items have different VAT codes or item accounts.
  • The currency is always the database home currency (pixi.GetDatabaseCurrency).
  • OrderNrExternal is cut to 12 characters and InvText to 60 characters.
  • The ShowOnlySums mode currently returns no real sums, only NULL values.

Tables used

POSheader2 · Read POSitem2 · Read POSPayment · Read Payments · Read items · Read Addresses · Read Countries · Read Orderlines · Read OrderHeader · Read Invoices · Read Customers · Read Location · Read Shops · Read VATs · Read Settings · Read
SQL object:
dbo.pipiDatevExportPosInvoices
Updated at 2026-10-30