expense account logic
This commit is contained in:
@@ -7,7 +7,8 @@
|
||||
(:import [org.apache.commons.io.input BOMInputStream]))
|
||||
|
||||
(defn add-new-vendors [conn]
|
||||
(let [[header & rows] (-> "vendor-list.csv" (io/resource) io/input-stream (BOMInputStream.) (io/reader) csv/read-csv)
|
||||
[[]]
|
||||
#_(let [[header & rows] (-> "vendor-list.csv" (io/resource) io/input-stream (BOMInputStream.) (io/reader) csv/read-csv)
|
||||
headers (map read-string header)
|
||||
new-vendors [(reduce
|
||||
(fn [rows r]
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user