This commit is contained in:
Bryce Covert
2022-10-24 23:03:35 -07:00
parent c8012555ff
commit 2f76f59f03

View File

@@ -538,7 +538,7 @@
(:alternate_description je))
:account (:account jel)
:location (:location jel)}))))))
journal-entries-by-account (group-by #(account-lookup (get-in % [:account :id])))]
journal-entries-by-account (group-by #(account-lookup (get-in % [:account :id])) all-journal-entries)]
[account journal-entries] (conj journal-entries-by-account [nil all-journal-entries])
:let [journal-entries (first (reduce
(fn [[acc last-je] je]
@@ -552,7 +552,8 @@
{:category category
:client_id client-id
:location location
:account account
:account (or account
{:name category})
:journal_entries (when account (sort-by :date journal-entries))
:total (- (or (reduce + 0.0 (map #(or (:credit %) 0.0) journal-entries)) 0.0)
(or (reduce + 0.0 (map #(or (:debit %) 0.0) journal-entries)) 0.0))})})