Postman collection
KPIs Read

pixiReportShippedOrders

Returns dashboard counts of shipped invoices for the given day, the previous day, the current month up to the end date and the previous month.

Counts shipments for a dashboard. A shipment is a record in Invoices with a ScanOutDate. Only invoices with at least one order line (Orderlines.InvRef) are counted. Each invoice counts once, so the values are invoice counts, not order counts.

How the parameters work:

  • EndDate defaults to the current date and time (GETDATE()). It is the reference date for all periods.
  • StartDate defaults to the first day of the month before EndDate. It is only used for the given-day value, and only if it is on the same calendar day as EndDate. If StartDate is later than EndDate, it is set to EndDate.
  • ShopID limits the count to invoices that have at least one order line with OrdShopID = ShopID. An empty value or NULL means all shops.

The call first collects all matching invoices whose ScanOutDate lies between the start of the previous month and the end of the EndDate day. It then returns one row with four counts (all ranges include both ends):

  • ShipoutOnGivenDay: from StartDate (same day) or else midnight of the EndDate day, up to EndDate.
  • ShipoutOnPreviousDay: the whole calendar day before EndDate.
  • ShipoutInGivenMonth: from the 1st of the EndDate month, 00:00, up to EndDate.
  • ShipoutInPreviousMonth: the whole previous calendar month.

Notes

  • All four counts are uppercase-free strings in SQL terms: they are stored in varchar(10) variables, so they come back as strings, not integers.
  • The counts run up to EndDate itself, not to the end of that day. If EndDate is passed without a time (midnight), ShipoutOnGivenDay only counts invoices scanned exactly at midnight, and ShipoutInGivenMonth leaves out the whole EndDate day. Pass a time such as 23:59:59, or omit EndDate to use the current time.
  • StartDate cannot be used for a range over several days. If it is on another day than EndDate, it is ignored and the given-day count starts at midnight of the EndDate day.
  • Reads use NOLOCK, so the counts can include uncommitted data.
  • If an error occurs, the message is only printed and the procedure returns -1 without any result set.

Tables used

Invoices · Read Orderlines · Read
SQL object:
dbo.pipiReportShippedOrders
Updated at 2026-10-30