expense account logic
This commit is contained in:
@@ -7,7 +7,8 @@
|
|||||||
(:import [org.apache.commons.io.input BOMInputStream]))
|
(:import [org.apache.commons.io.input BOMInputStream]))
|
||||||
|
|
||||||
(defn add-new-vendors [conn]
|
(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)
|
headers (map read-string header)
|
||||||
new-vendors [(reduce
|
new-vendors [(reduce
|
||||||
(fn [rows r]
|
(fn [rows r]
|
||||||
|
|||||||
@@ -16,14 +16,20 @@
|
|||||||
:start (:start args 0)
|
:start (:start args 0)
|
||||||
:end (+ (:start args 0) (count journal-entries))}))
|
:end (+ (:start args 0) (count journal-entries))}))
|
||||||
(defn credit-account? [account]
|
(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]
|
(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]
|
(defn expense-account? [account]
|
||||||
(and (:account/name account)
|
(= :account-type/expense (:db/ident (:account/type account))))
|
||||||
(not (str/starts-with? (:account/name account "") "A"))))
|
|
||||||
|
|
||||||
|
|
||||||
(defn get-balance-sheet [context args value]
|
(defn get-balance-sheet [context args value]
|
||||||
@@ -31,8 +37,6 @@
|
|||||||
[results] (l/get-graphql {:client-id (:client_id args)
|
[results] (l/get-graphql {:client-id (:client_id args)
|
||||||
:date-before (coerce/to-date (:date args))
|
:date-before (coerce/to-date (:date args))
|
||||||
:count Integer/MAX_VALUE})
|
:count Integer/MAX_VALUE})
|
||||||
_ (println results)
|
|
||||||
|
|
||||||
accounts (->> results
|
accounts (->> results
|
||||||
(mapcat :journal-entry/line-items)
|
(mapcat :journal-entry/line-items)
|
||||||
(group-by :journal-entry-line/account)
|
(group-by :journal-entry-line/account)
|
||||||
|
|||||||
Reference in New Issue
Block a user