diff --git a/src/clj/auto_ap/parse/templates.clj b/src/clj/auto_ap/parse/templates.clj index 81f6604b..d993c127 100644 --- a/src/clj/auto_ap/parse/templates.clj +++ b/src/clj/auto_ap/parse/templates.clj @@ -88,8 +88,9 @@ :extract {:date #"INVOICE NUMBER[^\n]+\n\n\d+\s+\d+\s+([0-9]+/[0-9]+/[0-9]+)" :customer-identifier #"BILL TO[^\n]+\n([\S ]+?)(?=\s{2,})" ;; ([\S ]+)\s{2,} :invoice-number #"INVOICE NUMBER[^\n]+\n\n\d+\s+(\d+)" - :total #"DELIVERED AMOUNT\s+\$([0-9.]+)"} - :parser {:date [:clj-time "MM/dd/yyyy"]}} + :total #"(?:DELIVERED AMOUNT|PLEASE REMIT).*(?=\$)\$([0-9.,]+)\s*\n"} + :parser {:date [:clj-time "MM/dd/yyyy"] + :total [:trim-commas nil]}} ;; SYSCO {:vendor "Sysco" @@ -115,18 +116,19 @@ :keywords [#"ABProduce"] :extract {:date #"^\s+([0-9]+/[0-9]+/[0-9]+)" :customer-identifier #"BILL TO:[^\n]+\n[^\n]+\n[^\n]+\n(.*)\s{2,}" - :invoice-number #"(\d+)\s+INV" - :total #" INV\s+([\d\.]+)"} - :parser {:date [:clj-time "MM/dd/yyyy"]} + :invoice-number #"(\d+)\s+(?:INV|C/M)" + :total #" (?:INV|C/M)\s+([\d\.\-]+)"} + :parser {:date [:clj-time "MM/dd/yyyy"] + :total [:trim-commas-and-negate nil]} :multi #"\n" - :multi-match? #"^\s+[0-9]+/[0-9]+/[0-9]+\s+\d+\s+INV\s+"} + :multi-match? #"^\s+[0-9]+/[0-9]+/[0-9]+\s+\d+\s+(INV|C/M)\s+"} ;; CHEF's CHOICE {:vendor "Chef's Choice Produce Co" - :keywords [#"2170 MARTIN AVENUE"] + :keywords [#"(2170 MARTIN AVENUE|213-3886)"] :extract {:date #"([0-9/]{10,10})" :customer-identifier #"\n B\s+([\S ]+?)(?=\s{2,}I) " - :invoice-number #"\n([0-9]+)" + :invoice-number #"^0*([0-9]+)" :total #"INVOICE\s+([\d\.]+)"} :parser {:date [:clj-time "MM/dd/yyyy"]} ;; may want to try two approaches [:clj-time ["MM/dd/yyyy" "MM1dd1yyyy"]] :multi #"\n"