le boulanger, others.
This commit is contained in:
@@ -50,6 +50,7 @@
|
||||
:address {:type :address}
|
||||
:location_matches {:type '(list :location_match)}
|
||||
:locations {:type '(list String)}
|
||||
:matches {:type '(list String)}
|
||||
:bank_accounts {:type '(list :bank_account)}}}
|
||||
:contact
|
||||
{:fields {:id {:type :id}
|
||||
@@ -298,6 +299,7 @@
|
||||
:email {:type 'String}
|
||||
:address {:type :add_address}
|
||||
:locations {:type '(list String)}
|
||||
:matches {:type '(list String)}
|
||||
:location_matches {:type '(list :edit_location_match)}
|
||||
:bank_accounts {:type '(list :edit_bank_account)}}}
|
||||
:edit_bank_account
|
||||
|
||||
@@ -27,12 +27,15 @@
|
||||
_ (println edit_client)
|
||||
_ (when client
|
||||
@(d/transact (d/connect uri)
|
||||
(mapv (fn [lm] [:db/retractEntity (:db/id lm)]) (:client/location-matches client))))
|
||||
(into
|
||||
(mapv (fn [lm] [:db/retractEntity (:db/id lm)]) (:client/location-matches client))
|
||||
(mapv (fn [m] [:db/retract (:db/id client) :client/matches m]) (:client/matches client)))))
|
||||
transactions [(remove-nils {:db/id id
|
||||
:client/code (if (str/blank? (:client/code client))
|
||||
(:code edit_client)
|
||||
(:client/code client))
|
||||
:client/name (:name edit_client)
|
||||
:client/matches (:matches edit_client)
|
||||
:client/email (:email edit_client)
|
||||
:client/locations (filter identity (:locations edit_client))
|
||||
:client/location-matches (->> (:location_matches edit_client)
|
||||
|
||||
@@ -79,7 +79,6 @@
|
||||
(let [fuzzy-match (->> clients
|
||||
(mapcat (fn [{:keys [:db/id :client/matches :client/name] :as client :or {matches []}}]
|
||||
(map (fn [m]
|
||||
(println m invoice-client-name)
|
||||
[client (m/jaccard (.toLowerCase invoice-client-name) (.toLowerCase m))])
|
||||
(conj matches name))))
|
||||
(filter #(< (second %) 0.25))
|
||||
@@ -111,7 +110,6 @@
|
||||
|
||||
(map (fn [match] [location match]) matches)))
|
||||
(filter (fn [[location match]]
|
||||
(println "loc " location match text)
|
||||
(re-find (re-pattern (str "(?i)" match)) text)) )
|
||||
first
|
||||
first)
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
:parser {:date [:clj-time "MM/dd/yyyy"]}
|
||||
:multi #"\n"
|
||||
:multi-match? #"^[0-9]+/[0-9]+/[0-9]+\s+(\d+)"}
|
||||
{:vendor "Performance Food Group"
|
||||
{:vendor "Performance Food Group - LEDYARD"
|
||||
:keywords [#"performancefoodservice"]
|
||||
:extract {:date #"DELIVER TO[^\n]+\n.+?(?=[0-9]+/[0-9]+/[0-9]+)([0-9]+/[0-9]+/[0-9]+)"
|
||||
:customer-identifier #"DELIVER TO[^\n]+\n\s*[\S ]+?(?=\s{2,}([\S ]+?)\s{2,})" ;; ([\S ]+)\s{2,}
|
||||
@@ -81,7 +81,22 @@
|
||||
:customer-identifier #"INVOICE NUMBER[^\n]+\n[^\n]+\n([\S ]+?)(?=\s{2,})" ;; ([\S ]+)\s{2,}
|
||||
:invoice-number #"INVOICE NUMBER[^\n]+\n[^\n]+\n.*?(?=[\d]{9})(\d{9})"
|
||||
:total #"\s{2,}INVOICE\s{2,}.*?(?=TOTAL)TOTAL\s+([0-9.]+)"}
|
||||
:parser {:date [:clj-time "MM/dd/yyyy"]}}])
|
||||
:parser {:date [:clj-time "MM/dd/yyyy"]}}
|
||||
{:vendor "Le Boulanger"
|
||||
:keywords [#"Le Boulanger"]
|
||||
:extract {:date #"Invoice Date: ([^\n]+)\n"
|
||||
:customer-identifier #"Ship to\n+\s+([\S ]+?)(?=\s{2,})"
|
||||
:invoice-number #"Invoice No: ([^\n]+)\n"
|
||||
:total #" Total:\s+([\d\.]+)"}
|
||||
:parser {:date [:clj-time "MMM dd, yyyy"]}}
|
||||
{:vendor "Performance Food Group - ROMA"
|
||||
:keywords [#"Performance Food Group, Inc\n\f"]
|
||||
:extract {:date #"Date: ([0-9]+/[0-9]+/[0-9]+)"
|
||||
:customer-identifier #"BILL TO:\s+([\S ]+?)(?=\s{2,})"
|
||||
:invoice-number #"INVOICE NO.\s+ ([\d]+)"
|
||||
:total #"([\d\.,]+)\s+INVOICE TOTAL"}
|
||||
:parser {:date [:clj-time "MM/dd/yy"]
|
||||
:total [:trim-commas nil]}}])
|
||||
|
||||
(defn offset [c x y]
|
||||
(.toString (CellAddress. (+ y (.getRow (.getAddress c))) (+ x (.getColumn (.getAddress c))) )))
|
||||
|
||||
@@ -115,6 +115,11 @@
|
||||
|
||||
(defn do-import []
|
||||
(let [transactions (client/get-transactions)
|
||||
_ (println "Count of transactions" (->> transactions
|
||||
(group-by transactions :accountId)
|
||||
(reduce-kv (fn [acc k v]
|
||||
(assoc acc k (count v)))
|
||||
{})))
|
||||
#_#__ (println "All accounts:" (client/get-accounts))
|
||||
#_#__ (println "ALL Transactions:" transactions)
|
||||
all-bank-accounts (mapcat (fn [c] (map
|
||||
|
||||
Reference in New Issue
Block a user