Changed the reconciling feature so that it doesn't need to ask for the
"number of days".
This commit is contained in:
parent
76968b844c
commit
e4b5af061e
1 changed files with 8 additions and 10 deletions
18
ledger.el
18
ledger.el
|
|
@ -207,13 +207,12 @@ Return the difference in the format of a time value."
|
||||||
(define-key map [(control ?c) (control ?p)] 'ledger-print-result)
|
(define-key map [(control ?c) (control ?p)] 'ledger-print-result)
|
||||||
(define-key map [(control ?c) (control ?r)] 'ledger-reconcile)))
|
(define-key map [(control ?c) (control ?r)] 'ledger-reconcile)))
|
||||||
|
|
||||||
(defun ledger-parse-entries (account &optional all-p after-date)
|
(defun ledger-parse-entries (account &optional all-p)
|
||||||
(let (total entries)
|
(let (total entries)
|
||||||
(ledger-iterate-entries
|
(ledger-iterate-entries
|
||||||
(function
|
(function
|
||||||
(lambda (start date mark desc)
|
(lambda (start date mark desc)
|
||||||
(when (and (or all-p (not mark))
|
(when (or all-p (not mark))
|
||||||
(ledger-time-less-p after-date date))
|
|
||||||
(forward-line)
|
(forward-line)
|
||||||
(setq total 0.0)
|
(setq total 0.0)
|
||||||
(while (looking-at
|
(while (looking-at
|
||||||
|
|
@ -231,7 +230,8 @@ Return the difference in the format of a time value."
|
||||||
(setq entries
|
(setq entries
|
||||||
(cons (list (copy-marker start)
|
(cons (list (copy-marker start)
|
||||||
mark date desc (or amt total))
|
mark date desc (or amt total))
|
||||||
entries))))
|
entries)
|
||||||
|
all-p t)))
|
||||||
(forward-line))))))
|
(forward-line))))))
|
||||||
entries))
|
entries))
|
||||||
|
|
||||||
|
|
@ -289,13 +289,11 @@ Return the difference in the format of a time value."
|
||||||
(forward-line)
|
(forward-line)
|
||||||
(ledger-update-balance-display)))
|
(ledger-update-balance-display)))
|
||||||
|
|
||||||
(defun ledger-reconcile (account &optional days)
|
(defun ledger-reconcile (account)
|
||||||
(interactive "sAccount to reconcile: \nnBack how far (default 30 days): ")
|
(interactive "sAccount to reconcile: ")
|
||||||
(let* ((then (ledger-time-subtract
|
(let* ((items (save-excursion
|
||||||
(current-time) (seconds-to-time (* (or days 30) 24 60 60))))
|
|
||||||
(items (save-excursion
|
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(ledger-parse-entries account t then)))
|
(ledger-parse-entries account)))
|
||||||
(buf (current-buffer)))
|
(buf (current-buffer)))
|
||||||
(with-current-buffer
|
(with-current-buffer
|
||||||
(pop-to-buffer (generate-new-buffer "*Reconcile*"))
|
(pop-to-buffer (generate-new-buffer "*Reconcile*"))
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue