Quality of life improvements with client login
This commit is contained in:
@@ -193,3 +193,16 @@
|
||||
(map <-datomic)))
|
||||
|
||||
|
||||
(defn get-existing-set []
|
||||
(d/query
|
||||
(cond-> {:query {:find ['?vendor '?client '?invoice-number]
|
||||
:in ['$]
|
||||
:where '[[?e :invoice/invoice-number ?invoice-number]
|
||||
[?e :invoice/vendor ?vendor]
|
||||
[?e :invoice/client ?client]
|
||||
(not [?e :invoice/status :invoice-status/voided])
|
||||
]}
|
||||
|
||||
:args [(d/db (d/connect uri))]})))
|
||||
|
||||
|
||||
|
||||
@@ -174,7 +174,7 @@
|
||||
@(d/transact
|
||||
(d/connect uri)
|
||||
(mapv
|
||||
#(auto-ap.ledger/entity-change->ledger (d/db (d/connect uri)) [:transaction %])
|
||||
#(entity-change->ledger (d/db (d/connect uri)) [:transaction %])
|
||||
(concat
|
||||
(->>
|
||||
(d/query {:query {:find ['?t ]
|
||||
|
||||
@@ -39,8 +39,6 @@
|
||||
(if-let [id (:db/id (or (clients client-code)
|
||||
(clients client)))]
|
||||
(do
|
||||
(println "FOUND CLIENT" (or (clients client-code)
|
||||
(clients client)))
|
||||
(when (not ((set (:client/locations (or (clients client-code)
|
||||
(clients client))))
|
||||
default-location))
|
||||
@@ -78,8 +76,8 @@
|
||||
(defn parse-account-numeric-code [i]
|
||||
(try
|
||||
(when-let [account-numeric-code (:account-numeric-code i)]
|
||||
(d-accounts/get-account-by-numeric-code-and-sets (Integer/parseInt account-numeric-code)
|
||||
["default"]))
|
||||
(:db/id (d-accounts/get-account-by-numeric-code-and-sets (Integer/parseInt account-numeric-code)
|
||||
["default"])))
|
||||
(catch Exception e
|
||||
(throw (Exception. (str "Could not parse expense account from value '" (:account-numeric-code i) "'") e)))))
|
||||
|
||||
@@ -481,12 +479,7 @@
|
||||
{{:keys [excel-rows]} :edn-params user :identity}
|
||||
(assert-admin user)
|
||||
(let [parsed-invoice-rows (parse-invoice-rows excel-rows)
|
||||
existing-rows (->> (d-invoices/get-graphql {:count Integer/MAX_VALUE})
|
||||
first
|
||||
(filter (fn [i] (not= :invoice-status/voided (:invoice/status i))))
|
||||
(map (fn [{:keys [:invoice/vendor :invoice/client :invoice/invoice-number]}]
|
||||
[(:db/id vendor) (:db/id client) invoice-number]))
|
||||
set)
|
||||
existing-rows (set (d-invoices/get-existing-set ))
|
||||
grouped-rows (group-by
|
||||
(fn [i]
|
||||
(cond (seq (:errors i))
|
||||
|
||||
Reference in New Issue
Block a user