2017-01-26 20:50:06 +03:00
|
|
|
# Rewrite account names
|
2014-11-05 08:18:13 +03:00
|
|
|
|
2014-11-11 00:38:05 +03:00
|
|
|
Here's an example of using [account aliases](manual.html#account-aliases).
|
2014-11-05 08:18:13 +03:00
|
|
|
|
|
|
|
Say a sole proprietor has a `personal.journal`:
|
2015-05-26 03:56:00 +03:00
|
|
|
```journal
|
|
|
|
2014/1/2
|
|
|
|
expenses:food $1
|
|
|
|
assets:cash
|
|
|
|
```
|
2014-11-05 08:18:13 +03:00
|
|
|
|
|
|
|
and a `business.journal`:
|
2015-05-26 03:56:00 +03:00
|
|
|
```journal
|
|
|
|
2014/1/1
|
|
|
|
expenses:office supplies $1
|
|
|
|
assets:business checking
|
|
|
|
```
|
2014-11-05 08:18:13 +03:00
|
|
|
|
|
|
|
So each entity (the business owner, and the business) has their own file with its own simple chart of accounts.
|
|
|
|
However, at tax reporting time we need to view these as a single entity (at least in the US).
|
|
|
|
In `unified.journal`, we include both files, and rewrite the personal
|
|
|
|
account names to fit into the business chart of accounts,
|
2015-05-26 03:56:00 +03:00
|
|
|
```journal
|
|
|
|
alias expenses = equity:draw:personal
|
|
|
|
alias assets:cash = assets:personal cash
|
|
|
|
include personal.journal
|
|
|
|
end aliases
|
2014-11-05 08:18:13 +03:00
|
|
|
|
2015-05-26 03:56:00 +03:00
|
|
|
include business.journal
|
|
|
|
```
|
2014-11-05 08:18:13 +03:00
|
|
|
|
|
|
|
Now we can see the data from both files at once, and the personal account names have changed:
|
2015-05-26 03:56:00 +03:00
|
|
|
```shell
|
|
|
|
$ hledger -f unified.journal print
|
|
|
|
2014/01/01 # from business.journal - no aliases applied
|
|
|
|
expenses:office supplies $1
|
|
|
|
assets:business checking $-1
|
2014-11-05 08:18:13 +03:00
|
|
|
|
2015-05-26 03:56:00 +03:00
|
|
|
2014/01/02 # from personal.journal
|
|
|
|
equity:draw:personal:food $1 # <- was expenses:food
|
|
|
|
assets:personal cash $-1 # <- was assets:cash
|
|
|
|
```
|
2014-11-05 08:18:13 +03:00
|
|
|
|
|
|
|
You can also specify aliases on the command line. This could be useful to
|
|
|
|
quickly rewrite account names when sharing a report with someone else, such as
|
|
|
|
your accountant:
|
2015-05-26 03:56:00 +03:00
|
|
|
```shell
|
|
|
|
$ hledger --alias 'my earning=income:business' ...
|
|
|
|
```
|
2016-03-09 18:17:02 +03:00
|
|
|
|
|
|
|
See also [How to use another account separator character](how-to-use-another-account-separator-character.html).
|