Hi,

I may incur expenses in multiple currencies using cash in those countries.
What I'd like is to just display the expenses in one currency (USD), but
the cash balances to always display in whatever currencies they hold.

Here's what I have:
account Assets:Dollars
account Assets:Yen
account Expenses
commodity JPY
commodity USD

P 2022-01-01 00:00:00 USD 100 JPY

2022-01-02 US Merchant
  Assets:Dollars             -11.00 USD
  Expenses                    11.00 USD

2022-01-03 JP Merchant
  Assets:Yen                 -2000 JPY
  Expenses                    2000 JPY ; 20.00 USD

P 2022-02-01 00:00:00 USD 125 JPY

2022-02-02 US Merchant
  Assets:Dollars             -22.00 USD
  Expenses                    22.00 USD

2022-02-03 JP Merchant
  Assets:Yen                 -3750 JPY
  Expenses                    3750 JPY ; 30.00 USD

I can get the expenses in USD as expected:
$ ledger -f temp.ledger bal --init-file /dev/null -H -X USD
          -83.00 USD  Assets
          -33.00 USD    Dollars
          -50.00 USD    Yen
           83.00 USD  Expenses
--------------------
                   0

However, I can't seem to get the Assets:Yen account to display in JPY
properly. I found this snippet from the docs:
Or, if it better suits your accounting, you can be less symbolic, which
allows you to report most everything in EUR if you use ‘-X EUR’, except for
certain accounts or postings which should always be valuated in another
currency. For example:

= /^Assets:Brokerage:CAD$/
    ; Always report the value of commodities in this account in
    ; terms of present day dollars, despite what was asked for
    ; on the command-line VALUE:: market(amount, date, ‘$’)

Sounds exactly like what I wanted. However, adding this:
= /Assets:Yen/
    ; VALUE:: market(amount, date, 'JPY')

results in complete nonsense for the Assets:Yen account:
$ ledger -f temp.ledger bal --init-file /dev/null -H -X USD
       144467.00 USD  Assets
          -33.00 USD    Dollars
       144500.00 USD    Yen
           83.00 USD  Expenses
--------------------
       144550.00 USD

What am I doing wrong?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/CACTkciMfW6g%3DKi6BzQxCi9ToVBjoFpVjF3vf4AMHumc%2BcOCDOA%40mail.gmail.com.

Reply via email to