Skip to main content

Displaying custom data on invoices

How to add extra information onto your invoices

C
Written by CiviPlus Helpdesk
Updated over a week ago

Introduction

CiviPlus comes with a standard invoice template which has been designed to meet most requirements. However, if you need to add additional information you can make small changes to the template that show custom date. These fields may relate either to the contribution itself that the invoice PDF relates to, or to the contact that the invoice relates to.

Warning: There are some "Golden Rules" when editing the template shown below which you should follow to avoid producing incorrect invoices. If you have any doubt about how to proceed please contact Compuco.

There are two approaches to add custom data to your invoice.

  1. Adding custom contribution data to specific invoice(s)
    CiviPlus has a field called "Source"​ on each contribution record that is exposed on the Invoice Template as standard under a heading of Reference. If you are not using this field for other purposes we strongly recommend that you use this to add your custom data. This approach avoids you having to edit the invoice template.

  2. Adding custom contact data to all invoices
    ​If the approach above doesn't give you want you need you can edit the Invoice Template to add multiple fields to the format. Note that these fields will appear on ALL invoices that are created.

1. Using the existing Source field on a invoice

The most common reason for taking this approach is when you want to add a ‘Purchase Order’ or ‘PO’ umber to an invoice. The purchase order is usually unique to a single invoice, and often you will only want to add it to an invoice after it is initially issued. For example, one of your members may receive an invoice and then contact you to say ‘please can you re-issue this with PO number xyz so that our finance team will approve the invoice for payment’.

This is an ideal scenario for using the contribution.source field, which already exists on the Invoice Template is appropriately unique to each contribution.

Where to find and edit the ‘contribution source’ in CiviCRM:

When viewing a contribution in CiviPlus, the source shows both on the contribution list view and on the ‘view’ screen. On the ‘list’ view on a contact record you can see it here:

Going into ‘edit’ mode of this contribution within CiviPlus allows you to edit the Source field.

And of course, you can make this field available to end users when they complete an online contribution form - an example asking for a PO number is shown below:

The Source field in the Contribution record displays in the table at the top of the the invoice as follows under the Reference heading/label.:

2. Adding custom fields by amending the Invoice Template

Warning: Before proceeding with this approach please make sure that you can't use the Source field to give the results you want.

Follow the steps below to add custom field(s) to the Invoice Template:

  1. Make sure you know the ID(s) for the field(s) you want to add to the template

    1. Navigate to Administer -> Customize Data and Screens -> Custom Fields

    2. Find the Custom Field set containing the Custom Field(s) that you want to expose and click View and Edit Custom Fields

    3. You will see the list of Custom Fields in this Fieldset, with the Field ID shown on the left. Make a note of the ID(s) that you want to show on the invoice, and decide what the label displayed on the invoice for each should be.

  2. Now that you have identified the custom field ID(s) for the field(s) you would like to insert as a token, and that you know the label(s) you would like to use when displaying it, you can create the HTML code snippet that you will be adding to the Invoice Template. Replace the highlighted sections of the text below with the values above:

    <td><font size="1" align="right">{if !empty($source)}{$source}{/if}<p>[custom field label]:{contact.custom_[custom field ID]}</p></font></td>


    For example:

    <td><font size="1" align="right">{if !empty($source)}{$source}{/if}<p>Organisation Tier {contact.custom_213}</p></font></td>

  3. Now navigate to Mailings -> Message Templates and select the System Workflow Message tab. You will see the "Contributions - Invoice" template in the list. Click the Edit option

  4. IMPORTANT: Before you start editing the Invoice Template it is vital that you take a copy of the current code in the HTML Format section of the page and save it as a text file, as shown below. Do NOT process with the next steps until you have done this.

  5. Once you have saved the current HTML Format code you can proceed to add your custom fields to the Invoice Template. The best place to insert additional custom fields, so as not to disrupt the overall template too significantly, is to add them directly below the Reference area shown above in scenario 1 above.

    1. Within the HTML Format field search for the following line in the template text below the lines
      <td><font size="1" align="right">{if !empty($source)}{$source}{/if}</font></td>

    2. Replace the entire line of text with the one you have created in step 2 above.

    3. Click the Save and Done button, then go to a contribution (for a contact where you know there will be a value in this custom field) and download a contribution invoice to see your new data field displayed on the invoice.

Did this answer your question?