several fixes.
This commit is contained in:
@@ -160,7 +160,20 @@
|
||||
(mapv
|
||||
(fn [[numeric {:keys [name location]}]]
|
||||
(remove-nils
|
||||
{:account/type :account-type/expense
|
||||
{:account/type (cond (<= 1000 numeric 1999)
|
||||
:account-type/asset
|
||||
|
||||
(<= 2000 numeric 2999)
|
||||
:account-type/liability
|
||||
|
||||
(<= 3000 numeric 3999)
|
||||
:account-type/equity
|
||||
|
||||
(<= 4000 numeric 4999)
|
||||
:account-type/revenue
|
||||
|
||||
:else
|
||||
:account-type/expense)
|
||||
:account/numeric-code numeric
|
||||
:account/code (str numeric)
|
||||
:account/name name
|
||||
@@ -186,7 +199,8 @@
|
||||
:where ['[?e :invoice/total]]}
|
||||
:args [(d/db conn)]}))
|
||||
z (->> invoice-ids
|
||||
(mapv #(vector (ledger/entity-change->ledger (d/db conn) [:invoice %]))))]
|
||||
(map #(ledger/entity-change->ledger (d/db conn) [:invoice %]))
|
||||
(partition-all 100))]
|
||||
z))
|
||||
|
||||
|
||||
@@ -199,11 +213,13 @@
|
||||
z (->> transaction-ids
|
||||
(map #(ledger/entity-change->ledger (d/db conn) [:transaction %]))
|
||||
(filter identity)
|
||||
(mapv #(vector %)))]
|
||||
(partition-all 100)
|
||||
#_(mapv #(vector %)))]
|
||||
z))
|
||||
|
||||
#_(test-run (bulk-load-transaction-ledger (d/connect auto-ap.datomic/uri)))
|
||||
#_(test-run (bulk-load-invoice-ledger (d/connect auto-ap.datomic/uri)))
|
||||
#_(test-run (reset-ledger (d/connect auto-ap.datomic/uri)))
|
||||
|
||||
#_(do (doseq [tran (convert-transactions (d/connect auto-ap.datomic/uri))]
|
||||
@(d/transact (d/connect auto-ap.datomic/uri) tran))
|
||||
@@ -294,6 +310,15 @@
|
||||
|
||||
|
||||
|
||||
(defn reset-ledger [conn]
|
||||
(let [results (->> (d/query {:query {:find '[?e]
|
||||
:in '[$]
|
||||
:where ['[?e :journal-entry/original-entity ]]}
|
||||
:args [(d/db conn)]})
|
||||
(mapv (fn [[id]]
|
||||
[:db/retractEntity id]))
|
||||
(partition-all 100))]
|
||||
results))
|
||||
|
||||
#_(do (doseq [tran (convert-transactions (d/connect auto-ap.datomic/uri))]
|
||||
@(d/transact (d/connect auto-ap.datomic/uri) tran))
|
||||
|
||||
Reference in New Issue
Block a user