Subject Re: [firebird-support] How to store value in different currency ?
Author Werner F. Bruhin
Hi,

On 09/04/2012 19:44, nathanelrick wrote:
>
> Hello,
>
> i want to permit user to store their objects with price in their
> preferred currency. this is not a big problem, but i also want to
> permit users to search among all the object in their currency
>
> Ex :
>
> i want all object with price > 100 USD or
> i want all object with price > 100 EUR
>
> How do you handle this ? actually i store all the value in EUR in the
> database with a field EUR2CurrencyRate ... and every week i update the
> value in EUR with the new exchange rate. it's too much intensive as i
> need to scan every week all the database to update all the value that
> was not filled in EUR
>
I have a currency table which stores the current exchange rate.

Transactions have an amount column, a currency code and a local amount
column. The local amount is calculated based on the exchange rate when
the transaction is entered.

Assuming "Euro" is your local/home currency you look for in the local
amount column, if you need USD then you look for transactions with
currency code USD and 100 in amount column.

If your system is an accounting type system you will probably need to be
more sophisticated and have things like exchange rate history and maybe
even a tool to correct invalid local amount columns etc.

Werner


[Non-text portions of this message have been removed]