action.skip

Invoice Line Item Fields and Formulas

← Invoice Calculation

This document describes all price-related fields and formulas on the Invoice Line Item object and how they are related.

For an overview of all Invoice Line Item fields, see the Invoice Line Item object reference.

Terms

Term Description
Unit Price The base price of one unit of the invoice line item. Can be a net or a gross value.
Pos Price The total price of the invoice line item after applying all quantity-related and pos price-related values.

Base Fields

There are four groups of base fields:

Base values
Unit Price, Quantity
Quantity-related values
Factor, Billing Factor
Unit Price-related values
Commission
Pos Price-related values
Discount, Discount Amount, Order Discount Amount, Decimal Places
API Name Data Type Is Rounded Affects Description
Quantity__c Number (13,5) no The quantity of the item.
The default value is 1.0.
UnitPrice__c Currency (13,5) no The net or gross price of one unit.
GrossInvoice__c Checkbox Determines how to interpret the unit price.
false = net
true = gross
The default value is false.
Factor__c Number (13,5) no Quantity The factor is provided by the quantity unit (custom setting). The actual quantity is divided by the factor.
BillingFactor__c Number (13,5) no Quantity Factor resulting from the billing period and the billing unit, used to adapt the quantity to the service period.
For example, the billing unit Month combined with the billing period 3 results in a billing factor of 3, that is, the item is invoiced every three months with the price multiplied by three.
Commission__c Percent (3,2) no Unit Price A percentage rate for calculating the line item total based on the unit price and the defined percentage
Discount__c Percent (3,2) no Pos Price A percentage rate used to reduce the pos price by the specified percentage.
DiscountAmount__c Currency (16,2) yes Pos Price A fixed amount, reduces the pos price by the specified amount. The discount amount is applied if the discount field is empty.
AEDiscountAmount__c Currency (16,2) yes Pos Price A fixed amount, reduces the pos price by the specified amount.
DecimalPlaces__c Number (2,0) no Pos Price The currency-specific number of decimal places used for the invoice line item calculation, as taken from the multi-currency configuration.
The value is set automatically, not to be modified manually.
PrecalculatedTax__c Currency (16,2) yes The absolute tax amount calculated internally or by a third party system.

Base Formulas

Base formulas normalize values and support unit formulas and pos formulas.

CalculatedFactor

API Name Data Type Blank as Description
CalculatedFactor__c Number (13,5) blank Corrects the quantity unit factor to 1.0 to avoid division by zero.
BLANKVALUE(
    Factor__c,
    1.0
)

CalculatedQuantity

API Name Data Type Blank as Description
CalculatedQuantity__c Number (13,5) zero Corrects the quantity by the factor of the quantity unit.
Quantity__c / CalculatedFactor__c

CalculatedTotalQuantity

API Name Data Type Blank as Is Rounded Description
CalculatedTotalQuantity__c Number (18,5) zero no The calculated quantity multiplied with the calculated billing factor.
CalculatedQuantity__c * CalculatedBillingFactor__c

CalculatedCommission

API Name Data Type Blank as Description
CalculatedCommission__c Percent (3,2) blank Corrects the commission to 1.0 to avoid multiplication with zero.
BLANKVALUE(
    Commission__c,
    1.0
)

CalculatedBillingFactor

API Name Data Type Blank as Description
CalculatedBillingFactor__c Number (13,5) blank Corrects the billing factor to 1.0 to avoid multiplication with zero.
BLANKVALUE(
    BillingFactor__c,
    1.0
)

IsDiscountEmpty

API Name Data Type Blank as Description
IsDiscountEmpty__c Checkbox blank Determines whether the discount percentage field is filled.
ISBLANK(Discount__c)

HasPrecalculatedTax

API Name Data Type Blank as Description
HasPrecalculatedTax__c Checkbox blank Determines whether the pre-calculated tax field is filled.
NOT(ISBLANK(PrecalculatedTax__c))

IsTaxDelta

API Name Data Type Blank as Description
IsTaxDelta__c Checkbox blank Determines whether this line item is a tax delta item used to clear tax rounding differences when calculating invoice line item totals.
ISPICKVAL(
    Type__c,
    'Tax Delta'
)

Unit Formulas

UnitPriceCalc

API Name Data Type Blank as Is Rounded Description
UnitPriceCalc__c Currency (13,5) zero no The net or gross unit price multiplied with the commission.
UnitPrice__c * CalculatedCommission__c

Pos Formulas

DecimalPlacesFallback

With multiple currencies enabled, you can specify the number of decimal places (number of digits to the right of decimal point) for each currency. Consequently, JustOn takes the number of decimal places used for a specific currency from the relevant currency configuration, copying it to the invoice line item field Decimal Places (see Base Fields). This value is then used to round amounts in formulas for calculating the invoice line item price, taxes, etc.

If Decimal Places is not set, JustOn uses two decimal places – as defined in DecimalPlacesFallback:

