The New Delta Pre-Invoice Generation feature ensures that your invoicing process is accurate and up-to-date by comparing the latest invoiced amounts with new amounts and creating delta pre-invoice items for any differences. This feature handles various aspects of invoicing, including timesheet activities, flexible payment plans, packages, and invoice contacts, making your invoicing more efficient and reliable.
How it works
When delta invoicing is activated, the generation of pre-invoices is based on comparing the latest invoiced amounts with the new amounts, which include the changes. When you generate a new pre-invoice, the system will fetch the latest invoiced items and compare them with the new campaign amounts to identify any differences. The system will create delta pre-invoice items for any differences found between the latest invoiced amounts and the new amounts.
Delta pre-invoices are generated and invoice items are created when the delta optimization version is activated or after the Delta Preinvoice generation when the campaign item is adjusted.
The delta changes are made in the pre-invoice of their respective period or, if the period is closed for invoicing, the adjustments are made in the next open period.
How to call Delta Preinvoice generation
When the delta invoicing is enabled on the Admin settings the new delta pre-invoice generation is called during the following processes:
New PreInvoice generation button on the Media Campaign
Pre-invoice wizard (to be deprecated)
Pre-Invoice wizard (Lightening)
Scheduled Pre-Invoice Batch Job
the global invocable method that calls the batch job →
GenerateInvoiceBatch.doGenerateInvoice
(can be called from everywhere, custom apex code and flows)The end campaign item feature for items based on actuals (triggered by the media campaign trigger)
The end campaign item feature for items based on linear distribution (triggered by the end campaign item feature)
The
FlowInvocableProcess
for flow executions (“CreateInvoicesBatchJob
")The optimizer activation triggered Process Builder flow →
ProcessCompleteEventOptimizingVersion.flow
- this action can be disabled since PreInvoice generation is triggered with optimizing version activationInvoice Wizard (Lightening) - The pre-invoice update stage is included
Invoice Wizard (To be deprecated) - The pre-invoice update stage is included
Financial Changes
Only financial changes are taken into consideration by the pre-invoice generation and the following items are being compared to evaluate if it is a financial change or not.
Invoice Item Amount Comparison:
comparison of invoice item amounts already invoiced with those that would be calculated by the next pre-invoice generation, for each specified payment interval (total, yearly, half-yearly, quarterly, monthly, weekly).
This comparison is done at the invoice item level, considering amounts B3, B2, B1, N1, N2, and N3
Invoicing Based on Linear Distribution vs. Actual Delivery
There are two types of invoicing: based on the linear distribution and based on actual delivery data (utilizing actual delivery from Revenue Schedules).
For linear distribution, amounts are calculated based on the runtime of the campaign item across payment intervals.
For actual delivery, amounts are calculated based on delivery data in the Revenue Schedule, for billing categories such as CPM, CPC, vCPM, CPCV and Budget
Weekly payment interval is using Revenue Schedules Daily and has to be enabled through the admin setting
New Invoice and invoice item fields
A new invoice item fields have been created to improve the handling of the Delta Invoicing:
Delta Change Reason
API Name: DeltaChangeReason__c
During the optimization, the reason for the change for every single Campaign item can be added and it is mapped to the invoice item to use it in the Invoice PDF to show the reason for the change.
Referenced Invoice Number
API Name: ReferencedInvoiceNumber__c
This field stores the original invoice number which was adjusted.
Position Reference
API Name: PositionReference__c
This is a reference to the previous version of the invoice item related to this campaign item
Invoice Item Creation Type
API Name: CreationType__c
.
A new picklist field has been created to identify an invoice item creation type. This field is preset automatically and should not be changed by the user.
Following are the picklist values:
None - This creation type is the same as the related invoice item. Nothing will change when it comes to displaying this item
Flexible Payment Plan - Invoice items created based on the Flexible Payment Plan
Technical Reversal - This is the negative clone of the previous version
Delta Adjustment - This is a new version of the Invoice item after the change. This item would display the new Delta fields
The following new fields for delta invoicing are created which will calculate the outstanding amount based on changes done for Campaigns and what was already invoiced.
API Name | Label | Invoice Item API Name + Logic |
---|---|---|
| Outstanding Gross Amount B3 |
Additional Condition: |
| Outstanding Gross Amount B2 |
Additional Condition: |
| Outstanding Gross Amount B1 |
Additional Condition: |
| Outstanding Invoiced Amount N1 |
Additional Condition: |
| Outstanding Invoiced Amount N2 |
Additional Condition: |
| Outstanding Invoiced Amount N3 |
Additional Condition: |
| Outstanding Non-Media Amount |
Additional Condition: |
| Outstanding DST Amount |
Additional Condition: |
| Outstanding Nontaxable Amount (DST) | Based on
|
| Outstanding Taxable Amount (DST) | Based on
|
| Outstanding VAT Amount (Type 1 (A)) |
|
| Outstanding VAT Amount (Type 1 (B)) |
|
| Outstanding VAT Amount (Type 2 (A)) |
|
| Outstanding VAT Amount (Type 2 (B)) |
|
| Outstanding Taxable Amount (VAT Type 1) |
|
| Outstanding Taxable Amount (VAT Type 2) |
|
| Outstanding Nontaxable Amount (VAT Total) | Based on
|
QR code feature users should map the correct amount to the ESR reference.
For Non-delta and Normal Items, the following fields are relevant
Those normal roll-up fields do not include the amounts of the technical reversal items.
Invoice Field API Name | Invoice Field Label | Invoice Item API Name + Logic |
---|---|---|
(This is a salesforce roll-up field and needs to be changed in the field definition) | Gross Amount B3 |
Additional Condition: |
(This is a salesforce roll-up field and needs to be changed in the field definition) | Gross Amount B2 |
Additional Condition: |
(This is a salesforce roll-up field and needs to be changed in the field definition) | Gross Amount B1 |
Additional Condition: |
(This is a salesforce roll-up field and needs to be changed in the field definition) | Invoiced Amount N1 |
Additional Condition: |
(This is a salesforce roll-up field and needs to be changed in the field definition) | Invoiced Amount N2 |
Additional Condition: |
(This is a salesforce roll-up field and needs to be changed in the field definition) | Invoiced Amount N3 |
Additional Condition: |
(This is a salesforce roll-up field and needs to be changed in the field definition) | Non-Media Amount |
Additional Condition: |
(This is calculated in the | DST Amount |
Additional Condition: |
(This is calculated in the | Nontaxable Amount (DST) | Based on
|
(This is calculated in the | Taxable Amount (DST) | Based on
|
(This is a salesforce roll-up field and needs to be changed in the field definition) | VAT Amount (Type 1 (A)) |
|
(This is a salesforce roll-up field and needs to be changed in the field definition) | VAT Amount (Type 1 (B)) |
|
(This is a salesforce roll-up field and needs to be changed in the field definition) | VAT Amount (Type 2 (A)) |
|
(This is a salesforce roll-up field and needs to be changed in the field definition) | VAT Amount (Type 2 (B)) |
|
(This is calculated in the | Taxable Amount (VAT Type 1) | Based on
|
(This is calculated in the | Taxable Amount (VAT Type 2) | Based on
|
(This is calculated in the | Nontaxable Amount (VAT Total) | Based on
|
The general amount calculation is described here: 4.2.6.2 Amount Calculation and Discounts
Formula fields will not be created for Delta, however, we need to document the formula so that customers can create their custom fields.
Formula | Delta API Name | Delta Label | Normal API Name |
---|---|---|---|
|
| Delta Invoiced Amount Gross (DST) |
|
|
| Delta VAT Total (Type 1) |
|
|
| Delta VAT Total (Type 2) |
|
|
| Delta Taxable Amount (VAT Total) |
|
|
| Delta VAT Total |
|
|
| Delta Invoiced Amount Gross (Total) |
|
|
| Delta Early Payment Discount abs. |
|
|
| Delta Invoiced Amount Gross (incl. EPD) |
|
Assigning Accounting Periods
The Delta Pre-Invoice Generation process ensures that all pre-invoices have an assigned accounting period. If accounting periods are not yet created when the pre-invoices are generated, the accounting period field will remain empty and will be updated during the next pre-invoice generation once the accounting periods are created.
Pre Invoice Status
The Delta Pre-Invoice Generation process now includes pre-invoices with the status "Reviewed." This ensures that reviewed pre-invoices are treated according to specific rules to prevent unwanted creation of additional delta pre-invoices.
Functionality of Status “Reviewed”:
Reviewed pre-invoices are not updated, similar to invoiced invoices.
Draft pre-invoices can be updated or reassigned as needed.
Resetting Status to Draft:
If any amounts (B3 → N3) change or new pre-invoice items match a reviewed pre-invoice, the status is reset to Draft.
Prevents creation of unnecessary additional delta pre-invoices.
Invoice Assignment Rules:
Ensures that pre-invoice assignments are managed efficiently without creating duplicate pre-invoices.
Rounding during delta preinvoice generation
All the following values during the Pre-Invoice Generation are rounded off before the invoice items are saved to the database.
InvoiceAmount__c
GrossAmountB3__c
GrossAmountB2__c
GrossAmountB1__c
InvoicedAmountNet1__c
InvoicedAmountNet2__c
InvoicedAmountNet3__c
InvoiceSurchargeB3Abs__c
InvoiceSurchargeB2Abs__c
RateDiscount1AbsCustom__c
RateDiscount2AbsCustom__c
RateDiscount3AbsCustom__c
RateDiscount4AbsCustom__c
InvoicedQuantity__c
SalesPrice__c
Validations relevant to Pre-invoice Generation
Following validations are in place for Media campaign and Campaign items for when the pre-invoice generation is triggered
Media Champaign Conditions | Error Message |
---|---|
|
|
| |
| |
| |
| |
|
|
Champaign Item Condition | Error Message | |
---|---|---|
| items without bill me set will be ignored | / |
| package components with bill me set will be ignored if the related package header doesn’t have bill me set Packages are not supported yet in the delta pre-invoice generation. | / |
| The first encountered budget item related to a weekly media campaign will throw an error | Pre-invoice generation is not supported for the Budget billing category with a weekly payment interval. Using the media campaign button with standard pre-invoice generation: |
Customers can change unlimited invoicing
to true/false when the campaign items are partially or fully invoiced for delta invoicing.
The “Update delivery data” button has been removed from the Invoice object and this action of updating the delivered quantity is included in the PreInvoice generation and the Pre-invoice update stage is included in the old billing run. We strongly advise removing all the custom flows or actions related to this button.
When the pre-invoices are generated for the media champaign with weekly payment interval when the Admin Setting “Enable calculation of Revenue Schedules Daily“ is disabled it will create Pre-Invoices with a 0
as invoice item InvoicedQuantity__c
and QuantityDelivered__c
. Kindly report if it gives a null pointer error.
If the campaign item is changed/edited without optimizer the changes will not be reflected automatically in the pre-invoices and the run pre-invoices button has to be triggered to have the change reflected in the pre-invoice. With optimizer, the pre-invoice gets updated automatically
Absolute Surcharges and Discount
A new rounding-off logic is in place for the calculation of absolute surcharges and discounts
Positive absolute surcharges make use of the rounding mode
HALF_DOWN
Negative absolute surcharges make use of the rounding mode
HALF_UP
Absolute discounts make use of the rounding mode
FLOOR
Amounts based on actuals make use of the rounding mode
HALF_UP
Due to the new rounding logic, the user may notice a cent difference between periods.
The updated logic ensures that when the total campaign item amount matches the invoice amount (indicating the campaign item was fully invoiced), no delta pre-invoice items are created.
In cases where the campaign item amounts do not match the invoice item amounts combined, delta invoice items will still be created.
The amounts of Absolute discounts and absolute surcharges in case of unlimited invoicing are capped at the amount of Sales Price
The new logic in place would produce a one-cent difference in version 2.171 and 2.172
To avoid this difference in 2.171 users can limit MC where the pre-invoice generation is run (Setting on the admin settings)
The numbers in the table are just for an example
| Version 171 or lower | Version 172+ |
---|---|---|
Surcharge B3 Abs used for amount calculation |
|
|
Calculation used for Surcharge B3 Abs |
|
|
Amount B2 before rounding |
|
|
Rounding Mode |
|
|
Amount B2 rounded |
|
|
Commitments
With delta invoicing enabled, the user can apply commitments / re-apply commitments to the campaign items that are partially or fully invoiced. That is, Media Campaign Action “Apply Commitments“ can be used to apply the new commitment conditions to the invoiced campaign items.
Apply commitment condition action button does not apply commitment if the “PreventFieldChanges” feature setting is enabled (This will be fixed in the next version).
Threshold Feature
OUT OF SCOPE FOR DELTA VERSION I
The threshold feature allows users to define a minimum percentage change in the calculated amounts which triggers the creation of a delta invoice item.
Assigning Timesheet Activities
If your campaign item is supposed to be invoice-based on the timesheet activities, you need to ensure that your ADspec has a CPH billing category and that your campaign item should have Linear Distribution checked as false and Time Tracking should be true.
The change in the Delta release is that users do not need to press “Update delivered quantity” on the Invoice, since the revenue schedule data is updated automatically in the preinvoice generation.
When the timesheet activity-based campaign item is adjusted and with the delta invoicing, we can have multiple invoice items for the same campaign item with the same InvoiceItemStartDate__c
and InvoiceItemEndDate__c
. We assign the “latest“ invoice item to the timesheet activity. The latest invoice item is always the one that gets created or updated.
Flexible Payment Plans
With the enhancements in the last version, we enabled the possibility to edit or delete the Flexible payment plans that are not related to the Invoiced Invoice item. To achieve this we have a relationship between Flexible Payment Plan and PreInvoice/Invoice Item to be more transparent about which of those records belong to each other. One Flexible Payment Plan can only have one Preinvoice/Invoice Item related to it. This relation is generated by the Preinvoice generation and can not be set or changed manually.
When an Invoice/invoice item is canceled we do not remove the relation, however, next preinvoice generation will relate the new correct preInvoice item to the flexible payment plan. When the Campaign Item is canceled the relation stays.
The Pre-Invoice Generation validates if the total of all Flexible Payment Plans matches the amount of the Campaign Item. When the total amount or percentage does not match, Preinvoice generation will show the error.
Flexible Payment Plan invoice items will never create technical reversal or delta invoice items. If the campaign item amount changes for those campaign items, new flexible payment plans are created by the user to cover the remaining.
In the Beta I version Flexible payment plan-related pre-invoice items are merged with normal and/or delta pre-invoice items when those have matching accounting periods.
Preinvoice generation will not be automatically triggered by the optimizing version activation and should be called after the Flexible payment plan is adjusted.
We strongly suggest using the standard Salesforce features to track the change history of the Flexible Payment plans to see which users have performed the change.
A Flexible Payment Plan Invoice Items have always following (additional) field setting logic
Field | Value | Notes |
---|---|---|
| See Notes | Is calculated based on related Flexible Payment Plan and related Campaign Item for for Which “Campaign Item Amount” is used can be configured in the Admin Settings. |
| A “Campaign Item Amount” | Which “Campaign Item Amount” is used can be configured in the Admin Settings. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Amount-based Flexible Payment Plan
When the amount-based FPP-related campaign item is optimized or adjusted, the user needs to adjust the amounts in the NOT invoiced Flexible payment plan or add a new one to get the amount matching to the Campaign item.
Percentage-based Flexible Payment Plan
When Percentage based FPP related campaign item is optimized or adjusted, ADvendio will recalculate % of the existing Flexible Payment plan, to represent the ratio or invoiced, where the user needs to adjust the % in the NOT invoiced Flexible Payment plan or add a new one to get 100% of FPP.
We have adjusted the Flexible payment plan field PercentageAmount
up to 5 numbers and 2 decimals
Publication Dates Additions
Flexible Payment Plans created by selected Publication Dates are created as percentage-based flexible payment plans.
In cases of adding more selected publication dates, it does not recalculate the % for invoiced or reviewed Flexible Payment Plans because the amount of the campaign item has not changed. Only adjust open Flexible Payment Plans linearly based on the outstanding %.
We also do not allow the deletion of Selected Publication Dates with a relationship to a Flexible Payment Plan where a related Invoice item is invoiced.
Deleting a publication date related to a flexible payment plan that relates to a reviewed pre-invoice item, will delete the related flexible payment plan and the next pre-invoice generation will delete the reviewed pre-invoice.
Invoice at Start / End of Runtime Additions
Flexible Payment Plans created by the Invoice at the Start / End of Runtime Checkboxes are created as percentage-based flexible payment plans.
Invoice Assignment
Flexible Payment Plan Pre-Invoice Items will be merged with normal and/or delta pre-invoice items when the Invoice Date of the flexible payment plan matches the same accounting period or if the initial accounting period is already closed.
This also means that multiple different flexible payment plans are merged if they belong to the same accounting period.
The invoice accounting date, accounting end date (technical fields) and invoice date depend on which invoice item is created first:
Type | Invoice Accounting Date | Invoice Accounting End Date | Invoice Date |
---|---|---|---|
based on Flexible Payment Plan |
|
|
|
based on Media Campaign Payment Interval | first of period | last of period | Either first of period, first of next period, end of period or end of next period. Based on |
Managing Packages
OUT of scope for Delta Beta version I
Handling Invoice Contacts
The system creates and updates invoice contacts based on the configured campaign contacts. If any contacts are no longer needed, they will be deleted.