Postman collection
Reports Read

pixiGetProductSalesReport

Returns the quantity sold of one item per invoice month and year, optionally restricted to one shop.

Builds a monthly sales report for a single item based on invoice lines.

  • Reads invoice lines from the view PV_InvlinesRep and joins them with the invoices in PV_Rechnungen via the invoice number.
  • Filters on the internal item number ItemNrInt.
  • If ShopID is given, only invoice lines of that shop are counted; if it is omitted or NULL, all shops are included.
  • Groups by invoice month and invoice year and sums the sold quantity (QtySold).
  • Rows are sorted chronologically: by year ascending, then month ascending.

Only months in which the item was invoiced appear in the result; months without sales are not returned as zero rows.

Notes

  • According to the header comment the procedure was created for a specific customer (JAL).
  • Both views are read WITH (NOLOCK), so the figures may include uncommitted data.
  • The definitions of PV_InvlinesRep and PV_Rechnungen are not attached; the exact meaning of QtySold (e.g. whether credit notes reduce it) and the data types of the month/year columns depend on these views.
  • There is no date range filter; the full invoice history of the item is aggregated, which can be slow for items with many invoice lines.
  • An unknown ItemNrInt returns an empty result set, not an error.

Tables used

PV_InvlinesRep · Read PV_Rechnungen · Read
SQL object:
dbo.pipiGetProductSalesReport
Updated at 2026-10-30