Skip to content

Enabling Pro Forma Billing

Certain business use cases require merchants or suppliers to issue pro forma invoices. Pro forma invoices are commonly used as preliminary invoices with a quotation or for customs purposes, to give an example of the charged prices, or to ask for an advance payment. After the goods or services are supplied, the pro forma invoice is closed and the final invoice is issued.

Info

JustOn supports pro forma billing when billing opportunities and billing arbitrary objects.

Enabling pro forma billing in JustOn involves the following tasks:

Info

Pro forma billing is available as of JustOn 2.47.

Pro Forma Billing Concepts

Basically, the creation of a pro forma invoice is controlled using the ON field ON_Type on the source object. If this field is set to Proforma, JustOn generates a pro forma invoice.

Optionally, you can request an advance payment with your pro forma invoice. To this end, use the ON fields ON_DepositRate or ON_DepositAmount to specify either a percentage value of the invoice total or a fixed amount as the deposit.

Info

For details about ON fields, see Using the ON Field Mechanism.

If you apply a deposit, the pro forma invoice is subject to the usual invoice proceedings and business processes: finalization, payment registration, which creates the corresponding balances, and dunning, if necessary.

Note

When you use pro forma billing, be aware that JustOn does not consider order discounts with the pro forma invoices, but only when generating the final invoices.

Pro Forma Invoice Life Cycle

The following sections describe how to work with pro forma invoices, outlining their life cycle.

Pro Forma Invoice Creation

JustOn generates a pro forma invoice if the field ON_Type on the source object is set to Proforma.

Note

Once you have set the field ON_Type on the source object to Proforma to trigger the pro forma invoice creation, do not modify this field subsequently to make sure that the pro forma billing features operate correctly.

Optionally, you can define a deposit rate or a deposit amount using the fields ON_DepositRate or ON_DepositAmount on the source object.

Info

If both a deposit rate and a deposit amount is defined, the amount takes precedence.

Using a template detail named Proforma, you can provide appropriate texts for the invoice PDF, like the display type, deposit title or description (see PDF Contents).

After creating the pro forma invoices, JustOn sets the custom field ON_ProformaInvoice on the source objects to the pro forma invoices.

pro-forma_1
Creating a pro forma invoice

Pro Forma Invoice Closure

Before you create the final invoice, you must close the pro forma invoice. To close a pro forma invoice, you use a custom process.

Applying the specific Apex class that JustOn provides for this purpose, your process

  • sets pro forma invoices to the status Closed
  • clears the closed pro forma invoices to 0
  • unregisters any assigned payment balances
  • sets the field RelatedInvoice of the now unregistered pro forma payment balances to the corresponding pro forma invoice
  • clears the custom fields ON_Invoice, ON_Type and ON_LastInvoiceRun on the source objects to allow generating the final invoice

Info

Usually, JustOn assigns unregistered pro forma payment balances to the corresponding final invoices. Clearing the field RelatedInvoice of the unregistered pro forma payment balance will allow to assign the balance to any matching invoice.

pro-forma_2
Closing the pro forma invoice

Final Invoice Creation

After you have closed the pro forma invoice, you create the final invoice the same way and based on the same source records as the pro forma invoice.

Doing so

  • registers the balances that were unregistered from the pro forma invoice by the closing process to the final invoice
  • sets the field RelatedInvoice on the final invoice to the corresponding pro forma invoice

pro-forma_3
Creating the final invoice, linked to the pro forma invoice

Info

JustOn registers a down payment as a payment balance record. As invoices by default show related balance records, the final invoice shows the down payment information. Your business may, however, require to hide this information. In this case, you need a separate invoice template or a specific template detail that is configured to prevent the balance table from being printed. For details, see Hiding Balance Table.

Pro Forma Invoice Structure

A pro forma invoice consists of two parts. The first part lists the invoice line items, which are represented as Information type invoice line items and therefore do not count for the grand total, followed by a subtotal section with tax breakdown. The second part contains an invoice line item of the type Deposit, followed by the corresponding tax breakdown, grand total and payment amount.

The two parts are optional. Whether they are displayed or not depends on whether there are already actual invoice line items to show or, respectively, on whether there is an advance payment defined. At least one part must exist to print the invoice line item table.

Example invoice line item table of a pro forma invoice:

Pos. Title Tax Rate Net Price
1 Some Goods 20% 1000
2 Some Service 20% 500
Subtotal Net 1500
Tax Amount 300
Pro Forma Gross 1800
3 Down payment (50%) 20% 750
Tax Amount 150
Grand Total 900
Payment Amount 900

Pos. 1 and 2 are Information invoice line items, which do not count for the grand total of the invoice. Pos. 3 is a Deposit invoice line item. The value depends on the deposit setting used: it is either calculated based on the net subtotal of all invoice line items and the defined deposit rate, or it can be included as an absolute net amount using the deposit value.

Adding Pro Forma Billing Fields to Source Objects

In order to hold the required pro forma billing data, you must add new fields to the source object, which can be

Info

If you need multiple billing configurations when billing arbitrary objects, JustOn must distinguish between different sets of field configurations using control field suffixes. To this end, append specific suffixes to the ON fields, as explained in Creating Recipient-Specific Controlling Fields.

  1. Navigate to the fields list of the source object.
  2. Create the following new fields as required.

    Mandatory fields

    Field Label API Name Data Type Description
    Invoice Type ON_Type Text (255) Must be set to Proforma in order to create pro forma invoices. Is cleared automatically when the pro forma invoice is closed.
    Pro Forma Invoice ON_ProformaInvoice Lookup (Invoice) Shows the related pro forma invoice.

    Optional fields

    Field Label API Name Data Type Description
    Deposit Rate ON_DepositRate Percent (3,2) If set, JustOn creates a deposit line item with an amount of Deposit Rate * Total on the pro forma invoice.
    If both a deposit rate and a deposit amount is defined, the amount takes precedence.
    Deposit Amount ON_DepositAmount Currency (16,2) If set, JustOn creates a deposit line item with the specified amount on the pro forma invoice.
    If both a deposit rate and a deposit amount is defined, the amount takes precedence.
    Close Pro Forma Invoice ON_CloseProformaInvoice Checkbox Can be used to trigger the process to close the pro forma invoice.

    For help about creating fields, see Managing Object Fields.

