# InvoiceCalculator

Shared decimal arithmetic for invoice XML, validation and visible presentation.

Class 

`OfficeIMO.Invoicing`

**Namespace**

`OfficeIMO.Invoicing`

**Assembly**

`OfficeIMO.Invoicing`

**Source revision**

`ba882f6b0d07` with working tree changes

**Source**

[InvoiceCalculator.cs:6](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Invoicing/Calculation/InvoiceCalculator.cs#L6)

**Modifiers**

static

Shared decimal arithmetic for invoice XML, validation and visible presentation.

## Inheritance

- object
- InvoiceCalculator

Filter members 

Show inherited

## Methods

`public static InvoiceCalculation Calculate(Invoice invoice)` [#](#method-calculate-officeimo-invoicing-invoice)

[InvoiceCalculator.cs:55](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Invoicing/Calculation/InvoiceCalculator.cs#L55)

Calculates line totals, category-level VAT and the amount due, or returns retained declared values for an aggregate-only invoice.

Parameters

**invoice OfficeIMO.Invoicing.Invoice required**

Returns

`InvoiceCalculation`

`public static decimal RoundAmount(decimal value)` [#](#method-roundamount-decimal)

[InvoiceCalculator.cs:47](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Invoicing/Calculation/InvoiceCalculator.cs#L47)

Rounds to two decimal places using XPath round semantics (ties towards positive infinity).

Parameters

**value decimal required**

Returns

`decimal`

UpdateDeclaredAmounts 2 overloads

`public static InvoiceCalculation UpdateDeclaredAmounts(Invoice invoice)` [#](#method-updatedeclaredamounts-officeimo-invoicing-invoice)

[InvoiceCalculator.cs:6](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Invoicing/Calculation/InvoiceCalculator.cs#L6)

Explicitly replaces source-declared amounts after editing prices, quantities, taxes or adjustments.

Parameters

**invoice OfficeIMO.Invoicing.Invoice required**

Returns

`InvoiceCalculation`

`public static InvoiceCalculation UpdateDeclaredAmounts(Invoice invoice, decimal? taxExchangeRate)` [#](#method-updatedeclaredamounts-officeimo-invoicing-invoice-nullable-system-decimal)

[InvoiceCalculator.cs:12](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Invoicing/Calculation/InvoiceCalculator.cs#L12)

Recalculates declared amounts. An explicit positive rate converts invoice VAT to accounting currency; without a rate, a changed VAT total invalidates its retained foreign-currency amount.

Parameters

**invoice OfficeIMO.Invoicing.Invoice required**

Invoice to update after editing.

**taxExchangeRate decimal? required**

Accounting-currency units per invoice-currency unit, chosen by the caller for the applicable tax point.

Returns

`InvoiceCalculation`

## Inherited Methods

`public virtual bool Equals(object? obj)` [#](#method-equals-object)

Inherited from object

Parameters

**obj object? required**

Returns

`bool`

`public virtual int GetHashCode()` [#](#method-gethashcode)

Inherited from object

Returns

`int`

`public Type GetType()` [#](#method-gettype)

Inherited from object

Returns

`Type`

`public virtual string? ToString()` [#](#method-tostring)

Inherited from object

Returns

`string?`

<!-- PowerForge markdown artifact sha256:2F1AD4F1FE703C1B9437052C177320581EB588C35B221F77A8D3329E0C51A986 -->
