Excerpt from the class model for invoices and description of the calculation of invoice totals
Operating mode
Cloud Suite
|ON-PREMISES
Modules
Services & CRM
Budget & Phases
Purchases
Resource Planning
Business Intelligence
An invoice has three lists of totals: totaleLeistungen, totaleSpesen and totaleAuslagen. These members are all derived ObjectLists. Behind them are the persistent lists xTotaleLeistungen, xTotaleSpesen and xTotaleAuslagen.
If you call up one of the derived Objectlists of an open invoice, the total is recalculated. On charged invoices, the content of the persistent x list is used.
The totals are created based on the services, expenses and outlays on the invoice. The following description refers to the calculation of the total services. However, the case is the same for expenses and outlays.
All the services on the invoice and any fixed-price 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 for. 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 total of the services on a fixed-price phase is 0 (e.g. no services on the phase), a separate total for the phase is requested, with the following grouping properties:
The PlanFeeServicesExt of the phase counts as FeeExt, the total of the MinutesInt on the services of the phase counts as MinutesInt, and the PlanCostServices is used as Costs.
If an invoice is a fixed price, with a fixed amount <> 0, but the total of its services is 0, then a service total is requested for the invoice with the following grouping properties:
As FeeExt, the fixed price of the invoice is used; as MinutesInt, the sum of MinutesInt on services of the invoice is used.
FeeCost is not used.
If an invoice has a discount on it and the TotalFeeServicesExt 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 FeeExt minus the discount is saved in the separate attributes FeeExtDiscount and VATAmountDiscount of the total. Separate attributes are necessary due to backwards 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. A total is requested, like with a fixed-price invoice, and only FeeExtDiscount and VATAmountDiscount are set there.
To ensure that discounts are always considered correctly, you should always use FeeExtDiscount and VATAmountDiscount for service totals.
Expenses and outlays are handled in the same way, except that no minute values are added and no discounts are considered.
For expenses and outlays, rounding differences may occur in the VAT amounts (if the system setting “Round expenses and outlays” is deactivated), and these are also added to the total with the highest value.