Postman collection
Reports Read

pixiReportTurnover

Returns net invoice turnover for the given day, the day before, the current month and the previous month, optionally filtered by shop.

Dashboard report that sums Total_Net of invoices (Invoices) into four turnover figures and returns them as one row.

Date handling

  • toDate defaults to the current date and time. Its time part matters: the given day and the given month are counted only up to toDate, not to the end of that day.
  • fromDate defaults to the first day of the month before toDate. If fromDate is later than toDate, it is set to toDate.
  • Only invoices with InvDate between the start of the previous month and toDate are considered at all.

Shop filter An invoice is counted only if its customer (CustRef) has at least one address in Addresses with AddrShopID = ShopID. An empty or NULL ShopID includes all invoices that have any address.

The four figures

  • TurnoverNetGivenDate: if fromDate is in a different month than toDate, invoices from the start of the toDate day up to toDate; if fromDate is on the same day as toDate, invoices from fromDate to toDate.
  • TurnoverNetDayBefore: if fromDate is in a different month, the whole day before toDate; additionally, if fromDate falls on the day before toDate, invoices from fromDate to the end of that day.
  • TurnoverNetGivenMonth: if fromDate is in a different month, from the 1st of the toDate month up to toDate; if in the same month, from fromDate up to toDate.
  • TurnoverNetPreviousMonth: if fromDate is before the previous month, the whole previous month; if fromDate is in the previous month, from fromDate to the end of the previous month.

With the default fromDate the result is: today up to now, yesterday, month to date and the full previous month.

Currency If the setting MultiCurrencyEnabled is 1, each invoice amount is divided by the exchange rate from pixi.ExchRate for the database exchange-rate source (DatabaseCurrencyExchRateSourceId) and home currency, matched by exchange-rate date and currency of the invoice's rate. dbCurrency then contains the database currency code. Otherwise the amounts are summed as stored and dbCurrency is NULL.

Notes

  • All reads use NOLOCK; figures may include uncommitted data.
  • The values are returned as strings (varchar(30)). A figure is NULL (element missing in the row) if no invoice matches its period, e.g. TurnoverNetGivenDate and TurnoverNetDayBefore are NULL when fromDate is in the same month as toDate but neither on that day nor on the day before. TurnoverNetPreviousMonth is NULL when fromDate lies in the current month.
  • A fromDate earlier than the start of the previous month has no extra effect, because older invoices are never loaded.
  • In multi-currency mode, invoices without a matching exchange rate record (or without ExchRateId) are silently excluded because of inner joins. The number of decimal places in the string depends on the data type of ExchRate, which is not visible here.
  • If the setting MultiCurrencyEnabled is missing (NULL), the code still takes the conversion branch, but dbCurrency is returned as NULL.
  • On any SQL error the procedure only prints the message and returns -1; no result set is returned.
  • The temporary table is dropped via util.TempTableDrop (definition not attached).

Tables used

Invoices · Read Addresses · Read Settings · Read Currency · Read ExchRate · Read
SQL object:
dbo.pipiReportTurnover
Updated at 2026-10-30