Quality of life improvements with client login
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
(:require [auto-ap.datomic :refer [uri]]
|
||||
|
||||
[auto-ap.utils :refer [by]]
|
||||
#_[auto-ap.ledger :as l]
|
||||
[datomic.api :as d]
|
||||
[clojure.data.csv :as csv]
|
||||
[clj-time.coerce :as c]
|
||||
@@ -300,11 +301,12 @@
|
||||
)
|
||||
vec))
|
||||
|
||||
(defn patch-missing-ledger-entries []
|
||||
;; TODO uncommenting the two below this makes lein build not work, probably related to the ledger
|
||||
#_(defn patch-missing-ledger-entries []
|
||||
@(d/transact
|
||||
(d/connect uri)
|
||||
(mapv
|
||||
#(auto-ap.ledger/entity-change->ledger (d/db (d/connect uri)) [:transaction %])
|
||||
#(l/entity-change->ledger (d/db (d/connect uri)) [:transaction %])
|
||||
(concat
|
||||
(->>
|
||||
(d/query {:query {:find ['?t ]
|
||||
@@ -317,7 +319,7 @@
|
||||
|
||||
|
||||
|
||||
(defn check-for-out-of-date-ledger [?code]
|
||||
#_(defn check-for-out-of-date-ledger [code]
|
||||
[(d/query {:query {:find ['(count ?e)]
|
||||
:in ['$ '?code]
|
||||
:where ['[?e :transaction/accounts ?ta]
|
||||
@@ -327,11 +329,13 @@
|
||||
'[?e :transaction/client ?c]
|
||||
'[?c :client/code ?code]
|
||||
]}
|
||||
:args [(d/db (d/connect uri)) ?code]})
|
||||
:args [(d/db (d/connect uri)) code]})
|
||||
|
||||
(d/query {:query {:find ['?t ]
|
||||
:in ['$]
|
||||
:where ['[?t :transaction/date]
|
||||
'[?t :transaction/client ?c]
|
||||
'[?c :client/code ?code]
|
||||
'(not [?t :transaction/approval-status :transaction-approval-status/excluded])
|
||||
'(not-join [?t] [?e :journal-entry/original-entity ?t])]}
|
||||
:args [(d/db (d/connect uri))]})
|
||||
@@ -339,9 +343,20 @@
|
||||
(d/query {:query {:find ['?t ]
|
||||
:in ['$]
|
||||
:where ['[?t :transaction/date]
|
||||
'[?t :transaction/client ?c]
|
||||
'[?c :client/code ?code]
|
||||
'(not [?t :transaction/approval-status :transaction-approval-status/excluded])
|
||||
'[?t :transaction/vendor ?v]
|
||||
'[?j :journal-entry/original-entity ?t]
|
||||
'(not [?j :journal-entry/vendor ?v])
|
||||
#_'(not-join [?t] [?e :journal-entry/original-entity ?t])]}
|
||||
:args [(d/db (d/connect uri))]})
|
||||
|
||||
(d/query {:query {:find ['(count ?i) ]
|
||||
:in ['$]
|
||||
:where ['[?i :invoice/client ?c]
|
||||
'(not [?i :invoice/status :invoice-status/voided])
|
||||
'[?c :client/code ?code]
|
||||
'(not-join [?i] [?e :journal-entry/original-entity ?i])]}
|
||||
:args [(d/db (d/connect uri))]})])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user