Info

You can add more fields using the ON field mechanism.

Configuring Pro Forma Invoice Display

Adjusting Pro Forma Invoice Texts

Usually, pro forma invoices need other texts on the printed invoice than the final invoice. You can therefore define a template detail named Proforma to provide appropriate texts.

For further information about template details and invoice PDF contents, see Configuring Template Details and PDF Contents.

The following fields are relevant on the template and the template detail:

Field Description Example Target
Display Type Specifies the type of the invoice to be printed to the PDF. It should reflect the nature of the pro forma invoice. Advance Invoice Template Detail
Text 2 Text to be rendered below the invoice line item table. Use it, for example, to describe how the deposit can be made (bank account etc.) and to specify the payment terms. Template Detail
Deposit Title Short description of the nature of the deposit
This field is mandatory.
Advance Payment (50%) Template
Deposit Description Long description of the nature of the deposit Template
  1. Open the template or template detail to be edited.
  2. Double-click the intended field and specify the corresponding text as required.

    Alternatively, you can click Edit in the detail view to edit all fields at once.

  3. Click Save.

Adjusting Spacing Between Invoice Line Item Table Parts

As explained in Pro Forma Invoice Structure, the pro forma invoice first lists the invoice line items as Information type invoice line items, then shows an invoice line item of the type Deposit, which represents the advance payment. In order to visually separate the two table parts, add the following custom CSS rule to the invoice template:

  1. Open the template to be edited.
  2. In the Layout & Design section, double-click the Custom CSS field and specify the CSS code as required.

    Alternatively, you can click Edit in the detail view to edit the field.

    tr.Deposit.firstRowAfterSubtotal td {
        padding-top: 2.5em;
    }
    
  3. Click Save.

Enabling Pro Forma Gross Display

As explained in Pro Forma Invoice Structure, the pro forma invoice lists the invoice line items as Information type invoice line items, followed by a subtotal section with tax breakdown. Optionally, you can display a line that shows the gross value for the Information type invoice line items.

To do so, add the following custom CSS rule to the invoice template:

  1. Open the template to be edited.
  2. In the Layout & Design section, double-click the Custom CSS field and specify the CSS code as required.

    Alternatively, you can click Edit in the detail view to edit the field.

    .invoice-table .subtotal-calculated.criteria-forced.gross {
        display: table-row;
    }
    
  3. Click Save.

Creating Process for Closing Pro Forma Invoices

Closing pro forma invoices requires a process that calls the appropriate Apex class provided by JustOn. The process criteria that start the execution depend on your use cases. For example, you can use a custom checkbox field Close Pro Forma Invoice on the source object to trigger the process when the checkbox is selected.

The source object for the process depends on the object that is used for the pro forma billing:

Info

You can use multiple billing configurations when billing arbitrary objects with different sets of field configurations using recipient-specific suffixes. In this case, create an individual process with an individual trigger for each configuration.

Set up the process as follows:

  1. In Setup, open Process Builder.

    In Salesforce Lightning, navigate to Process Automation > Process Builder.

    In Salesforce Classic, navigate to Create > Workflow & Approvals > Process Builder.

  2. Click New.

  3. Specify a name and an API name as required.
  4. Set the process to start when A record changes.
  5. Click Save.
  6. Select the object ( Order or Opportunity) whose modifications are to close the pro forma invoice.
  7. Set the process to start when a record is created or edited.
  8. Define the process criteria as required.

    • [<object>].Close Proforma Invoice Is changed True
    • [<object>].Close Proforma Invoice Equals True
    • [<object>].ON_ProformaInvoice__c Is null False

    Combine the conditions with logical AND, that is, select All of the conditions are met.

  9. Select Apex as immediate action, and specify the class Close Proforma Invoice.

  10. Set the following Apex variables:

    • For recordIds, set the Field Reference value [<object>].Id.
    • Optionally, for Suffix, set the String value to the corresponding recipient-specific suffix.

      Suffix is required when using multiple processes for multiple billing configurations.

  11. Click Save.

  12. Click Activate.

This triggers JustOn to execute the process when the Close Pro Forma Invoice checkbox is selected. It closes the pro forma invoice and prepares the object for creating the final invoice (for details, see Pro Forma Invoice Closure).

Info

Depending on your use cases, the process setup and the objects to involve may vary.

For help with setting up processes, see Create a Process in the Salesforce Help, or contact the JustOn support team.

Enabling Pro Forma Billing to Multiple Parties

Generally, JustOn is set up to issue invoices to one recipient, usually via the account associated to the corresponding source record. Certain business use cases, however, require billing transactions to multiple parties. To cover these needs, you apply the configuration explained in Enabling Multiple Party Billing.

  1. Create multiple (recipient-specific) sets of ON fields as listed in Adding Pro Forma Billing Fields to Source Objects.

    For details, see Creating Recipient-Specific Controlling Fields.

  2. Create an individual closing process with an individual trigger for each configuration set, specifying the corresponding recipient-specific suffix as an Apex variable.

    Process Name Trigger Control Field Suffix
    Close Proforma Merch checkbox Close_Merch Merch
    Close Proforma Buy checkbox Close_Buy Buy

Next steps:

Managing Pro Forma Invoices

Return to JustOn Administration.