expense account logic

This commit is contained in:
Bryce Covert
2019-04-12 20:58:11 -07:00
parent 9be0c02347
commit 53c80e13ee
2 changed files with 12 additions and 7 deletions

View File

@@ -16,14 +16,20 @@
:start (:start args 0)
:end (+ (:start args 0) (count journal-entries))}))
(defn credit-account? [account]
(= (:account/numeric-code account ) 2110))
(#{:account-type/liability
:account-type/equity
:account-type/revenue}
(:db/ident (:account/type account))))
(defn debit-account? [account]
(not (credit-account? account)))
(or (#{:account-type/asset
:account-type/dividend
:account-type/expense}
(:db/ident (:account/type account)))
(:bank-account/name account)))
(defn expense-account? [account]
(and (:account/name account)
(not (str/starts-with? (:account/name account "") "A"))))
(= :account-type/expense (:db/ident (:account/type account))))
(defn get-balance-sheet [context args value]
@@ -31,8 +37,6 @@
[results] (l/get-graphql {:client-id (:client_id args)
:date-before (coerce/to-date (:date args))
:count Integer/MAX_VALUE})
_ (println results)
accounts (->> results
(mapcat :journal-entry/line-items)
(group-by :journal-entry-line/account)