Postman collection
Customers Read

pixiGetCAEventsAndReminders

Returns customer account events (invoices, matches/payments, reminders and virtual full-payment events) of one shop within a date range, with balance and reminder levels.

Collects all customer account events of the customers of shop ShopId that happened in a date range and returns them as one event list. Reminder sendings and full payments of invoices are treated as additional events.

Date range

  • If StartDate is NULL, the range starts on the first day of the current month. Otherwise it starts at 00:00 of StartDate.
  • If EndDate is NULL, the range ends at the end of today. Otherwise it ends at 23:59:59.997 of EndDate.

Event types collected

  1. Invoice events: CustomerAccount entries with EventID = 'INV' whose EventDate is in the range. EventKey = CAE_<CustomerAccountKey>.
  2. Reminder events: reminders (Reminders joined with ReminderLines) whose ReminderSentDate is in the range. They are returned with EventID = 'REM'. The amount is the negative of reminder total minus reminder costs, and ReminderLevel comes from the reminder line. EventKey = REM_<ReminderKey>.
  3. Match events: CustomerAccountMatch records created in the range that link an invoice entry (EventID = 'INV') with another, different customer account entry. Both link directions are taken into account. The row carries the EventID and EventDate of the counterpart entry (for example a payment). The amount is the absolute match amount, and EventUpdateDate is the match creation date. EventKey = CAM_<CustomerAccountMatchKey>.
  4. Virtual full-payment events: for an invoice of a returned customer whose matches up to EndDate add up exactly to the invoice total, a virtual event is created with EventID = 'REM' and amount 0. Its date is the last match creation date plus 1 ms. The customer must also have at least one match event in the range, and the event is dropped if its date is before the range start. EventKey = FPY_<CustomerAccountKey>.

Customer filter

  • Only customers whose CustomerOf equals ShopId are returned.
  • If CustomerNumberIsNumeric = 1, only customers whose CustomerNrExternal consists solely of digits are returned. With 0 (default, or NULL) all customers of the shop are returned.

Reminder levels

  • For every invoice without a virtual full-payment event, the highest HighestReminderLevel of all reminders containing the invoice is determined (invoice dated before EndDate).
  • This value is written to ReminderLevel of all non-REM events of the invoice.
  • CustomerReminderLevel is the maximum of these levels over all open invoices of the customer. It is set on all events of the customer.

Amounts and currencies

  • Balance_ShopCurr is the sum of all customer account amounts with EventDate before EndDate.
  • If the setting MultiCurrencyEnabled is 1, these amounts are converted with the exchange rate of the current day.
  • Amount_ShopCurr is the event amount converted the same way. A missing rate counts as 1.

Output

  • Each event row contains the external customer number, invoice number and external order number.
  • Only events that can be linked to an invoice in Invoices are returned.
  • The result is DISTINCT and sorted by EventUpdateDate, then EventDate.

Notes

  • All reads use NOLOCK; results may contain uncommitted data.
  • Exchange rates are always taken for the current date (ExchDate = today), not for the event date. With MultiCurrencyEnabled = 1 and no rate for today, entries in foreign currency are left out of Balance_ShopCurr (division by NULL). Amount_ShopCurr falls back to a rate of 1 in that case.
  • The setting DoNOTChargeShipCostOnSecondDelivery is read but not used.
  • An invoice with order lines from several external orders produces one row per OrderNrExternal.
  • Reminder rows are built by joining the reminder lines twice. A reminder with several lines can therefore return several rows with different InvoiceNr/ReminderLevel combinations.
  • Virtual FPY_ events are produced once per customer account entry of the invoice, so more than one FPY_ row per invoice is possible.
  • An unknown ShopId returns an empty result, not an error.
  • Temporary tables are dropped at the end via util.TempTableDrop (not attached).

Tables used

CustomerAccount · Read Reminders · Read ReminderLines · Read CustomerAccountMatch · Read Customers · Read Shops · Read Invoices · Read Currencies · Read ExchRate · Read Currency · Read Invlines · Read Orderlines · Read Settings · Read
SQL object:
dbo.pipiGetCAEventsAndReminders
Updated at 2026-10-30