huge number of changes to start making all usages of expense accounts dynamic.

This commit is contained in:
Bryce Covert
2019-04-12 15:39:32 -07:00
parent e64820d71a
commit b6e73f0bfb
21 changed files with 103 additions and 181 deletions

View File

@@ -19,6 +19,7 @@
{:invoice/client [:client/name :db/id :client/locations :client/code]}
{:invoice/vendor [* {:vendor/address [*]}]}
{:invoice/status [:db/ident]}
{:invoice/expense-accounts [* {:invoice-expense-account/account [*]}]}
{:invoice-payment/_invoice [* {:invoice-payment/payment [* {:payment/status [*]}
{:payment/bank-account [*]}
{:transaction/_payment [*]}]}]}]))

View File

@@ -83,6 +83,8 @@
:auto-ap/add-general-ledger-fns2 {:txes-fn 'auto-ap.datomic.migrate.add-general-ledger/add-general-ledger-fns :requires [:auto-ap/add-general-ledger6]}
:auto-ap/add-accounts {:txes auto-ap.datomic.migrate.add-general-ledger/add-accounts :requires [:auto-ap/add-general-ledger-fns2]}
:auto-ap/add-transaction-account {:txes auto-ap.datomic.migrate.add-general-ledger/add-transaction-account :requires [:auto-ap/add-general-ledger-fns2]}
:auto-ap/change-expense-account-to-entity {:txes auto-ap.datomic.migrate.add-general-ledger/change-expense-account-to-entity :requires [:auto-ap/add-transaction-account]}
:auto-ap/add-account-to-vendor {:txes auto-ap.datomic.migrate.add-general-ledger/add-account-to-vendor :requires [:auto-ap/add-transaction-account]}
#_#_:auto-ap/bulk-load-invoice-ledger2 {:txes-fn 'auto-ap.datomic.migrate.add-general-ledger/bulk-load-invoice-ledger :requires [:auto-ap/make-entity-not-unique]}
}]

View File

@@ -145,6 +145,16 @@
#_(bulk-load-invoice-ledger (d/connect auto-ap.datomic/uri))
(def change-expense-account-to-entity
[[{:db/ident :invoice-expense-account/account
:db/valueType :db.type/ref
:db/cardinality :db.cardinality/one
:db/doc "The account entity that this expense is for"}]])
(def add-account-to-vendor
[[{:db/ident :vendor/default-account
:db/valueType :db.type/ref
:db/cardinality :db.cardinality/one
:db/doc "The account will be used when a bill is created."}]])

View File

@@ -23,16 +23,11 @@
(defn get-by-id [id]
(->> (d/q '[:find (pull ?e [*])
(->> (d/q '[:find (pull ?e [* {:default-account [:account/name :db/id :account/location]}])
:in $ ?e
:where [?e]]
(d/db (d/connect uri))
id)
(map first)
(first)
#_(map (fn [c]
(update c :client/bank-accounts
(fn [bas]
(map (fn [ba]
(update ba :bank-account/type :db/ident ))
bas)))))))
))