diff --git a/src/clj/auto_ap/datomic/migrate/add_new_vendors.clj b/src/clj/auto_ap/datomic/migrate/add_new_vendors.clj index 0379dd4c..70c6bdaa 100644 --- a/src/clj/auto_ap/datomic/migrate/add_new_vendors.clj +++ b/src/clj/auto_ap/datomic/migrate/add_new_vendors.clj @@ -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] diff --git a/src/clj/auto_ap/graphql/ledger.clj b/src/clj/auto_ap/graphql/ledger.clj index 660fd64a..59662e64 100644 --- a/src/clj/auto_ap/graphql/ledger.clj +++ b/src/clj/auto_ap/graphql/ledger.clj @@ -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)