Configure HTML invoice templates for prepaid commitments
Learn how to configure an HTML invoice template to display prepaid commitment, balances, and application line items on customer-facing invoice PDFs.
-
Make sure the customer account uses an HTML invoice template.
-
Have a prepaid funding invoice and a subsequent service invoice available for preview.
-
Identify the prepayment processing types used by your billing system.
- Open the invoice template configuration.
- Go to Billing > Manage Billing Document Configuration.
- Open the Manage Invoice Rules and Templates tab.
- Create an HTML invoice template or open an existing HTML invoice template.
- Add prepaid commitment balance summary.
Include the prepayment billing item and balance tracking fields in the template. Map the balance components as follows:
Balance value Source or calculation Suggested label Total prepayment Commitment period amount Total Prepayment Beginning balance Ending balance less consumed amount on the current invoice Beginning Balance Amount consumed on the invoice Sum of prepayment application amounts Consumed Amount Balance after the current application Remaining commitment-period balance Ending Balance The beginning balance is calculated by subtracting the consumed amount on the current invoice from the ending balance:
Beginning Balance = Ending Balance - Consumed AmountThe consumed amount is stored as a negative value. The
ProcessingTypefilter identifies prepayment application invoice items:EQmeansequals, and9is the processing type forPrepaymentApplication. Summing theChargeAmountvalues of these items gives the total amount consumed during the invoice period.Therefore, use a minus sign in the calculation.
For example, if the beginning balance is 1,200, the consumed amount is -300, and the ending balance is 900, the calculation is
1,200 = 900 - (-300).In the HTML invoice template editor, configure the merge field or formula to calculate the beginning balance from the ending balance and the consumed amount on the current invoice.
The following example uses the ending balance in
{{Balance}}and subtracts the current invoice's consumed amount:{{#Wp_Eval}} {{Balance}} - {{Invoice.InvoiceItems|FilterByValue(ProcessingType,EQ,9)|Sum(ChargeAmount)}} {{/Wp_Eval}} - In the invoice-item table, include the prepayment invoice item separately from service charge items. Note: Use the invoice-item processing type and commitment source to distinguish the prepayment item from standard service charges.
- Add prepayment application as a negative line item.
Prepayment applications are generated as separate invoice items with
ProcessingType = PrepaymentApplicationandInvoiceDetailSource = Commitment. They offset eligible service charges and are displayed as negative invoice lines.- Add the invoice-item table or invoice-item section to the HTML template.
- Filter the section to include invoice items with the prepayment-application processing type.
- Display the invoice-item description and amount.
- Label the line Prepayment Application or use the commitment name followed by – Credit Application.
- Do not prepend another minus sign to the amount. Render the invoice-item amount as stored so that the negative amount is not double-negated.
- Save and assign the template.
- Save the template.
- Assign the template to the relevant customer account, if needed.
- Preview and validate the PDF output.
- Preview the template with a prepayment invoice.
- Preview the template with a later service charge invoice.
- Confirm that the prepayment amount, beginning balance, consumed amount, ending balance, and prepayment application line are understandable to the invoice recipient.
- Confirm that the prepayment application reduces the service charge invoice balance as expected.
- Regenerate the PDF after changing the template or invoice data, and confirm that the updated content appears.