On Wed, Apr 28, 2010 at 7:23 PM, John Wiegley <[email protected]> wrote:
> In Ledger, currencies can co-exist in the same account, so all you need is 
> this:
>
> D 1,000.00 AUD
> D 1,000.00 EUR
>
> 2009/01/01 First sale
>       Assets:Bank                              10000.00 AUD
>       Income:Sales
>
> 2009/02/01 Marketing (1 EUR = 2.00 AUD)
>       Expenses:Marketing                        2000.00 AUD
>       Liabilities:Accounts Payable:EUR         -1000.00 EUR
>
> 2009/03/01 Pay Marketing Invoice (1 EUR = 1.95 AUD)
>       Liabilities:Accounts Payable:EUR          1000.00 EUR
>       Assets:Bank                              -1950.00 AUD
>
> Ledger will compute the exchange rates for you, and both balances and -X AUD 
> should produce what you expect.
>
With the above the balance sheet and income and expense report don't
match.  The balance sheet should change by the amount of profit earnt.

$ ledger -f invoice2.dat -X AUD  bal assets
        8,050.00 AUD  Assets:Bank

$ ledger -f invoice2.dat -X AUD  bal income expenses
        2,000.00 AUD  Expenses:Marketing
      -10,000.00 AUD  Income:Sales
--------------------
       -8,000.00 AUD

As you can see according to our balance sheet we went from $0 to $8050
dollars in assets despite earning only only $8,000 dollars according
to the income and expenses report.

Now if we use the original data file our balance sheet matches our
income and expenses because we've made $50 due to currency
fluctuations.

$ ledger -f invoice.dat -X AUD  bal assets liabilities
        8,050.00 AUD  Assets:Bank


$ ledger -f invoice.dat -X AUD  bal income expenses currency
          -50.00 AUD  Currency:AUD
        2,000.00 AUD  Expenses:Marketing
      -10,000.00 AUD  Income:Sales
--------------------
       -8,050.00 AUD

So now the two reports match up.

Also if we use a date before we've paid the bill then it still matches
up, but in this case the currency gain of $100 (since the exchange
rate dropped to $1.90) except in this case the gain is unrealized.

$ ledger -f invoice.dat -X AUD  -e 2009/02/15 bal assets liabilities
       10,000.00 AUD  Assets:Bank
       -1,900.00 AUD  Liabilities:Accounts Payable:EUR
--------------------
        8,100.00 AUD

$ ledger -f invoice.dat -X AUD  -e 2009/02/15 bal income expenses currency
         -100.00 AUD  Currency
       -2,000.00 AUD    AUD
        1,900.00 AUD    EUR
        2,000.00 AUD  Expenses:Marketing
      -10,000.00 AUD  Income:Sales
--------------------
       -8,100.00 AUD

Does this better explain what I'm trying to do?

Pete

Reply via email to