Document Auto-tags

Document Auto-tags

Back   Posted on 1 september 2018 / Updated on 7 february 2020
Reading time 2 minutes

About Auto-tags

Auto-tags act as a placeholders that gets replaced with specific values. WHMCS provides you 4 auto-tags. Let's analyze them:

  • {YEAR} current year
  • {MONTH} current month
  • {DAY} current day
  • {NUMBER} document number (invoice, proforma and credit note number)

Custom Auto-tags

Billing Extension offers you several new auto-tags that you can freely use to customize the numbering style of your documents. If you need an auto-tag request it from our Lab describing us how it should work.

System ID

{ID} auto-tag is available for proformas, invoices and credit notes and is equal to the system ID of the document (i.e. The Auto-Index of table).

User ID

The value of {USERID} auto-tag corresponds to the ID of the customer.


{COUNTRY} auto-tag gets replaced by ISO 3166-1 alpha-2 two-letter country code (eg. IT, US, UK, FR...).


The auto-tag {CURRENCY} assumes the three-letter currency code of the document in question (eg. USD, EUR, GBP...).

Random letters and numbers

Starting from version 2.2.96 of Billing Extension, the following tags are available:

  • {A} Random uppercase letter (A-Z English alphabet)
  • {a} Random lowercase letter (a-z English alphabet)
  • {n} Random number (1-9)
Such tags can be used on any type of document (Invoice, Credit Note and Proforma) but we remind you that in most cases they can be used just on Proforma otherwise your Invoice Numbering will not be sequential.


The module integrates a feature that prevents duplicates but please make sure there are enough combinations. With {YEAR}-{n} for example you can issue 10 documents. Take a look at some examples below.

Configuration Examples Combinations
{n}{n}{n} 256, 485 729
{A}{A}{A} AHT, PEX 17.576
{n}{n}{n}{n}{n} 84961, 55129 59.049
{A}{A}{n}{n}{n} NW165, TR236 492.804
{A}{A}{A}{n}{n} JER85, SBH77 1.423.656
{A}{A}{A}{A}{A} UYBED, VRWUL 11.881.376


This number is used by Finnish companies. {VIITENUMERO} basically it is an extra reference number displayed on invoices, its purpose is to avoid typing/transcription errors. To get it, we should multiply every digit of invoice numbers in a specific way and then perform further calculations.

Let us describe you an example with invoice number equal to 3025. First we have to multiply each digit (starting from right) by specific numbers:
  • 5 x 7 = 35
  • 2 x 3 = 6
  • 0 x 1 = 0
  • 7 x 3 = 21
Then we have to sum all numbers together 35 + 6 + 0 + 21 = 62. Now we have to subtract 62 from the next bigger tenth value (70 - 62 = 8) and add this number right after invoice number so that invoice 3025 becomes 30258. Here you can find a tool that allows you to generate such numbers.

Don't forget that {VIITENUMERO} returns just the reference number. That means that to get 30258, where 3025 is invoice number and 8 viitenumero, you have to use {NUMBER}{VIITENUMERO}.

If you need to print both numbers separately on invoices (eg. Invoice number: 3025 & Viitenumero: 30258), do not use {VIITENUMERO} auto-tag. In viewinvoice.tpl and invoicepdf.tpl just use the variable $viitenumero to get 30258 anywhere you want. Last but not least this variable is already formatted according to regulation: space every 5 characters, leading zero if invoice number is less than 3 digits (eg. 178 96553, 178 96566, 178 96579).

Comments (0)

Speak Your Mind Cancel Reply