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]]}
|
||||
: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))
|
||||
(merge-query {:query {:in ['[?xx ...]]
|
||||
:where ['[?e :journal-entry/client ?xx]]}
|
||||
|
||||
@@ -821,6 +821,7 @@
|
||||
:bank_account_id {:type :id}
|
||||
:date_range {:type :date_range}
|
||||
:location {:type 'String}
|
||||
:locations {:type '(list String)}
|
||||
:numeric_code {:type '(list :numeric_code_range)}
|
||||
:start {:type 'Int}
|
||||
:per_page {:type 'Int}
|
||||
|
||||
@@ -212,6 +212,11 @@
|
||||
(update :filters (fn [f]
|
||||
(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]
|
||||
(-> pnl-data
|
||||
(update :data (fn [data]
|
||||
@@ -706,7 +711,8 @@
|
||||
(filter-location location)
|
||||
(filter-period period)
|
||||
(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")]
|
||||
(for [[client-id location] (client-locations pnl-data)]
|
||||
(location-summary-table (for [[period i] (map vector (-> pnl-data :args :periods ) (range))]
|
||||
@@ -728,6 +734,7 @@
|
||||
(zebra i)))
|
||||
[(-> pnl-data
|
||||
(filter-period period)
|
||||
(filter-locations (map second (client-locations pnl-data)))
|
||||
(zebra i))])))
|
||||
nil
|
||||
"All location Detail"
|
||||
@@ -743,6 +750,7 @@
|
||||
(-> pnl-data
|
||||
(filter-client client-id)
|
||||
(filter-period period)
|
||||
(filter-locations (map second (client-locations pnl-data)))
|
||||
(zebra i)))
|
||||
(str (-> pnl-data :clients-by-id (get client-id)) " (" location ") Detail")
|
||||
location))))})
|
||||
|
||||
@@ -172,6 +172,7 @@ NOTE: Please review the transactions we may have question for you here: https://
|
||||
:client-id (:client-id params)
|
||||
:numeric-code (:numeric-code params)
|
||||
:location (:location params)
|
||||
:locations (:locations params)
|
||||
:date-range (:date-range params)}))
|
||||
|
||||
(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
|
||||
::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}]]
|
||||
{:db (-> db (assoc ::ledger-list-active? true))
|
||||
:dispatch [::data-page/additional-params-changed ::ledger {:client-id client-id
|
||||
:numeric-code numeric-code
|
||||
:location location
|
||||
:locations locations
|
||||
:date-range {:start (date->str start standard)
|
||||
:end (date->str end standard)}}]}))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user