supports location matches, adds invoice types

This commit is contained in:
Bryce Covert
2019-10-10 20:09:47 -07:00
parent 1e37a71a4c
commit 8df6fb0279
8 changed files with 78 additions and 9 deletions

View File

@@ -163,13 +163,15 @@
_ (println imports)
transactions (reduce (fn [result {:keys [invoice-number customer-identifier total date vendor-code text] :as info}]
(println "searching for" vendor-code)
(let [[matching-vendor default-expense-account] (->> (d/query
(cond-> {:query {:find ['?vendor '?default-expense-account]
:in ['$ '?vendor-name]
:where ['[?vendor :vendor/name ?vendor-name]
'[?vendor :vendor/default-expense-account ?default-expense-account]]}
:args [(d/db (d/connect uri)) vendor-code]}))
{:query {:find ['?vendor '?default-expense-account]
:in ['$ '?vendor-name]
:where ['[?vendor :vendor/name ?vendor-name]
'[?vendor :vendor/default-expense-account ?default-expense-account]]}
:args [(d/db (d/connect uri)) vendor-code]})
first)
_ (println matching-vendor)
matching-client (parse/best-match clients customer-identifier)
_ (println "New invoice matches client" matching-client)
matching-location (parse/best-location-match matching-client text )