I use a little shell script to add my fortnightly salary payment to ledger 
with the aid of 'ledger xact' (requires that your system has the gnu 
version of the date command).   It will figure out the last time it was run 
and generate enough transactions to get up to date.

TODAY=$(date '+%s')
LAST_PAY=$(ledger --sort=d csv Salary | tail -1 | cut -d, -f1 | tr -d '"')
NEXT_PAY=$(date -d "$LAST_PAY + 2 weeks" +'%Y/%m/%d' )

while [  $( date -d "$NEXT_PAY" '+%s')  -le $TODAY  ]
do
  #echo Next payday $(date -d $NEXT_PAY '+%d/%m/%Y')
  ledger xact $NEXT_PAY "Salary" >>$LEDGER_FILE
  echo >>$LEDGER_FILE
  NEXT_PAY=$(date -d "$NEXT_PAY + 2 weeks" +'%Y/%m/%d' )
done


-Ra




On Wednesday, 9 July 2014 05:15:47 UTC+9:30, Richard Cobbe wrote:
>
> I'm in the process of transitioning from Gnucash to Ledger (as keeping 
> Gnucash working consistently on MacOS is challenging, despite the best 
> efforts of the MacPorts folks).
>
> I will miss Gnucash's support for scheduled transactions, though, if I 
> can't figure out a good way to do this in Ledger.  That is, I'd like to be 
> able to set up a transaction that automatically charges a specific amount 
> to my credit card every month on the 13th, say.  From the ledger-mode 
> manual, I see that ledger-mode at least has some support for this, but this 
> section is still a work in progress.
>
> I've played around with the feature, and I see how to make it work for 
> transactions that always occur on the same day of the month.  One question, 
> though: is there support for scheduling transactions to occur, for example, 
> every 2 weeks?  I don't see an obvious way to work that into the 
> generalized date notation [*/*/13].  I took a look at ledger-schedule.el, 
> and the definition of ledger-schedule-descriptor-regex appears to allow 
> more sophisticated specifications than that, but it's going to take me a 
> while to puzzle out exactly what's going on here.  A very superficial 
> reading of ledger-schedule-constrain-day and related functions suggests 
> that not all of the features allowed in the regex are currently supported.
>
> (Ledger 3.0.3-20140608, MacOS 10.9.4, for what it's worth.)
>
> Thanks!
>
> Richard
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to