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
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
:graphql {:token token
|
||||
:query-obj {:venia/queries [[:client
|
||||
|
||||
[:id :name :code :email :locations [:location-matches [:location :match]] [:bank-accounts [:id :code :number :bank-name :bank-code :check-number :name :routing :type :sort-order :visible :yodlee-account-id] ]
|
||||
[:id :name :code :email :matches :locations [:location-matches [:location :match]] [:bank-accounts [:id :code :number :bank-name :bank-code :check-number :name :routing :type :sort-order :visible :yodlee-account-id] ]
|
||||
[:address [:street1 :street2 :city :state :zip]]]]
|
||||
[:vendor
|
||||
[:id :name :default-expense-account [:primary-contact [:name :phone :email :id]] [:secondary-contact [:id :name :phone :email]] :print-as :invoice-reminder-schedule :code]]]}
|
||||
@@ -65,7 +65,7 @@
|
||||
(fn [{:keys [db]} [_ token user]]
|
||||
{:graphql {:token token
|
||||
:query-obj {:venia/queries [[:client
|
||||
[:id :name :code [:location-matches [:location :match]] [:address [:street1 :street2 :city :state :zip]] [:bank-accounts [:id :code :number :bank-name :bank-code :check-number :name :routing :type :sort-order :visible :yodlee-account-id] ]]]
|
||||
[:id :name :code :matches :locations [:location-matches [:location :match]] [:address [:street1 :street2 :city :state :zip]] [:bank-accounts [:id :code :number :bank-name :bank-code :check-number :name :routing :type :sort-order :visible :yodlee-account-id] ]]]
|
||||
[:vendor
|
||||
[:id :name :default-expense-account [:primary-contact [:name :phone :email :id]] [:secondary-contact [:id :name :phone :email]] :print-as :invoice-reminder-schedule :code]]]}
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
:code (:code new-client-data) ;; TODO add validation can't change
|
||||
:email (:email new-client-data)
|
||||
:locations (:locations new-client-data)
|
||||
:matches (vec (:matches new-client-data))
|
||||
:location-matches (:location-matches new-client-data)
|
||||
:address {:street1 (:street1 (:address new-client-data))
|
||||
:street2 (:street2 (:address new-client-data)),
|
||||
@@ -87,7 +88,7 @@
|
||||
:operation/name "EditClient"}
|
||||
:venia/queries [{:query/data [:edit-client
|
||||
{:edit-client new-client-req}
|
||||
[:id :name :code :email :locations [:location-matches [:location :match]] [:address [:street1 :street2 :city :state :zip]] [:bank-accounts [:id :number :check-number :name :code :bank-code :bank-name :routing :type :visible :yodlee-account-id :sort-order]]]]}]}
|
||||
[:id :name :code :email :locations :matches [:location-matches [:location :match]] [:address [:street1 :street2 :city :state :zip]] [:bank-accounts [:id :number :check-number :name :code :bank-code :bank-name :routing :type :visible :yodlee-account-id :sort-order]]]]}]}
|
||||
:on-success [::save-complete]
|
||||
:on-error [::forms/save-error ::new-client]}}
|
||||
{:db new-client-form}))))
|
||||
@@ -113,6 +114,23 @@
|
||||
(update :locations conj (:location client))
|
||||
(dissoc :location))))
|
||||
|
||||
(re-frame/reg-event-db
|
||||
::add-new-match
|
||||
[(forms/in-form ::new-client) (re-frame/path [:data])]
|
||||
(fn [client _]
|
||||
(-> client
|
||||
(update :matches conj (:match client))
|
||||
(update :matches set)
|
||||
(dissoc :match))))
|
||||
|
||||
(re-frame/reg-event-db
|
||||
::remove-match
|
||||
[(forms/in-form ::new-client) (re-frame/path [:data])]
|
||||
(fn [client [_ which]]
|
||||
(-> client
|
||||
(update :matches set)
|
||||
(update :matches disj which))))
|
||||
|
||||
(re-frame/reg-event-db
|
||||
::add-new-location-match
|
||||
[(forms/in-form ::new-client) (re-frame/path [:data])]
|
||||
@@ -378,6 +396,22 @@
|
||||
:spec ::entity/email
|
||||
:event change-event
|
||||
:subscription new-client}]]]]
|
||||
[:div.field
|
||||
[:p.help "Matches"]
|
||||
[:div.control
|
||||
[:div.field.has-addons
|
||||
[:p.control
|
||||
[bind-field
|
||||
[:input.input {:type "text"
|
||||
:field :match
|
||||
:event change-event
|
||||
:subscription new-client}]]]
|
||||
[:p.control [:button.button.is-primary {:on-click (dispatch-event [::add-new-match])} "Add"]]]]
|
||||
[:ul
|
||||
(for [match (:matches new-client)]
|
||||
^{:key match} [:li match [:a {:on-click (dispatch-event [::remove-match match])} [:span.icon [:span.fa.fa-times]]]])]]
|
||||
|
||||
|
||||
|
||||
[:div.field
|
||||
[:p.help "Locations"]
|
||||
|
||||
Reference in New Issue
Block a user