hledger icon indicating copy to clipboard operation
hledger copied to clipboard

entry macros - minimal shorthand entries auto-expanded into full journal entries

Open simonmichael opened this issue 10 years ago • 3 comments

I want "entry macros".. where you write just the minimum required info and it gets expanded to a full journal entry at report time, or optionally at data entry time (when using hledger add or an editor mode). Eg a one-line entry like:

2015/5/19 groceries  $10

(like a transaction with no postings) gets expanded to:

2015/5/19 groceries
  expenses:food:groceries  $10
  assets:bank:checking

using a template defined earlier:

entry groceries  AMT
  expenses:food:groceries  AMT
  assets:bank:checking

or even just the most recent journal entry with a matching description (like hledger add).

There could also be a flag to warn/fail if any kinds of journal entry other than the predefined ones are seen.

simonmichael avatar May 19 '15 20:05 simonmichael

I just started using hledger but had a very similar idea.

What if we could setup transaction aliases. Say you have a re occurring bill or your paycheck, and to enter it you can just type in a single alias name.

This is very similar to this abstraction, but allows an additional layer to automatically set the amount.

hackeryarn avatar Sep 25 '15 01:09 hackeryarn

I'd like to see macros, but often have more than 2 postings, often with a calculated tax component.

2015-04-17  new hard disk
    expenses:equipment            $    159.00
    assets:bank                   $   -159.00
    expenses:tax                  $    -14.45
    liabilities:tax               $     14.45

I guess the macro could look something like:

entry  equipment AMT
    expenses:equipment            $    AMT
    assets:bank                   $   -AMT
    expenses:tax                  $   -AMT/11
    liabilities:tax               $    AMT/11

It would presumably be a fair bit of implementation work to support arithmetic in the macros.

timbod7 avatar Apr 26 '16 11:04 timbod7

Indeed. These "macros"/"templates" pop up and overlap in quite a few places:

  • shorthand journal entries
  • the add command
  • converting CSV
  • automated transactions/postings (https://github.com/simonmichael/hledger/issues/99)
  • hledger-rewrite

simonmichael avatar Apr 26 '16 13:04 simonmichael