Postman collection
Reports Read

pixiReport1SS

Returns monthly package statistics from invoices for billing: total packages, single-item packages and packages flagged as 1SS, with size classes.

Runs the internal report procedure Report_1SS, which is used for billing purposes. The call takes no parameters.

How the report is built:

  1. Every invoice (table invoices) with total >= 0 counts as one package. Credit notes with a negative total are excluded.
  2. Invoices are grouped by calendar month, using the month offset between invdate and the current date. Month and Year come from the latest invoice date in each group.
  3. For each month the report counts:
    • Packages: all invoices.
    • Packages_1item: invoices whose invoice lines (invlines) add up to a total itemqty of exactly 1.
    • Packages_1ss: invoices whose flag column 1SS equals 1.
  4. Derived values:
    • Packages_1item_Percentage: share of single-item packages. The ratio is rounded to two decimals and then multiplied by 100, so the result is a whole percent.
    • Class_1item / Class_1SS: size class of the count. Up to 1000 is Small, up to 2500 Medium, up to 5000 Large, up to 10000 Extra Large, above that XXL.
    • Extra10000_1Item / Extra10000_1SS: number of complete blocks of 10,000 (integer division).

There is no date filter, so every month in the invoice history is returned. Rows are sorted by Year, then Month, ascending.

Notes

  • All reads use NOLOCK, so the figures can include uncommitted data.
  • The report scans the complete invoices and invlines tables without a date filter. On large databases this can be slow.
  • An invoice counts as a single-item package if the sum of itemqty over all its lines is 1. This is also true when several lines add up to 1. Invoices without any lines never count as single-item packages.
  • Invoices with a NULL invdate form a separate group, in which Month and Year are NULL.

Tables used

invoices · Read invlines · Read
SQL object:
dbo.pipiReport1SS
Updated at 2026-10-30