tons of small fixes.

This commit is contained in:
Bryce Covert
2020-09-01 17:07:03 -07:00
parent 183c74f128
commit 9f46f85330
24 changed files with 520 additions and 221 deletions

View File

@@ -512,7 +512,7 @@
:date [#"Date" 0 0 #"Date: (.*)"]
:invoice-number [#"Invoice #" 0 0 #"Invoice #: (.*)"]
:account-number [#"Customer #" 0 0 #"Customer #: (.*)"]}
:parser { :total [:trim-commas-and-remove-dollars nil]
:parser { :total [:trim-commas-and-remove-dollars-and-invert-parentheses nil]
:date [:clj-time "MM/dd/yyyy"]}}
{:vendor "Mama Lu's Foods"
:keywords [#"Mama Lu's Foods"]

View File

@@ -18,6 +18,13 @@
[_ _ value]
(str/replace (str/replace value #"," "") #"\$" ""))
(defmethod parse-value :trim-commas-and-remove-dollars-and-invert-parentheses
[_ _ value]
(let [v (str/replace (str/replace value #"," "") #"\$" "")]
(if-let [[_ a ] (re-find #"\((.*)\)" v)]
(str "-" a)
v)))
(defmethod parse-value :trim-commas-and-negate
[_ _ value]
(let [[_ raw-value] (re-find #"([\d\.]+)"