Currency revaluation algorithm
This topic describes the currency revaluation algorithm of accounts have balances in a currency other than the base currency when the revalution is performed using accounting operations.
Input data
- an accounting Operation document
- a list of Accounts - it is derived from the accounts indicated in the lines of the accounting template set up for the Operation document, where "Amount Column Name" == "Debit Exchange Difference" OR "Credit Exchange Difference"
- Date of revaluation - it is derived from the Document Date of Operation
- Currency directory - it is derived from the Currency Directory set in Operation
- Accounting vouchers
The algorithm action:
Get all currencies included in the Currency directory
Calculate Balance и BalanceBase for the Date of revaluation for each Account, Currency, Item Key, CostCenter, ProfitCenter and ReferencedDocument.
1.1. If CurrencyValuationMethod != Balance_Reference_Document.
Then data is grouped by Account, Currency, Item Key, CostCenter, ProfutCenter. (ReferencedDocument = NULL).
1.2. If CurrencyValuationMethod = Balance_Reference_Document
Then data is grouped by Account, Currency, Item Key, CostCenter, ProfutCenter and ReferencedDocument.
Calculate the Amount in base currency of the Exchange difference for each group
Amount = RoundAmount(BaseCurrency, Balance * CurrencyDirectoryLine.RateMultiplier / CurrencyDirectoryLine.RateDivisor) - BalanceBase)
NOTE: If (templateline.AmountColumnName == Debit_Exchange_Differenc && Amount > 0) OR (templateline.AmountColum_Name == Credit_Exchange_Difference && Amount < 0), then it is considered that Amount = 0
- Create an Accounting voucher with the calculated base currency amounts of the differences for each group.
Amount (Currency, Account, ItemKey, CostCenter, ProfitCenterI, ReferencedDocument)