Fix for sysco
This commit is contained in:
@@ -370,7 +370,8 @@
|
|||||||
{:vendor "Sysco"
|
{:vendor "Sysco"
|
||||||
:keywords [#"SYSCO"]
|
:keywords [#"SYSCO"]
|
||||||
:extract {:date #"INVOICE NUMBER[^\n]+\n([^\n]+)\n"
|
: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})"
|
:invoice-number #"INVOICE NUMBER[^\n]+\n[^\n]+\n.*?(?=[\d]{9})(\d{9})"
|
||||||
:total #"\s{2,}INVOICE\s{2,}.*?(?=TOTAL)TOTAL\s+([0-9.]+[\-]?)"}
|
:total #"\s{2,}INVOICE\s{2,}.*?(?=TOTAL)TOTAL\s+([0-9.]+[\-]?)"}
|
||||||
:parser {:date [:clj-time "MM/dd/yy"]
|
:parser {:date [:clj-time "MM/dd/yy"]
|
||||||
|
|||||||
@@ -17,18 +17,7 @@
|
|||||||
(java.util UUID)))
|
(java.util UUID)))
|
||||||
|
|
||||||
(defn cell->pdf [cell]
|
(defn cell->pdf [cell]
|
||||||
[:pdf-cell
|
(let [cell-contents (cond
|
||||||
(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)))
|
|
||||||
(cond
|
|
||||||
(and (= :dollar (:format cell))
|
(and (= :dollar (:format cell))
|
||||||
(dollars-0? (:value cell)))
|
(dollars-0? (:value cell)))
|
||||||
"-"
|
"-"
|
||||||
@@ -40,7 +29,28 @@
|
|||||||
(.format (DecimalFormat. "0%") (:value cell))
|
(.format (DecimalFormat. "0%") (:value cell))
|
||||||
|
|
||||||
:else
|
:else
|
||||||
(str (:value cell)))])
|
(str (:value cell)))
|
||||||
|
cell-contents (if (:filters cell)
|
||||||
|
(do
|
||||||
|
(println (:filters cell))
|
||||||
|
cell-contents)
|
||||||
|
|
||||||
|
|
||||||
|
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]
|
(defn cell-count [table]
|
||||||
(let [counts (map count (:rows table))]
|
(let [counts (map count (:rows table))]
|
||||||
@@ -212,5 +222,4 @@
|
|||||||
:report/key key
|
:report/key key
|
||||||
:report/url url
|
:report/url url
|
||||||
:report/created (java.util.Date.)}])
|
:report/created (java.util.Date.)}])
|
||||||
url
|
url))
|
||||||
))
|
|
||||||
|
|||||||
@@ -100,12 +100,18 @@
|
|||||||
first))
|
first))
|
||||||
|
|
||||||
(defn filter-client [pnl-data client]
|
(defn filter-client [pnl-data client]
|
||||||
(update pnl-data :data (fn [data]
|
(-> pnl-data
|
||||||
((group-by :client-id data) client))))
|
(update :data (fn [data]
|
||||||
|
((group-by :client-id data) client)))
|
||||||
|
(update :filters (fn [f]
|
||||||
|
(assoc f :client-id client)))))
|
||||||
|
|
||||||
(defn filter-location [pnl-data location]
|
(defn filter-location [pnl-data location]
|
||||||
(update pnl-data :data (fn [data]
|
(-> pnl-data
|
||||||
((group-by :location data) location))))
|
(update :data (fn [data]
|
||||||
|
((group-by :location data) location)))
|
||||||
|
(update :filters (fn [f]
|
||||||
|
(assoc f :location location)))))
|
||||||
|
|
||||||
(defn filter-categories [pnl-data categories]
|
(defn filter-categories [pnl-data categories]
|
||||||
(update pnl-data :data (fn [data]
|
(update pnl-data :data (fn [data]
|
||||||
@@ -114,14 +120,22 @@
|
|||||||
(group-by best-category data))))))
|
(group-by best-category data))))))
|
||||||
|
|
||||||
(defn filter-period [pnl-data period]
|
(defn filter-period [pnl-data period]
|
||||||
(update pnl-data :data (fn [data]
|
(-> pnl-data
|
||||||
((group-by :period data) period))))
|
(update :data (fn [data]
|
||||||
|
((group-by :period data) period)))
|
||||||
|
(update :filters (fn [f]
|
||||||
|
(assoc f :date-range period)))))
|
||||||
|
|
||||||
(defn filter-numeric-code [pnl-data from to]
|
(defn filter-numeric-code [pnl-data from to]
|
||||||
(update pnl-data :data (fn [data]
|
(-> pnl-data
|
||||||
|
(update :data (fn [data]
|
||||||
(filter
|
(filter
|
||||||
#(<= from (:numeric-code %) to)
|
#(<= from (:numeric-code %) to)
|
||||||
data))))
|
data)))
|
||||||
|
(update :filters (fn [f]
|
||||||
|
(assoc f
|
||||||
|
:from-numeric-code from
|
||||||
|
:to-numeric-code to)))))
|
||||||
|
|
||||||
(defn negate [pnl-data types]
|
(defn negate [pnl-data types]
|
||||||
(update pnl-data :data
|
(update pnl-data :data
|
||||||
@@ -142,13 +156,16 @@
|
|||||||
|
|
||||||
(defn subtotal-row [pnl-data title & [cell-args]]
|
(defn subtotal-row [pnl-data title & [cell-args]]
|
||||||
(into [{:value title
|
(into [{:value title
|
||||||
:bold true}]
|
:bold true
|
||||||
|
:filters (:filters pnl-data)}]
|
||||||
(map
|
(map
|
||||||
(fn [p]
|
(fn [p]
|
||||||
|
(let [data (filter-period pnl-data p)]
|
||||||
(merge
|
(merge
|
||||||
{:format :dollar
|
{:format :dollar
|
||||||
:value (aggregate-accounts (filter-period pnl-data p))}
|
:value (aggregate-accounts data)
|
||||||
cell-args))
|
:filters (:filters data)}
|
||||||
|
cell-args)))
|
||||||
(-> pnl-data :args :periods))))
|
(-> pnl-data :args :periods))))
|
||||||
|
|
||||||
(defn calc-percent-of-sales [table pnl-data]
|
(defn calc-percent-of-sales [table pnl-data]
|
||||||
|
|||||||
Reference in New Issue
Block a user