Postman collection
Reports Read

pixiReport_GrossProfit

Returns the gross profit report per item for an invoice date range, with sales and returns figures, optionally filtered by shop, category, supplier, payment type and tags.

Exposes the Pixi report Gross Profit (Report_GrossProfit) as an API call. Only the detail view is returned; the sums-only mode of the report is hard-coded off.

Steps

  1. Parameters are normalised: FromDate is set to the start of its day, ToDate to the end of its day (23:59:59.997). Empty strings are treated as NULL; a TagKey of 0 also counts as not set.
  2. Parameters are validated. If FromDate is later than ToDate, or a given shop, category (TontrArten), supplier, payment type, excluded payment type or tag does not exist, a single status row with Status = Error is returned and the call ends.
  3. The report reads invoice lines whose invoice date lies between FromDate and ToDate and applies the optional filters:
    • ShopID: only lines of this shop.
    • Category: item configuration type equals the category.
    • SupplNr: only items of this supplier.
    • PaymentType: only lines with this payment type; ExcludePaymentType: lines with this payment type are excluded.
    • TagKey1–TagKey3: only items carrying all given tags (AND combination).
  4. Lines are grouped per item, separately for sold and returned quantities, and combined into one row per item.

Currency

  • Without ShopID, all amounts are converted into the database currency (if multi-currency is enabled) and Currency is the database currency code.
  • With ShopID, amounts are returned in the shop's base currency when multi-currency is enabled; otherwise the database currency code is reported.

Figures per row

  • Sales_* are quantity-weighted average unit values of the sold lines (gross selling price, VAT, supplier price).
  • Returns_* are the corresponding values of the returned lines.
  • SingleGrossProfit = average gross selling price − average VAT − average supplier price of the sold lines.
  • TotalGrossProfit = per-unit profit of sales × sold quantity − per-unit profit of returns × returned quantity.

Special invoice lines such as shipping costs or vouchers (negative internal item keys) can appear as their own rows.

Notes

  • The error rows contain two columns: Status and an error text. Only for the ExcludePaymentType check is the text column named Message; in all other checks the column has no alias, so the SOAP client may receive it under a generated name (e.g. Column1).
  • The date error text says "DateTo" is greater than "DateFrom", but it is returned when FromDate is later than ToDate.
  • FromDate and ToDate have no default. If NULL is passed, no invoice lines match and the result is empty.
  • Tag filtering only takes effect if TagKey1 is set. TagKey2 is only used together with TagKey1, and TagKey3 only if TagKey1 and TagKey2 are set; e.g. TagKey2 alone is validated but ignored as a filter.
  • The underlying report sorts by item name, but the rows pass through a temporary table and the final SELECT has no ORDER BY, so the order is not guaranteed.
  • Each call first runs Report_SaveSupplierPrices, which according to a comment fills a cache table of supplier prices; its definition is not attached. The multi-currency behaviour depends on the setting MultiCurrencyEnabled.
  • All reads use NOLOCK, so uncommitted data may be included. Large date ranges can be slow.
  • Averages are divided by the sum of absolute quantities; groups with a total quantity of zero could cause a division-by-zero error.

Tables used

Shops · Read TontrArten · Read Suppliers · Read Payments · Read ItemTag · Read Tag · Read TagMatch · Read PV_InvlinesRep · Read ExchRate · Read Currency · Read
SQL object:
dbo.pipiReport_GrossProfit
Updated at 2026-10-30