WEB SYSTEMS PRO
E-commerce platform
€59.80

* Net price (excluding VAT)

SKU:WSP-403-PL
License
Web Systems Pro
Version
1.1.0.1.wsp
Update
02/01/2023


Documentation for plugins "Recurrent invoices"

Recurrent invoices. Date formats and modifiers


Usage examples

All examples below are based on the date "Tuesday, April 18, 2023"
Formula Result Description
{[Y]} 2023 Current year
{[m/y]} 04/23 Current month and year in short format
{[d F Y]} 18 April 2023 Displaying a specific date in full format
{[d F Y] first day of next month} 01 May 2023 First day of the month following the current one
{[d F Y] first monday} 24 April 2023 Next Monday
{[F Y] +3 month} July 2023 Month and year three months from the current date
{[d-m-y] last day of this month} 30-04-23 Last day of the current month in short format

Date formats

The following characters are recognized as date format
Character in the format string Description Example of returned value
Day --- ---
d Day of the month, 2 digits with leading zero from 01 to 31
D Textual representation of the day of the week, 3 characters from Mon to Sun
j Day of the month without leading zero from 1 to 31
l (lowercase 'L') Full name of the day of the week from Sunday to Saturday
N Day of the week as a number according to ISO 8601 from 1 (Monday) to 7 (Sunday)
S English ordinal suffix for the day of the month, 2 characters st, nd, rd or th. Used in combination with j
w Day of the week as a number from 0 (Sunday) to 6 (Saturday)
z Day of the year (starting from 0) from 0 to 365
Week --- ---
W ISO 8601 week number of the year; weeks start on Monday For example: 42 (42nd week of the year)
Month --- ---
F Full month name, for example, January or March from January to December
m Month number with leading zero from 01 to 12
M Abbreviated month name, 3 characters from Jan to Dec
n Month number without leading zero from 1 to 12
t Number of days in the given month from 28 to 31
Year --- ---
L Leap year indicator 1 if leap year, otherwise 0.
o ISO 8601 year number. Works like Y, except when the ISO week number (W) belongs to the previous or next year; in such case, the year of that week is used. Examples: 1999 or 2003
X Extended full numeric representation of the year, at least 4 digits, with - for years BCE and + for years CE. Examples: -0055, +0787, +1999, +10191
x Extended full numeric representation if required, or standard full numeric representation if possible (like Y). At least four digits. For years BCE, prefix is -. For years from (and including) 10000, prefix is +. Examples: -0055, 0787, 1999, +10191
Y Full numeric representation of the year, at least 4 digits, with - for years BCE Examples: -0055, 0787, 1999, 2003, 10191.
y Year number, 2 digits Examples: 99, 03

Modifiers

Used characters
Description Format
dayname (day of the week name) 'sunday' | 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'saturday' | 'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat'
daytext (week intervals) 'weekday' | 'weekdays'
number [+-]?[0-9]+
ordinal (ordinal numbers and indicators) 'first' | 'second' | 'third' | 'fourth' | 'fifth' | 'sixth' | 'seventh' | 'eighth' | 'ninth' | 'tenth' | 'eleventh' | 'twelfth' | 'next' | 'last' | 'previous' | 'this'
reltext (indicators) 'next' | 'last' | 'previous' | 'this'
space (space and tab characters) [ \t]+
unit (intervals) 'ms' | 'µs' | (( 'msec' | 'millisecond' | 'µsec' | 'microsecond' | 'usec' | 'sec' | 'second' | 'min' | 'minute' | 'hour' | 'day' | 'fortnight' | 'forthnight' | 'month' | 'year') 's'?) | 'weeks' | daytext

