Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
hledger: applying transaction modifier rules selectively with tags
; transaction modifier (auto postings) rule
; Txns after 2019/1/1 with a (unbalanced) revenues posting,
; and which don't have the modified: tag, like this:
;
;2019/2/1 (cwYYYYMM) client cw | payment
; (JS:revenues:cw) $-1000
;
; will have some standard postings added. This can be used for forecasting.
;
= date:2019- JS:revenues:cw not:tag:modified
JS:assets:receivable:cw:consulting *1 ; consulting pre/payment received
JS:assets:receivable:cw:reimbursement $-200 ; expenses pre/payment received
JS:assets:bank:wf:bchecking ;
;
; estimate and save tax (2nd txn)
(JS:liabilities:tax:federal:2019) *0.28 ; revenue * 28%
(JS:liabilities:tax:state:2019) *0.04 ; revenue * 4%
JS:assets:bank:wf:bchecking *0.32 ; federal + state
JS:assets:bank:wf:bsavings:tax:2019 *-0.32
; If you also save the modified txn in the journal, then add the
; modified: tag so it won't be modified a second time, like this:
;
;2019/02/01 (cwYYYYMM) client cw | payment
; ; modified: <- add this to disable rules
; (JS:revenues:cw) $-1000
; JS:assets:receivable:cw:consulting $-1000 ; consulting pre/payment received
; JS:assets:receivable:cw:reimbursement $-200 ; expenses pre/payment received
; JS:assets:bank:wf:bchecking
; ;
; ; estimate and save tax (2nd txn)
; (JS:liabilities:tax:federal:2019) $-280 ; revenue * 28%
; (JS:liabilities:tax:state:2019) $-40 ; revenue * 4%
; JS:assets:bank:wf:bchecking $-320 ; federal + state
; JS:assets:bank:wf:bsavings:tax:2019 $320
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.