merged.
This commit is contained in:
@@ -8,6 +8,11 @@
|
||||
:where [?e :client/name]]
|
||||
(d/db (d/connect uri)))
|
||||
(map first)
|
||||
(map (fn [c]
|
||||
(update c :client/location-matches
|
||||
(fn [lms]
|
||||
|
||||
(map #(assoc % :location-match/match (first (:location-match/matches %))) lms)))))
|
||||
(map (fn [c]
|
||||
(update c :client/bank-accounts
|
||||
(fn [bas]
|
||||
|
||||
@@ -58,12 +58,17 @@
|
||||
%))}}
|
||||
:objects
|
||||
{
|
||||
:location_match
|
||||
{:fields {:location {:type 'String}
|
||||
:match {:type 'String}}}
|
||||
|
||||
:client
|
||||
{:fields {:id {:type :id}
|
||||
:name {:type 'String}
|
||||
:code {:type 'String}
|
||||
:email {:type 'String}
|
||||
:address {:type :address}
|
||||
:location_matches {:type '(list :location_match)}
|
||||
:locations {:type '(list String)}
|
||||
:bank_accounts {:type '(list :bank_account)}}}
|
||||
:contact
|
||||
@@ -442,6 +447,8 @@
|
||||
{
|
||||
:invoice_payment_amount {:fields {:invoice_id {:type :id}
|
||||
:amount {:type 'Float}}}
|
||||
:edit_location_match {:fields {:location {:type 'String}
|
||||
:match {:type 'String}}}
|
||||
|
||||
:date_range {:fields {:start {:type :iso_date}
|
||||
:end {:type :iso_date}}}
|
||||
@@ -466,6 +473,7 @@
|
||||
:email {:type 'String}
|
||||
:address {:type :add_address}
|
||||
:locations {:type '(list String)}
|
||||
:location_matches {:type '(list :edit_location_match)}
|
||||
:bank_accounts {:type '(list :edit_bank_account)}}}
|
||||
:edit_bank_account
|
||||
{:fields {:id {:type :id }
|
||||
|
||||
@@ -65,9 +65,9 @@
|
||||
[:table {:num-cols 12 :border false :leading 11 :widths (distribute [2 3 3 3 3 3 3 3 3 2 2 2])}
|
||||
[(let [{:keys [:client/name] {:keys [:address/street1 :address/street2 :address/city :address/state :address/zip]} :client/address} client]
|
||||
|
||||
[:cell {:colspan 3 } [:paragraph {:leading 14} name "\n" street1 "\n" (str city ", " state " " zip)] ])
|
||||
[:cell {:colspan 4 } [:paragraph {:leading 14} name "\n" street1 "\n" (str city ", " state " " zip)] ])
|
||||
(let [{:keys [:bank-account/bank-name :bank-account/bank-code] } bank-account]
|
||||
[:cell {:colspan 7 :align :center} [:paragraph {:style :bold} bank-name] [:paragraph {:size 8 :leading 8} bank-code]])
|
||||
[:cell {:colspan 6 :align :center} [:paragraph {:style :bold} bank-name] [:paragraph {:size 8 :leading 8} bank-code]])
|
||||
[:cell {:colspan 2 :size 13}
|
||||
check]]
|
||||
|
||||
|
||||
@@ -32,6 +32,10 @@
|
||||
:client/name (:name edit_client)
|
||||
:client/email (:email edit_client)
|
||||
:client/locations (filter identity (:locations edit_client))
|
||||
:client/location-matches (->> (:location_matches edit_client)
|
||||
(filter (fn [lm] (and (:location lm) (:match lm))))
|
||||
(map (fn [lm] {:location-match/location (:location lm)
|
||||
:location-match/matches [(:match lm)]})))
|
||||
:client/address (remove-nils {
|
||||
:address/street1 (:street1 (:address edit_client))
|
||||
:address/street2 (:street2 (:address edit_client))
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
[_ _ value]
|
||||
value)
|
||||
|
||||
(def last-text (atom nil))
|
||||
|
||||
|
||||
(defn template-applies? [text {:keys [keywords]}]
|
||||
(every? #(re-find % text) keywords))
|
||||
@@ -49,7 +51,7 @@
|
||||
:text text}))])))
|
||||
|
||||
(defn parse [text]
|
||||
(println text)
|
||||
(reset! last-text text)
|
||||
(->> t/pdf-templates
|
||||
(filter (partial template-applies? text))
|
||||
first
|
||||
|
||||
@@ -34,6 +34,20 @@
|
||||
:customer-identifier #"Bill To[^\n]+\n[^\n]*\n([\w ]+)\s{2,}"
|
||||
:date #"Invoice #\s*\n\s*[\w\.]+\s+([\w\./]+)"
|
||||
:total #"Total\s+\$([0-9.]+)"}
|
||||
:parser {:date [:clj-time "MM/dd/yy"]}}
|
||||
{:vendor "DVW Commercial"
|
||||
:keywords [#"DVW Commercial"]
|
||||
:extract {:date #"\s*([0-9]+/[0-9]+/[0-9]+)"
|
||||
:customer-identifier #"Bill To:[^\n]+\n[^\n]*\n\s*([\w ]+) \("
|
||||
:invoice-number #"Invoice\s*\n\s*([\w\./]+)*"
|
||||
:total #"Total:\s+\$ ([0-9.]+)"}
|
||||
:parser {:date [:clj-time "MM/dd/yy"]}}
|
||||
{:vendor "Daylight Foods"
|
||||
:keywords [#"DAYLIGHT FOODS"]
|
||||
:extract {:date #"\n\s*Date[^\n]+\n\s*([0-9]+/[0-9]+/[0-9]+)"
|
||||
:customer-identifier #"Bill To:[^\n]+\n\s*([\w ]+)"
|
||||
:invoice-number #"Invoice\s([\w\./]+)*"
|
||||
:total #"Total Invoice\s+([0-9.]+)"}
|
||||
:parser {:date [:clj-time "MM/dd/yy"]}}])
|
||||
|
||||
(def excel-templates
|
||||
|
||||
Reference in New Issue
Block a user