tons of bug fixes.

This commit is contained in:
Bryce Covert
2020-07-15 08:17:39 -07:00
parent d120b7e810
commit 08f12b8107
9 changed files with 496 additions and 186 deletions

View File

@@ -16,6 +16,11 @@
(str/includes? (str header) "Closed Date")
:sysco-style-1
(str/includes? (str header) "Business Unit")
:mission
(str/includes? (str header) "Document Number")
:philz
:else
nil)
@@ -100,6 +105,45 @@
[]
rows))
(defmethod parse-csv :mission
[rows]
(transduce
(comp (drop 1)
(map (fn [[ po-number despatch-number invoice-number invoice-date customer value :as row]]
{:vendor-code "Mama Lu's Foods"
:customer-identifier customer
:invoice-number (str po-number "-" invoice-number )
:date (parse-date-fallover invoice-date ["M/d/yyyy HH:ss" "M/d/yyyy HH:mm:ss aa" "M/d/yyyy"])
:total (str/replace value #"," "")
:text (str/join " " row)
:full-text (str/join " " row)})))
conj
[]
rows))
(defmethod parse-csv :philz
[rows]
(transduce
(comp
(filter (fn [[dt _ doc-number name _ status _ _ amount :as row]]
(= status "Billed")))
(map (fn [[dt _ doc-number name _ _ _ _ amount :as row]]
(print name)
{:vendor-code "PHILZ COFFEE, INC"
:customer-identifier name
:invoice-number doc-number
:date (some-> dt not-empty (parse-date-fallover ["MM/dd/yyyy"]))
:total (str/replace amount #"," "")
:text (str/join " " row)
:full-text (str/join " " row)}))
)
conj
[]
(drop 1 rows)))
(defmethod parse-csv nil
[rows]
nil)