Last active
May 7, 2016 21:19
-
-
Save simonmichael/1345b5b95992bdafc21d to your computer and use it in GitHub Desktop.
"semi-automated transactions" - adding postings with hledger-rewrite (https://github.com/simonmichael/hledger/blob/master/extra/hledger-rewrite.hs)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git clone http://code.hledger.org hledger | |
$ cd hledger | |
$ stack build hledger | |
$ stack ghc extra/hledger-rewrite.hs | |
$ mv extra/hledger-rewrite ~/.local/bin | |
$ cd .. | |
$ hledger-rewrite --help | |
hledger-rewrite [OPTIONS] [PATTERNS] --add-posting "ACCT AMTEXPR" ... | |
print all journal entries, with custom postings added to the matched ones | |
Flags: | |
--add-posting='ACCT AMTEXPR' add a posting to ACCT, which may be | |
parenthesised. AMTEXPR is either a literal | |
amount, or *N which means the transaction's | |
first matched amount multiplied by N (a | |
decimal number). Two spaces separate ACCT | |
and AMTEXPR. | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2016/3/2 payment received | |
revenues:business $-1000 | |
assets:business:bank:wf:bchecking:available |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ hledger-rewrite -f t.j revenues \ | |
--add-posting '(assets:business:accounts receivable:client1) *-1' \ ; a. decrease receivable by revenues amount | |
--add-posting '(liabilities:personal:tax:federal:2016) *.25' \ ; b. increase taxes owed, by 25% | |
--add-posting '(liabilities:personal:tax:state:2016) *.02' \ ; and 2% of revenues amount | |
--add-posting 'assets:business:bank:wf:bchecking:year:tax:2016 *-.27' \ ; c. save that amount to the | |
--add-posting 'assets:business:bank:wf:bchecking:available *.27' ; tax envelope |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2016/03/02 payment received | |
revenues:business $-1000 | |
assets:business:bank:wf:bchecking:available $1000 | |
(assets:business:accounts receivable:clearview) $1000 | |
(liabilities:personal:tax:federal:2016) $-250 | |
(liabilities:personal:tax:state:2016) $-20 | |
assets:business:bank:wf:bchecking:year:tax:2016 $270 | |
assets:business:bank:wf:bchecking:available $-270 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select transaction(s), C-u M-S-| hledger-rewrite -f- ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment