several fixes.

This commit is contained in:
Bryce Covert
2020-04-25 08:33:37 -07:00
parent b6696c8c45
commit a8736f351e
5 changed files with 45 additions and 48 deletions

View File

@@ -36,19 +36,22 @@
(defmethod parse-csv :sysco
[rows]
(println "Importing Sysco")
(transduce
(comp (drop 1)
(map (fn [[invoice-number invoice-date _ amount :as row]]
{:vendor-code "Sysco"
:customer-identifier nil
:invoice-number invoice-number
:date (parse-date-fallover invoice-date ["M/d/yyyy"])
:total (str/replace amount #"[,\$]" "")
:text (str/join " " row)
:full-text (str/join " " row)})))
conj
[]
rows))
(let [header (first rows)]
(transduce
(comp (drop 1)
(map (fn [row]
(into {} (map vector header row))))
(map (fn [row]
{:vendor-code "Sysco"
:customer-identifier nil
:invoice-number (get row "Inv #")
:date (parse-date-fallover (get row "Invoice Date") ["M/d/yyyy"])
:total (str/replace (get row "Orig Amt") #"[,\$]" "")
:text (str/join " " (vals row))
:full-text (str/join " " (vals row))})))
conj
[]
rows)))
(defmethod parse-csv :mama-lus
[rows]