Bug 878 Cannot reconcile two posting with the same account in one xact
This commit is contained in:
parent
fa1702d684
commit
d243f00b91
1 changed files with 13 additions and 14 deletions
|
|
@ -190,8 +190,7 @@
|
||||||
(if ledger-fold-on-reconcile
|
(if ledger-fold-on-reconcile
|
||||||
(ledger-occur-quit-buffer buf))))
|
(ledger-occur-quit-buffer buf))))
|
||||||
|
|
||||||
|
(defun ledger-marker-where-xact-is (emacs-xact posting)
|
||||||
(defun ledger-marker-where-xact-is (emacs-xact)
|
|
||||||
"find the position of the xact in the ledger-buf buffer using
|
"find the position of the xact in the ledger-buf buffer using
|
||||||
the emacs output from ledger, return the buffer and a marker
|
the emacs output from ledger, return the buffer and a marker
|
||||||
to the beginning of the xact in that buffer"
|
to the beginning of the xact in that buffer"
|
||||||
|
|
@ -204,15 +203,15 @@
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(if ledger-clear-whole-entries
|
(if ledger-clear-whole-entries
|
||||||
(goto-line (nth 1 emacs-xact))
|
(goto-line (nth 1 emacs-xact))
|
||||||
(goto-line (nth 0 (nth 5 emacs-xact))))
|
(goto-line (nth 0 posting)))
|
||||||
(point-marker))))))
|
(1+ (point-marker))))))) ;Add 1 to make sure the marker is within the transaction
|
||||||
|
|
||||||
(defun ledger-do-reconcile ()
|
(defun ledger-do-reconcile ()
|
||||||
"get the uncleared transactions in the account and display them
|
"get the uncleared transactions in the account and display them
|
||||||
in the *Reconcile* buffer"
|
in the *Reconcile* buffer"
|
||||||
(let* ((buf ledger-buf)
|
(let* ((buf ledger-buf)
|
||||||
(account ledger-acct)
|
(account ledger-acct)
|
||||||
(items
|
(xacts
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
(ledger-exec-ledger buf (current-buffer)
|
(ledger-exec-ledger buf (current-buffer)
|
||||||
"--uncleared" "--real" "emacs" account)
|
"--uncleared" "--real" "emacs" account)
|
||||||
|
|
@ -221,20 +220,20 @@
|
||||||
(unless (looking-at "(")
|
(unless (looking-at "(")
|
||||||
(error (buffer-string)))
|
(error (buffer-string)))
|
||||||
(read (current-buffer))))))
|
(read (current-buffer))))))
|
||||||
(if (> (length items) 0)
|
(if (> (length xacts) 0)
|
||||||
(progn
|
(progn
|
||||||
(dolist (item items)
|
(dolist (xact xacts)
|
||||||
(let ((index 1))
|
(let ((index 1))
|
||||||
(dolist (xact (nthcdr 5 item))
|
(dolist (posting (nthcdr 5 xact))
|
||||||
(let ((beg (point))
|
(let ((beg (point))
|
||||||
(where (ledger-marker-where-xact-is item)))
|
(where (ledger-marker-where-xact-is xact posting)))
|
||||||
(insert (format "%s %-4s %-30s %-30s %15s\n"
|
(insert (format "%s %-4s %-30s %-30s %15s\n"
|
||||||
(format-time-string "%Y/%m/%d" (nth 2 item))
|
(format-time-string "%Y/%m/%d" (nth 2 xact))
|
||||||
(if (nth 3 item)
|
(if (nth 3 xact)
|
||||||
(nth 3 item)
|
(nth 3 xact)
|
||||||
"")
|
"")
|
||||||
(nth 4 item) (nth 1 xact) (nth 2 xact)))
|
(nth 4 xact) (nth 1 posting) (nth 2 posting)))
|
||||||
(if (nth 3 xact)
|
(if (nth 3 posting)
|
||||||
(set-text-properties beg (1- (point))
|
(set-text-properties beg (1- (point))
|
||||||
(list 'face 'ledger-font-reconciler-cleared-face
|
(list 'face 'ledger-font-reconciler-cleared-face
|
||||||
'where where))
|
'where where))
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue