Postman collection
Invoices Read

pixiGetReminders

Returns unpaid invoices of a payment type that are due for the given reminder (dunning) level, including address and shop data.

Lists open invoices that are candidates for the next payment reminder. The call delegates to the internal procedure pixi_GetReminders.

An invoice is returned when all of the following apply:

  • Invoices.Payed is NULL (not paid).
  • Invoices.Payment equals @PaymentType.
  • Invoices.total is greater than 0.
  • More than the threshold number of days have passed between Invoices.ScanOutDate and the current server date.
  • The invoice's current reminder level matches the level that precedes @ReminderLevel:
    • level 1: ReminderLevel is NULL or 0,
    • level 2: ReminderLevel = 1,
    • level 3: ReminderLevel = 2,
    • level greater than 3: ReminderLevel = @ReminderLevel - 1.
  • The address referenced by Invoices.AddrRef belongs to shop @ShopID, or @ShopID is NULL (all shops).

The day threshold is determined as follows:

  • Levels 1 to 3: @ReminderDays if given, otherwise the setting ReminderLevel1_Days (if not 0), otherwise 15 (level 1), 30 (level 2) or 45 (level 3).
  • Levels above 3: @ReminderDays if given, otherwise 45. The setting is not used.

Each row contains invoice data, the invoice address and the shop name and customer e-mail of the shop. No sort order is defined.

Notes

  • Read-only: the call does not raise the reminder level of the returned invoices. The caller has to update the reminder level by other means, otherwise the same invoices are returned again.
  • Pitfall: levels 2 and 3 also read the setting ReminderLevel1_Days (not a level-specific setting). If that setting is set, it replaces the defaults 30 and 45 for these levels, so all three levels use the same threshold unless @ReminderDays is passed.
  • The setting is read via the function fpixi_GetSetting, whose definition is not attached.
  • If @ReminderLevel is NULL or less than 1, no result set is returned at all.
  • The age is measured from ScanOutDate (scan-out/shipping date), not from InvDate. Invoices without ScanOutDate are never returned.
  • Invoices without a matching address or shop are excluded because of inner joins.
  • @ShopID has no default and must be sent; pass NULL to include all shops.
  • All tables are read with NOLOCK, so uncommitted data may appear.

Tables used

Invoices · Read Addresses · Read Shops · Read
SQL object:
dbo.pipiGetReminders
Updated at 2026-10-30