action.skip

Controlling Decimal Places on PDF Files

← Controlling Invoice Calculation

There are several settings that control the number of displayed decimal places for numeric values on PDF files. JustOn applies the settings in the following order:

(1) Decimal Places on the template

(2) Decimal Places for Unit Price and Decimal Places for Quantity on the invoice line item

(3) Decimal Places for Unit Price and Decimal Places for Quantity in the global settings

(4) Global default: two decimal places for all numeric values

Info

If one setting is not set or not found, JustOn falls back to the next one.

Template Setting

The template field Decimal Places is the most relevant setting to control the number of decimal places to be displayed for individual fields. The setting accepts all objects (standard, custom and JustOn objects) and fields. It therefore applies to all placeholder fields as well as fields in the line item table, the transaction table and the tax breakdown table.

The field value is in JSON notation and has the following syntax:

{
  "ObjectApiName" : { "FieldApiName" : number }
}

To set, for example, the number of displayed decimal places for the price and tax fields of the invoice line item and tax delta to 2 and for the invoice total to 4, use:

{
    "InvoiceLineItem__c": {
        "TaxAmount__c": 2,
        "UnitPrice__c": 2,
        "Quantity__c": 2,
        "PosTotalNet__c": 2
    },
    "TaxDetail__c": {
        "Rate__c": 2
    },
    "Invoice__c": {
        "GrandTotal__c": 4
    }
}

The setting also accepts special fields for calculated values:

{
    "Calculated": {
        "SubTotalTax": 3,
        "SubTotalNet": 2,
        "SubTotalGross": 2
    }
}

To configure the number of decimal places:

  1. Open the template to be edited.
  2. In the Overrides section, click next to the Decimal Places field and specify the definition in JSON as required.

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

  3. Click Save.

Invoice Line Item Setting

The following settings on the invoice line item control the decimal places display:

Field Description
Decimal Places for Unit Price Applies to all Invoice Line Item fields that start with Unit
Decimal Places for Quantity Applies to all Invoice Line Item fields that contain Quantity

There are several ways to have these fields set:

  • When creating invoices from subscriptions, you can set these fields on the subscription items.
  • When creating invoices from other objects using the generic invoice run, you can create a corresponding ON field on the source object to have these values set on the resulting invoice line items.

Global Setting

The following global settings control the decimal places display:

Field Description
Decimal Places for Unit Price Applies to all fields that start with Unit
Decimal Places for Quantity Applies to all fields that contain Quantity

Info

The global settings apply to all fields in placeholders, the line item table and transaction tables.