Enabling Deposit Invoices
Certain business use cases require merchants or suppliers to ask their customers for advance payments. To this end, JustOn allows for creating deposit invoices.
Businesses issue deposit invoices before any goods or services are supplied, usually with the intention to secure a sale. The deposit is a partial amount or a percentage of the total amount, which is to be paid up front. After the sale is completed, the deposit invoice is closed and the final invoice is issued.
Info
JustOn supports deposit invoices when billing arbitrary objects and billing opportunities.
Enabling deposit invoices in JustOn involves the following tasks:
- Adding new fields to the source object to hold the required deposit invoice data
- Configuring deposit invoice display
- Creating a process for closing the deposit invoice
Info
JustOn 2.47 has introduced deposit invoices as an option to pro forma invoicing. As of JustOn 2.54, deposit invoices and pro forma invoices are available as separate features.
Deposit Invoice Concepts
Basically, the creation of a deposit invoice is controlled using the ON field ON_Type
on the source object. If this field is set to Deposit
, JustOn generates a deposit invoice.
In order to request an advance payment with your deposit invoice, use the ON fields ON_DepositRate
or ON_DepositAmount
. Depending on your use case, you can then specify either a percentage value of the invoice total or a fixed amount as the deposit.
The deposit invoice is subject to the usual invoice proceedings and business processes finalization, payment registration and the corresponding balance generation. As deposit invoices do usually not constitute a legally binding payment request, they are, however, exempt from dunnings.
If required by your accounting, you can, optionally, enable the bookkeeping data generation for deposit invoices. To provide for clean bookkeeping data, JustOn also allows for canceling deposit invoices.
In case of errors, you may still need to void an issued deposit invoice. For details, see How to void a deposit invoice?.
Note
When you use deposit invoicing, be aware that JustOn does not consider order discounts with the deposit invoices, but only when generating the final invoices.
Working With Deposit Invoices
The following sections describe how to work with deposit invoices, outlining their life cycle.
Deposit Invoice Creation
JustOn generates a deposit invoice if the field ON_Type
on the source object is set to Deposit
.
Note
Once you have set the field ON_Type
on the source object to Deposit
to trigger the deposit invoice creation, do not modify this field subsequently to make sure that the deposit invoicing features operate correctly.
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 Deposit
, you can provide appropriate texts for the invoice PDF, like the display type, deposit title or description (see PDF Contents).
After creating the deposit invoices, JustOn sets the custom field ON_ProformaInvoice
on the source objects to the deposit invoices.
Creating a deposit invoice
Deposit Invoice Closure
Before you create the final invoice, you must close the deposit invoice. There are two ways to do so:
- Using the Close button on an individual invoice
- Using a custom process to be triggered from a source record
Close button or custom process?
The procedure to close the invoices depends on your business use cases and the corresponding data structure in your org.
If you create invoices from a parent record in a parent-child relation, you most likely use a custom process to be triggered from the relevant parent record. The process clears the custom fields ON_Invoice
, ON_Type
and ON_LastInvoiceRun
on the parent source record, which allows for creating the final invoice from the same record.
If your invoice run involves multiple source records (for example, using multiple filters or via single source object configurations), the Close button on an individual invoice is the more appropriate approach. It clears the custom fields ON_Invoice
, ON_Type
and ON_LastInvoiceRun
on all source records that are related to the current invoice to allow generating the final invoice. This saves the need for manually clearing these fields on the source records.
Close Button
Using the Close button on an individual invoice clears the custom fields ON_Invoice
and ON_LastInvoiceRun
on all related source records to allow generating the final invoice.
Custom Process
If appropriate, you can use a custom process to be triggered from a source record. Applying the specific Apex class that JustOn provides for this purpose, your process
- sets deposit invoices to the status
Closed
- clears the closed deposit invoices to
0
- unregisters any assigned payment balances
- sets the field
RelatedInvoice
of the now unregistered deposit payment balances to the corresponding deposit invoice - sets the custom field
ON_Type
toFinal
- clears the custom fields
ON_Invoice
andON_LastInvoiceRun
on the source record that triggers the process
Closing the deposit invoice via process
Info
Usually, JustOn assigns unregistered deposit payment balances to the corresponding final invoices. Clearing the field RelatedInvoice
of the unregistered deposit payment balance will allow to assign the balance to any matching invoice.
Final Invoice Creation
After you have closed the deposit invoice, you create the final invoice the same way and based on the same source records as the deposit invoice.
Doing so
- registers the balances that were unregistered from the deposit invoice by the closing process to the final invoice
- sets the field
RelatedInvoice
on the final invoice to the corresponding deposit invoice
Creating the final invoice, linked to the deposit invoice
Info
Your business may require to set up installments for final invoices. If you do so, JustOn sets the invoice type Final with Installment
. Removing an installment from a final invoice sets the invoice type Final
.
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.
Deposit Invoice Structure
A deposit 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 display of the subtotal section is controlled using the checkbox
Display Subtotal After
on the lastInformation
type invoice line item. Deselecting this checkbox removes the subtotal section from the invoice PDF. -
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 deposit invoice:
Pos. | Title | Tax Rate | Net Price | |
---|---|---|---|---|
1 | Some Goods | 20% | 1000 | |
2 | Some Service | 20% | 500 | |
Subtotal Net | 1500 | |||
Tax Amount | 300 | |||
Deposit 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.
The final invoice includes additional sections that show the received deposit payment and the remaining final payment, as well as the corresponding tax breakdown.
The following example shows a final invoice with two payments, where each payment has a different tax rate. To make it easier to understand, 20% and 25% are used as tax rates.
Pos. | Title | Tax Rate | Net Price | |
---|---|---|---|---|
1 | Some Goods | 20% | 1000 | |
2 | Some Service | 20% | 500 | |
Subtotal Net | 1500 | |||
Tax Amount | 300 | |||
Grand Total | 1800 | |||
Received Payments (net) | -740 | |||
Tax on Received Payments | -160 | |||
Tax on Received Payments (20 %) | -100 | |||
Tax on Received Payments (25 %) | -60 | |||
Received Payments (gross) | -900 | |||
Remaining Final Payment (net) | 760 | |||
Tax on Remaining Final Payment | 140 | |||
Payment 06/10/2020 25 % | -300 | |||
Payment 08/15/2020 20 % | -600 | |||
Payment Amount | 900 |
If there are multiple payments with different tax rates, the invoice includes a Received Payments Tax ([Tax Rate])
line for each applied tax rate.
Deposit Invoice PDF Output Options
The lines Tax on Received Payments ([Tax Rate])
and Received Payments (gross)
are hidden by the default CSS. You can use custom CSS to hide or show specific lines.
Look at these examples:
Show the Tax on Received Payments ([Tax Rate])
lines
.invoice-table .received-payments-tax-by-taxrate {
display: table-row;
}
Show the Received Payments (gross)
line
.invoice-table .received-payments-gross {
display: table-row;
}
Hide the Received Payments (net)
line
.invoice-table .received-payments-net {
display: none;
}
You can override the labels according to your business requirements. For details, see Configuring Final Invoice Display.
There are two template fields that control the display of the corresponding balance information:
Template Field | Description |
---|---|
Balance Columns | Defines the columns for the balance table. The definition must be a list of balance field API names separated by semicolons. If BalanceTitle is used, the column will display the text defined in the field Balance Types .The default definition is BalanceTitle;Date__c;Amount__c |
Balance Types | Specifies a mapping (in JSON notation) of the values defined in the Type field of the Balance object to some display text (which can include placeholders).Types that are not specified in the mapping are not displayed on the invoice. |
JustOn applies this configuration also to print the received payments on the final invoice PDF. To set these fields, you can use the Final
template detail.
For the Final
template detail, the default definition for Balance Columns
is
BalanceTitle;Date__c;TaxRate__c;Amount__c
If required, you can also set the Balance Types
to show only payments:
[ {
"type" : "Payment",
"title" : "Payment"
}, {
"type" : "Prepayment",
"title" : "Prepayment"
} ]
Info
The template detail Final
is available as of JustOn 2.68. If you upgrade from a previous version, it may not be available. If required, you must create the template detail Final
. For details, see Configuring Template Details.
Note
Because of the temporarily changed tax rules in Germany, there may be payments with different tax rates on one invoice. Due to the necessary adjustments during PDF generation, there may be deviations from PDF files produced with JustOn versions prior to 2.68. Please check the produced PDF files if you have already used final invoices earlier.
Adding Deposit Invoice Fields to Source Objects
In order to hold the required deposit invoice data, you must add new fields to the source object, which can be
- any object if you use the generic invoice run for billing arbitrary objects, or
- the Opportunity object in case of opportunity billing.
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.
- Navigate to the fields list of the source object.
-
Create the following new fields.
API Name Data Type Description ON_Type Text (255) Must be set to Deposit
in order to create deposit invoices. Is cleared automatically when the deposit invoice is closed.ON_ProformaInvoice Lookup (Invoice) Shows the related pro forma or deposit invoice. To have JustOn create a deposit line item, create one of the optional fields:
API Name Data Type Description ON_DepositRate Percent (3,2) If set, JustOn creates a deposit line item with an amount of Deposit Rate * Total
on the deposit invoice.
If both a deposit rate and a deposit amount is defined, the amount takes precedence.ON_DepositAmount Currency (16,2) If set, JustOn creates a deposit line item with the specified amount on the deposit invoice.
If both a deposit rate and a deposit amount is defined, the amount takes precedence.For help about creating fields, see Managing Object Fields.
Info
You can add more fields using the ON field mechanism.
Configuring Deposit Invoice Display
Adjusting Invoice Texts
Usually, a deposit invoice needs other texts on the printed document than the final invoice. You can therefore define a template detail – named Deposit
– 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 or deposit 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 if you have set a deposit rate or a deposit amount. |
Advance Payment (50%) |
Template |
Deposit Description | Long description of the nature of the deposit | Template |
- Open the template or template detail to be edited.
-
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.
-
Click Save.
Adjusting Spacing Between Deposit Invoice Line Item Table Parts
As explained in Deposit Invoice Structure, the deposit 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:
- Open the template to be edited.
-
In the Layout & Design section, double-click the
Custom CSS
field and specify the CSS code as required.tr.Deposit.firstRowAfterSubtotal td { padding-top: 2.5em; }
-
Click Save.
Enabling Deposit Gross Display
As explained in Deposit Invoice Structure, the deposit 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:
- Open the template to be edited.
-
In the Layout & Design section, double-click the
Custom CSS
field and specify the CSS code as required..invoice-table .subtotal-calculated.criteria-forced.gross { display: table-row; }
-
Click Save.
Configuring Final Invoice Display
In the event of a final invoice with existing deposit payments, the invoice PDF shows additional information about the received payments and the final payments below the grand total. The corresponding sections include a detailed tax breakdown.
Example final invoice
Pos. | Title | Tax Rate | Net Price | |
---|---|---|---|---|
1 | Some Goods | 20% | 1000 | |
2 | Some Service | 20% | 500 | |
Subtotal Net | 1500 | |||
Tax Amount | 300 | |||
Deposit Gross | 1800 | |||
Received Payments Net | 750 | |||
Received Payments Tax | 150 | |||
Received Payments Gross | 900 | |||
Remaining Final Payment Net | 750 | |||
Remaining Final Payment Tax | 150 | |||
Remaining Final Payment Gross | 900 | |||
Payment Amount | 900 |
You can define the display of the grand total label using the template field Deposit Grand Total Label
. The field can contain placeholders. It is used only for final invoices with deposit payments - in all other cases or if the field is empty, the invoice PDF shows the label of the invoice field Grand Total
, which is the standard behavior. The other fields use custom labels.
Using custom CSS, you can adjust the positioning, layout, etc. according to your needs.
Label | Custom Label | Description |
---|---|---|
Grand total | The total amount of the invoice. | |
Received Payments (net) | ReceivedPaymentsNet | The calculated total net amount of all payments received on the related deposit invoice. This is the sum of all balance amounts that are related to the deposit invoice without taxes. The tax rate is taken from the field TaxRate__c of the Deposit line item of the related deposit invoice. |
Tax on Received Payments ([TaxRate]) | ReceivedPaymentsTax | Taxes on the total net amount of the payments received. The placeholder [TaxRate] is replaced by the actual value, like 7% . |
Received Payments (gross) | ReceivedPaymentsGross | Total gross amount of the payments received. The display is disabled by the default CSS rules. |
Remaining Final Payment (net) | FinalPaymentNet | The remaining net final payment amount. |
Tax on Remaining Final Payment | FinalPaymentTax | Taxes on the remaining net final payment amount. |
Remaining Final Payment (gross) | FinalPaymentGross | Remaining gross final payment amount. The display is disabled by the default CSS rules. |
Info
Use overrides to overwrite the values of the custom labels.
Creating Process for Closing Deposit Invoices
Closing deposit invoices requires a process that calls the appropriate Apex class provided by JustOn. It closes the deposit invoice and prepares the source object for creating the final invoice (for details, see Deposit Invoice Closure).
Note
Depending on your use cases, the process setup and the objects to involve will vary.
The source object for the process depends on the object that is used for deposit invoicing:
- in case of arbitrary object billing, select the corresponding object, for example, Order,
- in case of opportunity billing, use the Opportunity object
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:
-
In Setup, open Process Builder.
In Salesforce Lightning, navigate to Process Automation > Process Builder.
In Salesforce Classic, navigate to Create > Workflow & Approvals > Process Builder.
-
Click New.
- Specify a (descriptive) process name.
- Set the process to start when
A record changes
. -
Configure the process as required.
Step Option Description Add Object Object The original object whose modifications are to close the deposit invoice Start the process The type of record change that triggers the process, either creation only or creation and modification Add Criteria Criteria for Executing Actions The type of criteria, determines whether to check for specific field values or to evaluate records using a formula Set Conditions | Build Formula The use case-specific criteria, either the filter conditions for evaluating field values or the formula Add Action Action Type The type of action to be executed, must be Apex
Apex Class The Apex class to be executed, must be Close Proforma Invoice
Set Apex Variables Invocable variables for the Apex class Object Id
specifies the reference to the ID field of the original objectSuffix
string value that specifies a recipient-specific suffix, required when using multiple processes for multiple billing configurations -
Click Save.
-
Click Activate.
For help about creating processes, see Lightning Process Builder in the Salesforce Help.
Note
Make sure that closing a deposit invoice from its detail view using the Close button does not trigger the configured process for closing deposit invoices from source records. This may produce errors.
Example use case: Set a checkbox to start the close process
Assume you create invoices from orders. You can, for example, use a custom checkbox field ON_CloseProformaInvoice
on the order to trigger the process when the checkbox is selected.
(1) Create the custom checkbox:
API Name | Data Type |
---|---|
ON_CloseProformaInvoice | Checkbox |
(2) Set up the process as follows:
Option | Value |
---|---|
The process starts when | A record changes |
Object | Order |
Start the process | when a record is created or edited |
Criteria for Executing Actions | Conditions are met |
Set Conditions | [Order].Close Proforma Invoice Is changed True [Order].Close Proforma Invoice Equals True [Order].ON_ProformaInvoice__c Is null False All of the conditions are met |
Action Type | Apex |
Apex Class | Close Proforma Invoice |
Set Apex Variables | Object Id Field Reference [Order].Id |
This triggers JustOn to execute the process when the ON_CloseProformaInvoice
checkbox is selected: It closes the deposit invoice and prepares the object for creating the final invoice (for details, see Deposit Invoice Closure).
Enabling Deposit Invoices for 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 require billing to multiple parties, however – like, for example, in a marketplace scenario.
-
Create multiple (recipient-specific) sets of ON fields as listed in Adding Deposit Invoice Fields to Source Objects.
For details, see Creating Recipient-Specific Controlling Fields.
-
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 Deposit Merch checkbox Close_Merch
Merch
Close Deposit Buy checkbox Close_Buy
Buy
Creating Deposit Invoice and Final Invoice From Different Sources
Your business may require to create a deposit invoice from one source object and the related final invoice from another. Think of the Salesforce CPQ process, for example: You can create the deposit invoice from a quote, and the final invoice from a CPQ subscription that is based on this quote.
In addition to the original deposit invoicing configuration, this approach involves the following steps:
-
Set the deposit invoice fields on the two source objects.
The first source object – the one from which you create the deposit invoice – requires these fields to hold the relevant deposit invoice data:
API Name Description ON_Type Must be set to Deposit
in order to create the deposit invoics.ON_ProformaInvoice Lookup the related deposit invoice. ON_DepositRate |
ON_DepositAmountUsed to set or calculate the price of the deposit line item to be created. The second source object – the one from which you create the final invoice – requires the following fields:
API Name Description ON_Type Must be set to Final
in order to create the final invoice.ON_ProformaInvoice Lookup the related deposit invoice. For details, see Adding Deposit Invoice Fields to Source Objects.
-
Relate the deposit invoice with the second source object.
The lookup field
ON_ProformaInvoice
on the second source record must point to the deposit invoice created from the first source record.According to your project requirements, this relation can be set
- automatically using a dedicated custom process (or an additional action in the deposit invoice closing process)
- automatically using other automation means on record creation, depending on the involved object
- manually through user input
Other required tasks include:
- Configuring Deposit Invoice Display
- Configuring Final Invoice Display
- Creating Process for Closing Deposit Invoices
Workflow outline
Once set up, the solution may work as follows:
Creating deposit invoice and final invoice from different sources
(1) JustOn generates a deposit invoice if the field ON_Type
on the first source record is set to Deposit
. Using the fields ON_DepositRate
or ON_DepositAmount
, you set the price of the deposit line item to be created. The field ON_ProformaInvoice
on the source record points to the deposit invoice.
On payment registration, JustOn assigns the corresponding payment balance to the deposit invoice.
(2) When appropriate, you close the deposit invoice. In particular, this
- unassigns the payment balance from the deposit invoice, and
- creates the lookup between the second source record and the deposit invoice, that is, sets
ON_ProformaInvoice
on the second source record.
(3) With both ON_Type
set to Final
and ON_ProformaInvoice
pointing to the deposit invoice on the second source record, JustOn generates the final invoice. It registers the payment balance, which has been previously unassigned from the deposit invoice, with the final invoice. Doing so reduces the final payment amount.
Enabling Dunning Reminders for Deposit Invoices
By default, pro forma invoices and deposit invoices are exempt from dunning processes. If your business, however, requires issuing reminders for pro forma invoices and deposit invoices, you must explicitly enable this option using the corresponding global setting Allow Pro Forma / Deposit Dunnings
.
-
In Setup, open Custom Settings.
In Salesforce Lightning, navigate to Custom Code > Custom Settings.
In Salesforce Classic, navigate to Develop > Custom Settings.
-
Click Manage in the row of Global Settings.
- Click Edit in the Default row.
- Select the checkbox
Allow Pro Forma / Deposit Dunnings
. - Click Save.
Next steps:
Managing Deposit or Pro Forma Invoices
Return to JustOn Administration.