Balance sheet has correct data, needs formatting.

This commit is contained in:
Bryce Covert
2019-04-17 22:36:31 -07:00
parent 3ecfde69d0
commit eea169a74f
7 changed files with 187 additions and 112 deletions

View File

@@ -128,8 +128,8 @@
:requires [:auto-ap/convert-invoices]}
:auto-ap/add-yodlee-merchant2 {:txes add-general-ledger/add-yodlee-merchant :requires [:auto-ap/convert-transactions]}
#_#_:auto-ap/bulk-load-invoice-ledger3 {:txes-fn `add-general-ledger/bulk-load-invoice-ledger :requires [:auto-ap/convert-transactions]}
#_#_:auto-ap/bulk-load-transaction-ledger3 {:txes-fn `add-general-ledger/bulk-load-transaction-ledger :requires [:auto-ap/convert-transactions]}
:auto-ap/bulk-load-invoice-ledger3 {:txes-fn `add-general-ledger/bulk-load-invoice-ledger :requires [:auto-ap/convert-transactions]}
:auto-ap/bulk-load-transaction-ledger3 {:txes-fn `add-general-ledger/bulk-load-transaction-ledger :requires [:auto-ap/convert-transactions]}
}]
(println "Conforming database...")

View File

@@ -153,16 +153,19 @@
{:db/ident :account-type/asset}
{:db/ident :account-type/equity}]
(mapv
(fn [[numeric {:keys [name location]}]]
(remove-nils
{:account/type :account-type/expense
:account/numeric-code numeric
:account/code (str numeric)
:account/name name
:account/location location
:account/account-set "default"}))
expense-accounts/chooseable-expense-accounts)])
(->> expense-accounts/chooseable-expense-accounts
(filter (fn [[numeric]]
(not (#{0 2100 5800 9600 1300 8200 7400 8500 2400 8800 1400 2500 7200 1200 1600 1500 3300 9800 9200 2800 1100 5700 2600 9300 9500 8100 7500 7100 2700} numeric))))
(mapv
(fn [[numeric {:keys [name location]}]]
(remove-nils
{:account/type :account-type/expense
:account/numeric-code numeric
:account/code (str numeric)
:account/name name
:account/location location
:account/account-set "default"}))))])
(defn add-general-ledger-fns [conn]
[[{:db/ident :replace-general-ledger
@@ -248,18 +251,21 @@
invoice-expense-accounts)]))
(defn convert-transactions [conn]
(let [matched-transactions (d/query {:query {:find '[?transaction ?v]
(let [matched-transactions (d/query {:query {:find '[?transaction ?v ?amount]
:in '[$]
:where ['[?transaction :transaction/payment ?payment]
'[?transaction :transaction/amount ?amount]
'[?payment :payment/invoices ?i]
'[?i :invoice/vendor ?v]]}
:args [(d/db (d/connect auto-ap.datomic/uri))]})]
[(mapv
(fn [[transaction-id vendor-id]]
(fn [[transaction-id vendor-id amount]]
(remove-nils {:db/id transaction-id
:transaction/vendor vendor-id
:transaction/location "A"
:transaction/account (:db/id (accounts/get-account-by-numeric-code-and-sets 2110 ["default"]))
:transaction/accounts [#:transaction-account {:account (:db/id (accounts/get-account-by-numeric-code-and-sets 2110 ["default"]))
:location "A"
:amount (Math/abs amount)}]
}))
matched-transactions)]))