Fix for sysco
This commit is contained in:
@@ -100,12 +100,18 @@
|
||||
first))
|
||||
|
||||
(defn filter-client [pnl-data client]
|
||||
(update pnl-data :data (fn [data]
|
||||
((group-by :client-id data) client))))
|
||||
(-> pnl-data
|
||||
(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]
|
||||
(update pnl-data :data (fn [data]
|
||||
((group-by :location data) location))))
|
||||
(-> pnl-data
|
||||
(update :data (fn [data]
|
||||
((group-by :location data) location)))
|
||||
(update :filters (fn [f]
|
||||
(assoc f :location location)))))
|
||||
|
||||
(defn filter-categories [pnl-data categories]
|
||||
(update pnl-data :data (fn [data]
|
||||
@@ -114,14 +120,22 @@
|
||||
(group-by best-category data))))))
|
||||
|
||||
(defn filter-period [pnl-data period]
|
||||
(update pnl-data :data (fn [data]
|
||||
((group-by :period data) period))))
|
||||
(-> pnl-data
|
||||
(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]
|
||||
(update pnl-data :data (fn [data]
|
||||
(filter
|
||||
#(<= from (:numeric-code %) to)
|
||||
data))))
|
||||
(-> pnl-data
|
||||
(update :data (fn [data]
|
||||
(filter
|
||||
#(<= from (:numeric-code %) to)
|
||||
data)))
|
||||
(update :filters (fn [f]
|
||||
(assoc f
|
||||
:from-numeric-code from
|
||||
:to-numeric-code to)))))
|
||||
|
||||
(defn negate [pnl-data types]
|
||||
(update pnl-data :data
|
||||
@@ -142,13 +156,16 @@
|
||||
|
||||
(defn subtotal-row [pnl-data title & [cell-args]]
|
||||
(into [{:value title
|
||||
:bold true}]
|
||||
:bold true
|
||||
:filters (:filters pnl-data)}]
|
||||
(map
|
||||
(fn [p]
|
||||
(merge
|
||||
{:format :dollar
|
||||
:value (aggregate-accounts (filter-period pnl-data p))}
|
||||
cell-args))
|
||||
(let [data (filter-period pnl-data p)]
|
||||
(merge
|
||||
{:format :dollar
|
||||
:value (aggregate-accounts data)
|
||||
:filters (:filters data)}
|
||||
cell-args)))
|
||||
(-> pnl-data :args :periods))))
|
||||
|
||||
(defn calc-percent-of-sales [table pnl-data]
|
||||
|
||||
Reference in New Issue
Block a user