|
@@ -136,17 +136,17 @@
|
|
|
(pta-ledger:make-posting
|
|
(pta-ledger:make-posting
|
|
|
:account account2
|
|
:account account2
|
|
|
:amount (pta-ledger:make-amount
|
|
:amount (pta-ledger:make-amount
|
|
|
- :quantity (* bill-amount -1)
|
|
|
|
|
- :commodity bill-currency)
|
|
|
|
|
|
|
+ :quantity (* amount -1)
|
|
|
|
|
+ :commodity currency)
|
|
|
:total-price (unless (equal currency bill-currency)
|
|
:total-price (unless (equal currency bill-currency)
|
|
|
(pta-ledger:make-amount
|
|
(pta-ledger:make-amount
|
|
|
- :quantity (* amount -1)
|
|
|
|
|
- :commodity currency)))
|
|
|
|
|
|
|
+ :quantity (* bill-amount -1)
|
|
|
|
|
+ :commodity bill-currency)))
|
|
|
(pta-ledger:make-posting
|
|
(pta-ledger:make-posting
|
|
|
:account account1
|
|
:account account1
|
|
|
:amount (pta-ledger:make-amount
|
|
:amount (pta-ledger:make-amount
|
|
|
- :quantity amount
|
|
|
|
|
- :commodity currency))))))
|
|
|
|
|
|
|
+ :quantity bill-amount
|
|
|
|
|
+ :commodity bill-currency))))))
|
|
|
|
|
|
|
|
(defun account->balance (account)
|
|
(defun account->balance (account)
|
|
|
(let ((left-debt (agets account "leftDebt")))
|
|
(let ((left-debt (agets account "leftDebt")))
|
|
@@ -204,7 +204,11 @@
|
|
|
(dolist (entry changes)
|
|
(dolist (entry changes)
|
|
|
(funcall new-chat-entry chat-id (pta-ledger:clone-entry entry))))
|
|
(funcall new-chat-entry chat-id (pta-ledger:clone-entry entry))))
|
|
|
(bot-send-message chat-id (format-entries changes) :parse-mode "markdown"))))
|
|
(bot-send-message chat-id (format-entries changes) :parse-mode "markdown"))))
|
|
|
- (setf (gethash chat-id *last-entries*) new)))))
|
|
|
|
|
|
|
+ (let ((merged (remove-duplicates
|
|
|
|
|
+ (merge 'list old new #'< :key #'pta-ledger:entry-date)
|
|
|
|
|
+ :test 'equalp)))
|
|
|
|
|
+ (setf (gethash chat-id *last-entries*)
|
|
|
|
|
+ (subseq merged (max 0 (- (length merged) 40)))))))))
|
|
|
|
|
|
|
|
(def-message-cmd-handler handler-raif (:raif)
|
|
(def-message-cmd-handler handler-raif (:raif)
|
|
|
(let ((arg (car args)))
|
|
(let ((arg (car args)))
|