Skip to main content
Version: 3.1

Set the invoice number expression

Overview​

This flow describes how to set the invoice number expression of a facility. Care uses the expression to give each new invoice of the facility its number. The expression is part of the billing settings of the facility.

Pre-requisites​

  • You are a member of the facility in any role, or of its geographic organization or an organization above it.
  • You have the permissions listed below.

Permissions​

PermissionAccess
Can Update on FacilityLets you save the billing settings of the facility. It counts when you hold it through a role in the facility's root organization, which Care names Administration. A role in the facility's geographic organization, or in an organization above it, also counts. A role that you hold only in a department or team of the facility does not count. By default, the Facility Admin, Administrator and Staff roles hold it. Every member of the facility can open the page and use its buttons. Without this permission, Care refuses the save with a message that contains "You do not have permission to create Facilities".

Steps​

1. Open the invoice number expression​

In the facility sidebar, under Administration, select Settings.

Care shows the settings sidebar of the facility.

In the Billing group, select Billing.

Under Configuration, select Settings.

The Invoice Number Expression page opens. It shows the saved expression, or "-" if the facility has none.

Under Supported variables:, the page lists three variables. It also shows an example expression.

The facility sidebar, with Settings outlined under Administration

2. Start editing​

Select Edit.

The Invoice Number Expression page, with the supported variables, the current expression and the Edit button outlined

3. Type the expression​

Type the expression in the box.

Start the expression with the letter f.

After the f, write the text of the invoice number in quotes.

Put each variable in braces inside the quotes.

VariableWhat Care puts in its place
{invoice_count}The number of invoices that the facility already has, of every status, including refund invoices. It is 0 for the first invoice.
{current_year_yy}The year in which Care creates the invoice, in 2 digits.
{current_year_yyyy}The year in which Care creates the invoice, in 4 digits.

If the facility already has invoices, {invoice_count} counts them too. The next number continues from that count.

To start the numbers at 1, write {invoice_count + 1}.

To start at a different number, add that number, as in {invoice_count + 100}.

When you save, Care tests the expression with sample values: 1234 invoices and the year 2025. Some examples below show the number that these sample values give.

ExpressionResult
f'#INV-{invoice_count + 100}-{current_year_yy}'The example on the page. For a facility with no invoices, the numbers start at 100. Each number ends with the year in 2 digits. With the sample values, #INV-1334-25.
f'INV-{invoice_count + 1}'INV-1 for the first invoice of the facility, then INV-2. With the sample values, INV-1235.
f'CGH-{current_year_yy}-{invoice_count + 1:05d}'CGH-25-01235 with the sample values. The :05d part adds zeros in front of the number until it has 5 digits.

Note: Do not leave out the f at the start. Without it, Care saves the expression but does not fill in the variables. Every invoice then gets the same text, such as INV-{invoice_count}.

Note: Use no names other than the three variables on the page. Care refuses an expression that uses another name, such as f'INV-{invoice_number}'.

Note: Do not call a function. Care refuses an expression such as 'INV-' + str(invoice_count + 1). Care also refuses text with braces that is not in quotes, such as INV-{invoice_count}.

The expression box, with an expression that starts with f and pads the invoice count to five digits

4. Save the expression​

Select Save.

Note: Save stays disabled while the box is empty.

To stop without a change, select Cancel. Care keeps the saved expression.

If Care accepts the expression, the page shows Saved successfully.

If Care refuses the save, the page shows Error, and Care shows a message. Use this table to find what to do.

If the message containsWhat to do
Invalid ExpressionCheck that the text is in quotes. Check that each name in braces is one of the three variables. Check that the expression calls no function. Compare it with the example on the page.
You do not have permission to create FacilitiesYou do not hold the permission listed above in the right organization. Ask for a role that has it in the facility's root organization, Administration.

The Invoice Number Expression page after saving, with the new expression and the Saved successfully message

Expected Outcome​

  • The page shows Saved successfully.
  • From then on, Care numbers each new invoice of the facility from the expression when it creates the invoice.
  • Refund invoices for returned items get their numbers from the same expression.
  • The expression applies only to this facility. Other facilities keep their own numbering.

Concepts:

Flows: