Excerpt from the class model for invoices, description of the calculation of invoice totals
Product line
Standard
|Expert
Operating mode
CLOUD ABO
|ON-PREMISES
Modules
Services & CRM
Budget & Phases
Purchases
Resource Planning
Business Intelligence
An invoice has 3 lists of totals: Total Benefits, Total Expenses, Total Expenses. These are all derived ObjectLists. Behind them are the persistent lists xTotal Benefits, xTotal Expenses, xTotal Expenses.
Calling one of the derived object lists recalculates the total for an open invoice. For a settled invoice, the contents of the persistent x-list are used.
The totals are created on the basis of the services, expenses and outlays on the invoice. The following description deals with the calculation of the total services, the case for expenses and outlays is analogous.
All services of the invoice, as well as any flat-rate phases on the invoice, are reviewed.
For each service, the grouping properties for calculation totals are compiled and a corresponding total is requested. In this context, requested means that an already existing total (already created due to a service further up in the list) is searched. If none is found, a new one is created.
The grouping properties are as follows:
The following values of each service are added to the total:
If the sum of the services on a flat-rate phase is 0 (e.g. no services on the phase), then a separate total is requested for the flat-rate phase with the following grouping properties:
The plannedValueExt of the phase counts as ValueExt, the sum of the minutesInt on the services of the phases counts as MinutesInt, and the plannedCostPerformance is used as ValueCost.
If an invoice is lump sum, with a fixed amount <> 0, but the sum of its services is 0, then a service total is requested for the invoice with the following grouping properties:
As ValueExt, the fixed amount of the invoice is used as MinutesInt, the sum of MinutesInt on services of the invoice is used.
Value Cost is not used.
If an invoice has a discount on it and the ServiceVertExt of the invoice is <> 0, then the discount amount is distributed proportionally to all service totals, rounded according to the rounding rule of the currency. The value text minus the discount is saved in the separate attributes ValueTextDiscount and VATAmountDiscount of the total. The use of the separate attributes is necessary due to backward compatibility.
There are rounding differences due to the rounding of the discount portions, which are then added to the invoice total with the highest service value.
There is also the special case where an invoice has no service value but a discount. We also deal with this. In this case, a total is requested as in the case of a fixed-price invoice and only ValueExtDiscount and VATAmountDiscount are set there.
To ensure that discounts are always taken into account correctly, ValueExtDiscount and VATAmountDiscount should always be used for service totals.
Treatment of expenses and outlays is analogous, except that no minute values are added and no discounts are taken into account.
For expenses and outlays, rounding differences may occur in the VAT amounts (if the “Round expenses and outlays” system setting is turned off), and these are also added to the total with the highest value.