* Tobias Pfeiffer <
tgpfe...@web.de> [2016-03-17 23:55]:
> - The entries are in correct date order within each file, but when I
> combine them (either using multiple `-f` parameters or one file with
> `include` directive) then they are not, so without extra sorting
> parameters, `ledger reg` gives an unordered output. Also, balance
> assertions for transactions from one of those account to another
> account do not work if the transaction is not in the correct
> position. Therefore I considered to write a script that merges these
> files in the correct date order into some big "all.ledger" file.
I use something similar at the moment instead of include directives
because the latter doesn't show line numbers of the included files
properly when there are errors.
I do something like:
cat bank/2016/*.ledger | ledger -f - --sort d print > 2016
> - For future updates, of course I want to use the exact same scripts,
> rather than adding transactions by hand. In fact, since I add my cash
> expenses to a mobile app right away and can import into ledger from
> there, it should hardly be necessary to add transactions manually.
> That means that every month or so (whenever a new account statement
> arrives), I would re-run my scripts and then merge them with
> all.ledger. However, I would have to deal with transactions that
> appear in *two* account statements (like, when sending money from my
> savings account to PayPal).
I'm not sure I understand the part about adding transactions manually
(I maintain a separate .ledger file with cash expenses that is merged
into my final ledger file.)
But regarding transactions in different accounts (e.g. paying your
credit card bill with your bank account): I use an Assets:Transfer
account, as someone suggested on this list a few years ago. (I can
look for a link if you want, but the basic idea is: one transaction
does: Assets:Bank -> Assets:Transfer; and the other Assets:Transfer ->
Liabilities:Credit Card).
The other solution would be use to an UUID tag; if two transactions
have the same UUID, ledger will ignore one.
> - Often it will become necessary to edit transactions by hand, for
> example, change the clearing state, add or remove tags or edit the
> payee. I wonder in which files to do this and if it will work
> correctly with merging.
I only add *new* transactions to my ledger files with my import scripts.
This way, I can modify old entries without any problems.
--
Martin Michlmayr
http://www.cyrius.com/