Fix for sysco

This commit is contained in:
2022-03-28 11:26:49 -07:00
parent 49104abadb
commit ee6048329b
3 changed files with 65 additions and 38 deletions

View File

@@ -370,7 +370,8 @@
{:vendor "Sysco"
:keywords [#"SYSCO"]
:extract {:date #"INVOICE NUMBER[^\n]+\n([^\n]+)\n"
:customer-identifier #"INVOICE NUMBER[^\n]+\n[^\n]+\n([\S ]+?)(?=\s{2,})" ;; ([\S ]+)\s{2,}
#_#_:customer-identifier #"INVOICE NUMBER[^\n]+\n[^\n]+\n([\S ]+?)(?=\s{2,})" ;; ([\S ]+)\s{2,}
:account-number #"INVOICE NUMBER[^\n]+\n[^\n]+\n.*?(?=[\d]{6,7})(\d{6,7})"
:invoice-number #"INVOICE NUMBER[^\n]+\n[^\n]+\n.*?(?=[\d]{9})(\d{9})"
:total #"\s{2,}INVOICE\s{2,}.*?(?=TOTAL)TOTAL\s+([0-9.]+[\-]?)"}
:parser {:date [:clj-time "MM/dd/yy"]

View File

@@ -17,30 +17,40 @@
(java.util UUID)))
(defn cell->pdf [cell]
[:pdf-cell
(cond-> {}
(let [cell-contents (cond
(and (= :dollar (:format cell))
(dollars-0? (:value cell)))
"-"
(:border cell) (assoc :border true
:set-border (:border cell))
(:colspan cell) (assoc :colspan (:colspan cell))
(:align cell) (assoc :align (:align cell))
(= :dollar (:format cell)) (assoc :align :right)
(= :percent (:format cell)) (assoc :align :right)
(:bold cell) (assoc-in [:ttf-name] "fonts/calibri-bold.ttf")
(:color cell) (assoc :color (:color cell)))
(cond
(and (= :dollar (:format cell))
(dollars-0? (:value cell)))
"-"
(= :dollar (:format cell))
(.format (DecimalFormat. "$###,##0.00") (:value cell))
(= :dollar (:format cell))
(.format (DecimalFormat. "$###,##0.00") (:value cell))
(= :percent (:format cell))
(.format (DecimalFormat. "0%") (:value cell))
(= :percent (:format cell))
(.format (DecimalFormat. "0%") (:value cell))
:else
(str (:value cell)))
cell-contents (if (:filters cell)
(do
(println (:filters cell))
cell-contents)
:else
(str (:value cell)))])
cell-contents)]
[:pdf-cell
(cond-> {}
(:border cell) (assoc :border true
:set-border (:border cell))
(:colspan cell) (assoc :colspan (:colspan cell))
(:align cell) (assoc :align (:align cell))
(= :dollar (:format cell)) (assoc :align :right)
(= :percent (:format cell)) (assoc :align :right)
(:bold cell) (assoc-in [:ttf-name] "fonts/calibri-bold.ttf")
(:color cell) (assoc :color (:color cell)))
cell-contents
]))
(defn cell-count [table]
(let [counts (map count (:rows table))]
@@ -212,5 +222,4 @@
:report/key key
:report/url url
:report/created (java.util.Date.)}])
url
))
url))