Day-based notations
Format Description Examples
'yesterday' Midnight yesterday "yesterday 14:00"
'midnight' Time set to 00:00:00  
'today' Time set to 00:00:00  
'now' Current time  
'noon' Time set to 12:00:00 "yesterday noon"
'tomorrow' Midnight tomorrow  
'back of' hour 15 minutes past the specified hour "back of 7pm", "back of 15"
'front of' hour 15 minutes before the specified hour "front of 5am", "front of 23"
'first day of' Sets the first day of the current month. Usually this notation works better when combined with a month name following it; otherwise, the current month is assumed. "first day of January 2008"
'last day of' Sets the last day of the current month. Usually this notation works better when combined with a month name following it; otherwise, the current month is assumed. "last day of next month"
ordinal space dayname space 'of' Calculates the x occurrence of a weekday in the current or specified month. "first sat of July 2008"
'last' space dayname space 'of' Calculates the last occurrence of a weekday in the current or specified month. "last sat of July 2008"
number space? (unit | 'week') Calculates relative time using numeric period values. "+5 weeks", "12 day", "-7 weekdays"
ordinal space unit Calculates relative time using string period values. "fifth day", "second month"
'ago' Subtracts all values from the last obtained timestamp. "2 days ago", "8 days ago 14:00", "2 months 5 days ago", "2 months ago 5 days", "2 days ago ago"
dayname Moves to the next occurrence of the specified weekday "Monday"
reltext space 'week' Parses the format "weekday + last/this/next week". "Monday next week"



Recurrent invoices. Description

Plugin "Recurrent invoices" allows CRM users to automatically generate invoices for customers according to predefined rules.

Plugin enables creating a recurring invoice template, based on which CRM invoices will be automatically (via CRON) created with a specified frequency. The minimum billing period is one week. The maximum period is unlimited. A recurring invoice template only defines the appropriate settings. Invoice for the customer will be generated exactly as and based on your invoice template in CRM.

The interface and logic of plugins are as close as possible to the standard CRM invoicing tool.

Description of plugins Recurrent invoices

A recurring invoice can be created in the corresponding section, accessible via a link in the CRM left menu. A recurring invoice can also be created from a transaction or based on a previously issued invoice.

The recurring invoice template configuration interface is also as close as possible to the standard CRM invoice editing interface.

Description of plugins Recurrent invoices

Features of the recurring invoice editing mode compared to a standard invoice:

  • Frequency. You can set the billing frequency based on the recurring invoice template. To do this, select a time interval (week/month/year) and specify the number of intervals in the corresponding field. For example: "Every 2 weeks on Monday". Or "Every 3 months on the first day". Or "Every year on December 25".
  • Billing period. You can define from which date to start issuing invoices for your customer. If you want to bill the customer indefinitely, you can leave the start/end dates blank. In this case, plugin will bill indefinitely until manually paused or until one of the early termination conditions is met.
  • Conditions for early termination of billing. You can set non-payment of the previous invoice issued by the plugin as a condition for early termination. Then, when the next billing date arrives, plugin will check that the previous invoice has not been paid and will stop automatic billing. If the recurring invoice template is linked to a transaction, automatic billing will stop if the transaction is closed or reaches one of the stages defined in the template settings.
  • Date calculator (formula). Periodic invoices often require specifying the period covered by the invoice or other dates related to the invoice date. To solve this, plugin supports using formulas (date calculator). Formulas can be used in the invoice number, comments, and line item names. A formula is a required string of characters based on predefined formats. For convenience, the recurring invoice template editing mode includes a "calculator" that allows quickly checking the formula result based on any selected date. During invoicing, plugin converts template formulas into dates in the specified format relative to the invoice date.
    Description of plugins Recurrent invoices

Based on the above settings, an invoice will be generated, and its preview is available in the recurring invoice template browser.

Description of plugins Recurrent invoices

Automatic billing is performed using a task scheduler (cron, etc.). The recommended frequency for running the command is once per day. The command to use in the task scheduler is shown below and also on the plugins settings page.

{path to the PHP interpreter} {path to the Web Systems Pro installation}/cli.php crm reinvoicePluginSсhedule