Adds ability to query for snapshots
This commit is contained in:
@@ -701,4 +701,55 @@
|
||||
|
||||
1
|
||||
|
||||
(init-repl)
|
||||
|
||||
(seq (dc/q '[:find ?v ?vn
|
||||
:in $ ?vn
|
||||
:where [?v :vendor/name ?vn]]
|
||||
(dc/history (dc/db conn))
|
||||
"Golden Brands San Jose"))
|
||||
|
||||
|
||||
(sort (dc/q '[:find ?d2 ?in
|
||||
:in $ ?v
|
||||
:where [$ ?i :invoice/vendor ?v ?tx true]
|
||||
[?i :invoice/date ?d]
|
||||
[(iol-ion.query/iso-date ?d) ?d2]
|
||||
[?i :invoice/invoice-number ?in] ]
|
||||
(dc/history (dc/db conn))
|
||||
17592332212252))
|
||||
|
||||
|
||||
(dc/q '[:find (sample 3 ?d) (count ?d)
|
||||
:in $
|
||||
:where [?d :journal-entry-line/dirty false]
|
||||
[?d :journal-entry-line/account]
|
||||
]
|
||||
(dc/db conn))
|
||||
|
||||
|
||||
(let [[[count debit credit]]
|
||||
(dc/q '[:find (count ?d) (sum ?debit) (sum ?credit)
|
||||
:in $ ?ba
|
||||
:where
|
||||
#_[?a :account/numeric-code "11309"]
|
||||
|
||||
[?d :journal-entry-line/account ?ba]
|
||||
[(get-else $ ?d :journal-entry-line/debit 0.0) ?debit]
|
||||
[(get-else $ ?d :journal-entry-line/credit 0.0) ?credit]]
|
||||
(dc/db conn)
|
||||
[:bank-account/code "SCCB-USB9598"])]
|
||||
(- debit credit))
|
||||
|
||||
(let [ db (dc/db conn)
|
||||
account-needing-rebuild
|
||||
{:client [:client/code "SCCB" ]
|
||||
:account (auto-ap.datomic/pull-id db [:bank-account/code "SCCB-USB9598"])
|
||||
:starting-at #inst "2000-01-01"
|
||||
:location "A"}
|
||||
lookup (auto-ap.ledger/build-account-lookup (:client account-needing-rebuild))]
|
||||
[lookup (-> account-needing-rebuild
|
||||
(assoc :build-from (auto-ap.ledger/find-running-balance-start account-needing-rebuild db))
|
||||
(assoc :dirty-entries (auto-ap.ledger/get-dirty-entries account-needing-rebuild db))
|
||||
(assoc :account-type (:account_type ((auto-ap.ledger/build-account-lookup (:client account-needing-rebuild)) (:account account-needing-rebuild))))
|
||||
(auto-ap.ledger/compute-running-balance))])
|
||||
|
||||
Reference in New Issue
Block a user