more fixes.

This commit is contained in:
Bryce Covert
2019-10-01 07:12:56 -07:00
parent 70e5c84716
commit bf3ca63840
3 changed files with 33 additions and 28 deletions

View File

@@ -204,7 +204,7 @@
(re-frame/reg-event-fx
::investigate-clicked
(fn [{:keys [db] } [_ location from-numeric-code to-numeric-code which]]
(println from-numeric-code to-numeric-code)
{:db (assoc db
::ledger-list-active? true
::ledger-list-loading true)
@@ -298,25 +298,28 @@
])))
(defn overall-grouping [type title location]
(list
[:tr [:th.has-text-centered title]
[:td]
[:td]
[:td]]
(grouping {:accounts @(re-frame/subscribe [::accounts type location])
:location location
:groupings (type groupings)
:comparable-accounts @(re-frame/subscribe [::comparable-accounts-by-id type location])
})
[:tr [:th.has-text-centered title]
[:th.has-text-right [:a
{:on-click (dispatch-event [::investigate-clicked location nil nil :current])}
(->$ (reduce + 0 (map :amount @(re-frame/subscribe [::accounts type location]))))]]
[:th.has-text-right [:a
{:on-click (dispatch-event [::investigate-clicked location nil nil :comparable])}
(->$ (reduce + 0 (map :amount (vals @(re-frame/subscribe [::comparable-accounts-by-id type location])))))]]
[:th.has-text-right (->$ (- (reduce + 0 (map :amount @(re-frame/subscribe [::accounts type location])))
(reduce + 0 (map :amount (vals @(re-frame/subscribe [::comparable-accounts-by-id type location]))))))]]))
(let [accounts @(re-frame/subscribe [::accounts type location])
min-numeric-code (or (first (map :numeric-code accounts)) 0)
max-numeric-code (or (last (map :numeric-code accounts)) 0)]
(list
[:tr [:th.has-text-centered title]
[:td]
[:td]
[:td]]
(grouping {:accounts accounts
:location location
:groupings (type groupings)
:comparable-accounts @(re-frame/subscribe [::comparable-accounts-by-id type location])
})
[:tr [:th.has-text-centered title]
[:th.has-text-right [:a
{:on-click (dispatch-event [::investigate-clicked location min-numeric-code max-numeric-code :current])}
(->$ (reduce + 0 (map :amount @(re-frame/subscribe [::accounts type location]))))]]
[:th.has-text-right [:a
{:on-click (dispatch-event [::investigate-clicked location min-numeric-code max-numeric-code :comparable])}
(->$ (reduce + 0 (map :amount (vals @(re-frame/subscribe [::comparable-accounts-by-id type location])))))]]
[:th.has-text-right (->$ (- (reduce + 0 (map :amount @(re-frame/subscribe [::accounts type location])))
(reduce + 0 (map :amount (vals @(re-frame/subscribe [::comparable-accounts-by-id type location]))))))]])))
(def profit-and-loss-content
(with-meta