Skip to main content

Calculation engine to manage calculation sets flagged for deduction

Purpose / Description

Calculation sets can be flagged with Calculated fee amount will be used for deduction = Yes (see the use case for the calculation set property). This use case describes how the calculation engine handles these sets.

The engine first calculates the invoice (for payables: payment amount) of every calculation set. The amounts of the regular calculation sets are added up. The amounts of the deduction calculation sets are then subtracted from that sum (netting off). If the result is negative, because the deductions exceed the positive amounts, or if only deduction calculation sets are available or produce amounts, a credit note is created for receivables (Agreements with Direction IN) and an invoice is created for payables (Agreements with Direction OUT).

As an extension, the user can cap credit notes and invoices at zero via the constraints functionality.

Use Case 


As a system I need to handle deductions resulting from calculation sets. 
Primary Actor(s)

Calculation engine triggered via import or manual amendment from users. 

Stakeholders and Interest 

Fee/commission accounting and billing: need correct netted amounts and the right document type (invoice, payment, credit note). Product owner and business analysts: need transparent, configurable deduction behaviour. 

Trigger 

A calculation is started for an agreement version (Direction IN or OUT) (with or without standard condition) that contains at least one calculation set.

Pre-condition(s)

The agreement version or standard condition contains one or more calculation sets. One or multiple will be flagged for deduction (Yes or No). The calculation sets have valid scope, calculation parameters and scale. Input data for the calculation period is available.

Post-condition(s)

One netted result is available per agreement and calculation period. Depending on the result, an invoice or payment is created, or a credit note (receivables) or invoice (payables) is created. The amount may be capped at zero when a minimum constraint of Zero applies. The payment review and invoice review report shows the amount per calculation set and the netting step.

Main success scenario
  1. The engine calculates the amount of every calculation set separately.
  2. The engine adds up the amounts of all calculation sets with deduction = No (sum A).
  3. The engine adds up the amounts of all calculation sets with deduction = Yes (sum D).
  4. The engine subtracts sum D from sum A (result R = A - D).
  5. If R is positive, the engine creates the normal invoice (receivables) or payment (payables) for amount R.
  6. The engine stores the amounts per calculation set and the netting result so the outcome can be traced.
Extensions

X1: Result negative. If R is negative, the engine creates a credit note for receivables (Direction IN) or an invoice for payables (Direction OUT) for the negative amount.<br>

X2: Only deduction sets. If only deduction calculation sets exist or only they produce amounts (A = 0), the engine treats the result as negative and creates a credit note  (receivables) or invoice (payables).<br>

X3: Capping at zero. If a constraint caps credit notes and invoices at zero, the engine does not create a credit note (payables) or invoice (receivables) for a negative result; the result is set to 0.<br>0

X4: No deductioncalculation sets.sets flagged for deduction. If no calculation set has deduction = Yes, the engine behaves as today.

Exception scenarios

E1: N/A calculation set cannot be calculated (missing data or parameter). The engine reports the error for that set and does not create a netted document for the agreement until it is resolved.<br>E2: Calculation sets of one agreement produce amounts in different currencies. The engine does not net them and reports an error (to be confirmed).<br>E3: Result is exactly zero. No document is created (to be confirmed).

Special requirements

The behaviour is the same for Agreements IN, Agreements OUT and Standard conditions. Results must be traceable: the amount per calculation set and the deducted amount must be visible. Calculation sets of existing agreements are all set to No,No during migration, so existing results do not change.

Open questions

1. Is netting done per agreement and calculation period, or across a wider scope (for example per counterparty)?<br>2. Which constraint is used to cap at zero (existing or new), and is it set per agreement, per version or per calculation set?<br>3. How are rounding and currency handled when sets use different currencies?<br>4. What happens when the net result is exactly zero (no document, or a zero document)?<br>5. How should the document (credit note or invoice) show the deduction lines: one netted line or all lines per calculation set?<br>6. Can a regular (non-deduction) calculation set produce a negative amount, and how is it treated in sum A?

MockupSample

Case

Regular sets (sum A)

Deduction sets (sum D)

Result R = A - D

Receivables (Direction IN)

Payables (Direction OUT)

1: Positive result

1,000

300

700

Invoice 700

Payment 700

2: Negative result

200

500

-300

Credit note 300

Invoice 300

3: Only deduction set

0

400

-400

Credit note 400

Invoice 400

4: Negative result, capped at zero

200

500

-300, capped to 0

No credit note

No invoice

5: No deduction sets

1,000

0

1,000

Invoice 1,000

Payment 1,000

Functional Requirements

Business rules and functional requirements

The engine calculates the amount of each calculation set independently before any netting is done.


Calculation sets with 'Calculated fee amount will be used for deduction'= Yes are treated as deduction sets; all other sets are regular sets.


The engine adds up the amounts of all regular sets (sum A) and of all deduction sets (sum D), and calculates the result R = A - D.


If R is positive, the normal invoice (receivables) or payment (payables) is created for the amount R.

If R is negative, or if only deduction sets exist or produce amounts, a credit note is created for receivables (Direction IN) and an invoice is created for payables (Direction OUT).

If no deduction set exists, the calculation behaves as before this enhancement.

Using the constraints functionality, the user can cap credit notes and invoices at zero. When the cap applies, no credit note or invoice is created for a negative result and the result is zero. The advantage here is that the payment or invoice recipient can see the netting off as documentation is being produced. (please note: Zero lines due to constraints are always displayed)

The calculation result shows in the database the amount per calculation set, sum A, sum D and the netting result, so the outcome can be traced.

The same logic applies to Agreements IN and Agreements OUT. Whether or not they refer to Standard conditions.

Amounts of deduction sets are always subtracted, regardless of their sign convention, so that the deduction reduces the result. Within any reports and invoices/statements, the amounts are shown as negatives (minus as prefix) 

Field level specification 

Label UI control

Manda-

tory 

Editable Data Type Value set Default Data sample

N/A

 N/A

 N/A

N/A 

 N/A

 N/A

 N/A

























N/A

Data validation failure response

Field label Validation/ Business reulesrules Error message(s) Data dependencies Additional information

N/A

N/A

N/A

N/A











N/A