API Name Data Type Blank as Is Rounded Description
DecimalPlacesFallback__c Number (0 decimal places) blank no Sets the number of decimal places used for the invoice line item calculation to 2 if DecimalPlaces is empty.
BLANKVALUE(ONB2__DecimalPlaces__c,2)

PosPriceCalc

API Name Data Type Blank as Is Rounded Description
PosPriceCalc__c Currency (13,5) zero no The net or gross invoice line item price multiplied with the calculated total quantity.
UnitPriceCalc__c * CalculatedTotalQuantity__c

PosPriceDiscounted

API Name Data Type Blank as Is Rounded Description
PosPriceDiscounted__c Currency (13,5) zero depends on Invoicing Engine (see PosPriceDiscountedNoAE) The net or gross invoice line item price corrected by all discount values.
PosPriceDiscountedNoAE__c +
IF(
    GrossInvoice__c,
    0,
    AEDiscountAmount__c
)

CalculatedTax

API Name Data Type Blank as Is Rounded Description
CalculatedTax__c Currency (16,2) zero yes The tax calculated based on the discounted pos price and the tax rate.
ROUND(
    PosPriceDiscounted__c *
    IF(
        GrossInvoice__c,
        1 - 1 / (1 + TaxRate__c),
        TaxRate__c
    ),
    DecimalPlacesFallback__c
)

PosTotalNet

API Name Data Type Blank as Is Rounded Description
PosTotalNet__c Currency (16,2) zero yes The invoice line item total net value including all discounts.
IF(
    IsTaxDelta__c,
    0,
    ROUND(
        PosPriceDiscounted__c,
        DecimalPlacesFallback__c
    ) -
    IF(
        GrossInvoice__c,
        PosTotalTax__c,
        0
    )
)

PosTotalTax

API Name Data Type Blank as Is Rounded Description
PosTotalTax__c Currency (16,2) zero yes The final tax amount.
IF(
    IsTaxDelta__c,
    UnitPrice__c,
    IF(
        HasPrecalculatedTax__c,
        PrecalculatedTax__c,
        CalculatedTax__c
    )
)

PosTotalGross

API Name Data Type Blank as Is Rounded Description
PosTotalGross__c Currency (16,2) zero yes The invoice line item total gross value including all discounts.
IF(
    IsTaxDelta__c,
    UnitPrice__c,
    ROUND(
        PosPriceDiscounted__c,
        DecimalPlacesFallback__c
    ) +
    IF(
        GrossInvoice__c,
        0,
        PosTotalTax__c
    )
)

Pos Formulas for Order Discount Handling

PosPriceDiscountedNoAE

Info

As of JustOn Billing & Invoice Management v2.88, the Invoice Line Item field Invoicing Engine controls the rounding approach. For new invoices, Invoicing Engine is set to 2, indicating that PosPriceDiscountedNoAE and PosPriceDiscounted are rounded for all newly created invoices. For existing invoices after upgrading from a previous JustOn version, Invoicing Engine is empty, indicating that the previous rounding mode is applied.

For details, see Invoice Line Item Rounding.

API Name Data Type Blank as Is Rounded Description
PosPriceDiscountedNoAE__c Currency (13,5) zero depends on Invoicing Engine The net or gross invoice line item price corrected by all discount values, except for the order discount.
CASE(InvoicingEngine__c,
     '2', PosPriceDiscountedNoAE2__c,
     PosPriceDiscountedNoAE1__c
)

The invoicing engine v1 does not round the invoice line item price before the tax calculation and order discount application. It calculates the discounted position price using all passed decimal places.

PosPriceDiscountedNoAE1

API Name Data Type Blank as Is Rounded Description
PosPriceDiscountedNoAE1__c Currency (13,5) zero no The net or gross invoice line item price corrected by all discount values, except for the order discount (not rounded, invoicing engine v1).
IF(
    IsDiscountEmpty__c,
    PosPriceCalc__c + DiscountAmount__c,
    PosPriceCalc__c * (1 - Discount__c)
)

The invoicing engine v2 rounds the discounted position price, passing the rounded value to the tax calculation and order discount application.

PosPriceDiscountedNoAE2

API Name Data Type Blank as Is Rounded Description
PosPriceDiscountedNoAE2__c Currency (13,5) zero yes The rounded net or gross invoice line item price corrected by all discount values, except for the order discount (invoicing engine v2).
ROUND(
    PosPriceDiscountedNoAE1__c,
    DecimalPlacesFallback__c
)

PosTotalNetNoAE

API Name Data Type Blank as Is Rounded Description
PosTotalNetNoAE__c Currency (16,2) zero yes The invoice line item total net value without the order discount.
IF(
    IsTaxDelta__c,
    0,
    ROUND(
        PosPriceDiscountedNoAE__c,
        DecimalPlacesFallback__c
    ) -
    IF(
        GrossInvoice__c,
        PosTotalTax__c,
        0
    )
)