Archiving Previous Years

83 views
Skip to first unread message

Joel

unread,
May 9, 2020, 5:26:02 PM5/9/20
to Ledger
Hello,

In section 4.9 of the Ledger docs it explains how to archive previous years, conveniently generating an opening balances transaction for the new year.

Is there a way to do this that carries cost basis forward for transactions with commodities or currencies where one wants to track the cost basis? Or must I manually run a report with the lot information and then add that to the opening balances statement?

Thanks,

Joel

John Wiegley

unread,
May 10, 2020, 2:49:45 AM5/10/20
to Joel, Ledger
>>>>> "J" == Joel <jke...@gmail.com> writes:

J> Is there a way to do this that carries cost basis forward for transactions
J> with commodities or currencies where one wants to track the cost basis? Or
J> must I manually run a report with the lot information and then add that to
J> the opening balances statement?

Try using the `--lots` option when generating the equity report. Cost basis is
tracked as the lot price. It is likely to also generate a lot more
transactions, one for each distinct lot.

John

fast...@gmail.com

unread,
Apr 19, 2022, 2:31:15 PM4/19/22
to Ledger
Hello, resurrecting this thread because I think I'm facing a similar issue and found this thread when searching.
I use commodities to track inventory of building supplies. So far it's worked ok, though I've had several hiccups to overcome.
The latest is in closing the books for the previous year. I want to retain the inventory across the transition. My problem is that out of the equity command comes a posting for each commodity I have. Previously, I had managed to suppress this except when desired, but in the new year I have all hundred-plus  commodities as postings in the Opening Balance transaction.

I  must admit I've gotten my system to work more through trial and error than through a deep understanding of commodities in Ledger. What worked for me up till now was:

* using x COMMODITY @ UNIT-PRICE.
* always appending `--market` to my ledger command, except when I specifically want to see my materials inventory
* always explicitly including the Euro equivalent in the opposite posting. For example, when I 'use' 100 screws, if I don't put the Euro equivalent in the target account posting, I get screws back as a unit from then on.

I tried the `--lots` option as mentioned above. However, this doesn't seem to have any effect.
I'm at a bit of a loss here. It might help to compare an example transaction as it brought in some of these commodities originally:

```
2021-06-01 * Purchase supplies
    Assets:Bank        -€ 550
    Assets:Inventory    5000 "screws4x40_pc" @ €0,01
    Assets:Inventory    100 "DougFir2x4_m1" @€5,00
```
But `equity` at the end of the year produces:

```
2021-12-31 * Opening Balances
    Assets:Inventory           5000 "Screws4x40_pc"
    Assets:Inventory           100 "DougFir2x4_m1"
    Equity:Opening Balances    5000 "Screws4x40_pc"
    Equity:Opening Balances    100 "DougFir2x4_m1"
```

Using `--lots` adds the `{€0,01}` syntax.
I don't understand whether the different syntax (@ vs {}) is causing this, or something else.
I'm currently in the process of trying to remove all those commodities from Opening Balances and replace them with a single posting in Euros, but I'm afraid I can't post my results yet here because I'm being blocked by parsing errors which I don't understand yet. Also, this approach seems like too much work to do every year even if it will work in the end.

So I'm wondering if there's some way to tease out an Opening Balance statement that will let me keep seeing Euros in reports in the new year? Or, if someone can explain where I'm misunderstanding the use of commodities that's causing my troubles?

Thanks,
Hans
Reply all
Reply to author
Forward
0 new messages