Fixes P&L page to allow for specific locatiosn
This commit is contained in:
@@ -98,6 +98,11 @@
|
|||||||
:where ['[?li :journal-entry-line/location ?location]]}
|
:where ['[?li :journal-entry-line/location ?location]]}
|
||||||
:args [(:location args)]})
|
:args [(:location args)]})
|
||||||
|
|
||||||
|
(not-empty (:locations args))
|
||||||
|
(merge-query {:query {:in ['[?location ...]]
|
||||||
|
:where ['[?li :journal-entry-line/location ?location]]}
|
||||||
|
:args [(:locations args)]})
|
||||||
|
|
||||||
(limited-clients (:id args))
|
(limited-clients (:id args))
|
||||||
(merge-query {:query {:in ['[?xx ...]]
|
(merge-query {:query {:in ['[?xx ...]]
|
||||||
:where ['[?e :journal-entry/client ?xx]]}
|
:where ['[?e :journal-entry/client ?xx]]}
|
||||||
|
|||||||
@@ -821,6 +821,7 @@
|
|||||||
:bank_account_id {:type :id}
|
:bank_account_id {:type :id}
|
||||||
:date_range {:type :date_range}
|
:date_range {:type :date_range}
|
||||||
:location {:type 'String}
|
:location {:type 'String}
|
||||||
|
:locations {:type '(list String)}
|
||||||
:numeric_code {:type '(list :numeric_code_range)}
|
:numeric_code {:type '(list :numeric_code_range)}
|
||||||
:start {:type 'Int}
|
:start {:type 'Int}
|
||||||
:per_page {:type 'Int}
|
:per_page {:type 'Int}
|
||||||
|
|||||||
@@ -212,6 +212,11 @@
|
|||||||
(update :filters (fn [f]
|
(update :filters (fn [f]
|
||||||
(assoc f :location location)))))
|
(assoc f :location location)))))
|
||||||
|
|
||||||
|
(defn filter-locations [pnl-data locations]
|
||||||
|
(-> pnl-data
|
||||||
|
(update :filters (fn [f]
|
||||||
|
(assoc f :locations locations)))))
|
||||||
|
|
||||||
(defn filter-numeric-code [pnl-data from to]
|
(defn filter-numeric-code [pnl-data from to]
|
||||||
(-> pnl-data
|
(-> pnl-data
|
||||||
(update :data (fn [data]
|
(update :data (fn [data]
|
||||||
@@ -706,7 +711,8 @@
|
|||||||
(filter-location location)
|
(filter-location location)
|
||||||
(filter-period period)
|
(filter-period period)
|
||||||
(zebra i)))
|
(zebra i)))
|
||||||
[(zebra (filter-period pnl-data period) i)])))
|
[(zebra (filter-locations (filter-period pnl-data period)
|
||||||
|
(map second (client-locations pnl-data))) i)])))
|
||||||
"All location Summary")]
|
"All location Summary")]
|
||||||
(for [[client-id location] (client-locations pnl-data)]
|
(for [[client-id location] (client-locations pnl-data)]
|
||||||
(location-summary-table (for [[period i] (map vector (-> pnl-data :args :periods ) (range))]
|
(location-summary-table (for [[period i] (map vector (-> pnl-data :args :periods ) (range))]
|
||||||
@@ -728,6 +734,7 @@
|
|||||||
(zebra i)))
|
(zebra i)))
|
||||||
[(-> pnl-data
|
[(-> pnl-data
|
||||||
(filter-period period)
|
(filter-period period)
|
||||||
|
(filter-locations (map second (client-locations pnl-data)))
|
||||||
(zebra i))])))
|
(zebra i))])))
|
||||||
nil
|
nil
|
||||||
"All location Detail"
|
"All location Detail"
|
||||||
@@ -743,6 +750,7 @@
|
|||||||
(-> pnl-data
|
(-> pnl-data
|
||||||
(filter-client client-id)
|
(filter-client client-id)
|
||||||
(filter-period period)
|
(filter-period period)
|
||||||
|
(filter-locations (map second (client-locations pnl-data)))
|
||||||
(zebra i)))
|
(zebra i)))
|
||||||
(str (-> pnl-data :clients-by-id (get client-id)) " (" location ") Detail")
|
(str (-> pnl-data :clients-by-id (get client-id)) " (" location ") Detail")
|
||||||
location))))})
|
location))))})
|
||||||
|
|||||||
@@ -172,6 +172,7 @@ NOTE: Please review the transactions we may have question for you here: https://
|
|||||||
:client-id (:client-id params)
|
:client-id (:client-id params)
|
||||||
:numeric-code (:numeric-code params)
|
:numeric-code (:numeric-code params)
|
||||||
:location (:location params)
|
:location (:location params)
|
||||||
|
:locations (:locations params)
|
||||||
:date-range (:date-range params)}))
|
:date-range (:date-range params)}))
|
||||||
|
|
||||||
(re-frame/reg-event-fx
|
(re-frame/reg-event-fx
|
||||||
@@ -206,12 +207,13 @@ NOTE: Please review the transactions we may have question for you here: https://
|
|||||||
|
|
||||||
(re-frame/reg-event-fx
|
(re-frame/reg-event-fx
|
||||||
::investigate-clicked
|
::investigate-clicked
|
||||||
(fn [{:keys [db]} [_ {:keys [location numeric-code client-id]
|
(fn [{:keys [db]} [_ {:keys [location numeric-code client-id locations]
|
||||||
{:keys [start end]} :date-range}]]
|
{:keys [start end]} :date-range}]]
|
||||||
{:db (-> db (assoc ::ledger-list-active? true))
|
{:db (-> db (assoc ::ledger-list-active? true))
|
||||||
:dispatch [::data-page/additional-params-changed ::ledger {:client-id client-id
|
:dispatch [::data-page/additional-params-changed ::ledger {:client-id client-id
|
||||||
:numeric-code numeric-code
|
:numeric-code numeric-code
|
||||||
:location location
|
:location location
|
||||||
|
:locations locations
|
||||||
:date-range {:start (date->str start standard)
|
:date-range {:start (date->str start standard)
|
||||||
:end (date->str end standard)}}]}))
|
:end (date->str end standard)}}]}))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user