Currencies
SimpleOne offers several tools to manage currencies:
- the Currency (currency) table, which contains currency records;
- the Currency Exchange Rate (currency_exchange_rate) table, which contains the exchange rates of the currencies marked as active.
In the currency.default system property you can specify the default currency for working with the budgets, demands, and purchases.
Currency table
The Currency (currency) table contains records of currency names that you can use when planning a budget and working with demands and purchases.
Role required: admin. Users with other roles can only view the records.
No one can delete currency records. You can only deactivate irrelevant records by clearing the Active checkbox on the Currency form.
Create a currency record
To create a new currency record, follow these steps:
- Navigate to the Organization → Currencies.
- Click New and fill in the fields.
- Click Save or Save and exit to apply the changes.
Currency form fields
| Field | Mandatory | Description |
|---|---|---|
| Code | Y | Specify the currency code or select it from the list. The out-of-the-box solution contains: RUB, USD, EUR, CNY, BYN, KZT. |
| Name | Y | Enter the currency name. |
| Symbol | Y | Add a currency symbol. |
| Active | Y | Select the checkbox to activate the currency record. |
Currency related lists
- Exchange Rate History – contains the exchange rates for this currency within the specified period from the Currency Exchange Rate (currency_exchange_rate) table.
Master data
The records required for the correct performance of the application are automatically added to the Currencies table when an instance is deployed. The following is the list of records included in the master data:
| Code | Symbol | Name (Russian) | Name (English) | Active |
|---|---|---|---|---|
| BYN | BYN | Белорусский рубль | Belarusian ruble | No |
| CNY | ¥ | Китайский юань | Chinese yuan | Yes |
| EUR | € | Евро | Euro | Yes |
| KZT | ₸ | Казахстанский тенге | Kazakhstani tenge | No |
| RUB | ₽ | Российский рубль | Russian ruble | Yes |
| USD | $ | Доллар США | US dollar | Yes |
Currency Exchange Rate table
The Currency Exchange Rate (currency_exchange_rate) table contains the exchange rates of the active currencies existing in the system. This information is used for converting the actual cost amount to the default currency specified in the currency.default system property.
The table is completed and updated automatically if you activate the corresponding scripts. By default, the exchange rate data is obtained from the Central Bank of Russia (CBR). You can configure another bank from which to obtain the data. You can also add exchange rate records manually.
Exchange rate scripts
Role required: admin.
Before activating the scripts, complete the following steps:
- Specify or change the default currency value in the currency.default system property.
- In the Currency (currency) table, activate the records of the currencies you need to get the exchange rates for.
- If you need to get the exchange rate data for other currencies, create the corresponding active records in the Currency (currency) table.
Regularly update the table with exchange rates for tomorrow
Activate the Currency: get exchange rates for tomorrow scheduled script to automatically update the Currency Exchange Rate (currency_exchange_rate) table with the exchange rates for tomorrow. By default, the data is updated at 23:00 MSK. The data is obtained for the active currencies of the Currency (currency) table, the quote currency, and the default currency specified in the currency.default system property.
To activate the script, complete the following steps:
- Navigate to System Scheduler → Scheduled Scripts.
- Find and open the Currency: get exchange rates for tomorrow script record.
- Select the Active checkbox.
- Click Save or Save and exit to apply the changes.
You can customize the script if needed by selecting another Run frequency and changing the Run time.
Add exchange rates for the specified period
Activate the Currency: get exchange rates for 5 years scheduled script to automatically fill the Currency Exchange Rate (currency_exchange_rate) table with the exchange rate data for the past 5 years. This period is calculated starting from the current date. The data is obtained for the active currencies of the Currency (currency) table, the quote currency, and the default currency specified in the currency.default system property.
To activate the script, complete the following steps:
- Navigate to System Scheduler → Scheduled Scripts.
- Find and open the Currency: get exchange rates for 5 years script record.
- Select the Active checkbox.
- Change the Run frequency field value to On demand.
- Click Save to apply the changes, then click Execute.
You can change the period for which to obtain the exchange rate data. In the script, change the startDate.addYears(-5); method value as needed. For example, to obtain the exchange rate data for the past year only, set the method value to -1.
Exchange rates for the Belarusian ruble with the code BYN are available starting from July 1, 2016.
Exchange rates for the Belarusian ruble with the code BYR, which was used before the redenomination on July 1, 2016, are not available.
Change the bank from which to receive the data
To retrieve exchange rates from a system other than the Bank of Russia, populate the Currency Exchange Rates (currency_exchange_rate) table by using the mechanism for obtaining rates from the Bank of Russia as an example: the two scheduled scripts described above and the CurrencyExchangeRatesDataFetcherFromRussianCB script include.
We recommend using the same output data types as those implemented in CurrencyExchangeRatesDataFetcherFromRussianCB. In this case, you can create and update records in the Currency Exchange Rates (currency_exchange_rate) table by using the SimpleCurrencyService script include.
Create an exchange rate
To add an exchange rate for a specific date, complete the following steps:
- Open the Currency Exchange Rate table located at the address {Your instance URL}/list/currency_exchange_rate.
- Click New and fill in the form fields.
- Click Save or Save and exit to apply the changes.
Currency Exchange Rate form fields
| Field | Mandatory | Description |
|---|---|---|
| Name | N | Specify the exchange rate name. In the records created automatically, the Name is filled in according to the following template: Base currency quote – Date DD-MM-YYYY. |
| Date | N | Specify the date of the exchange rate. |
| Base currency | Y | Specify the currency code for which the exchange rates are obtained. |
| Rate of base to quote | N | Specify the exchange rate of the base currency to the quote currency. |
| Quote currency | Y | Specify the code of the currency in which the exchange rates are sourced. The default quote currency is RUB. |
When adding exchange rates manually, if the quote currency differs from the default currency, create an exchange rate record with the following values:
- in the Base currency field – the default currency;
- in the Rate of base to quote field – the corresponding rate;
- in the Date field – the date that is less than or equal to the Date in the previously created exchange rate record for the quote currency (where the Rate of base to quote equals 1).