show unresolved transactions.
This commit is contained in:
@@ -108,6 +108,7 @@
|
||||
{:fields {:id {:type 'String}
|
||||
:amount {:type 'String}
|
||||
:location {:type 'String}
|
||||
:count {:type 'Int}
|
||||
:numeric_code {:type 'Int}
|
||||
:account_type {:type :account_type}
|
||||
:name {:type 'String}}}
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
|
||||
(conj acc (merge {:id (str account-id "-" location)
|
||||
:location (or location "")
|
||||
:count count
|
||||
:amount (if account-type (if (#{:account-type/asset
|
||||
:account-type/dividend
|
||||
:account-type/expense} account-type)
|
||||
|
||||
@@ -87,4 +87,4 @@
|
||||
(wrap-params)
|
||||
(mp/wrap-multipart-params)
|
||||
(wrap-edn-params)
|
||||
(wrap-gzip)))
|
||||
#_(wrap-gzip)))
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
[auto-ap.views.pages.data-page :as data-page]
|
||||
[vimsical.re-frame.fx.track :as track]
|
||||
[reagent.core :as reagent]
|
||||
[clojure.set :as set]))
|
||||
[clojure.set :as set]
|
||||
[clojure.string :as str]))
|
||||
(def ranges
|
||||
{:sales [40000 49999]
|
||||
:cogs [50000 59999]
|
||||
@@ -75,6 +76,16 @@
|
||||
(<= (get-in ranges [type 0]) numeric-code (get-in ranges [type 1])))))
|
||||
(sort-by :numeric-code))))
|
||||
|
||||
(re-frame/reg-sub
|
||||
::uncategorized-accounts
|
||||
(fn [db [_ ]]
|
||||
|
||||
(->> (get-in db [::report :periods ])
|
||||
(mapcat :accounts)
|
||||
(map #(update % :amount js/parseFloat))
|
||||
(filter (fn [{:keys [account-type location numeric-code]}]
|
||||
(nil? numeric-code))))))
|
||||
|
||||
(defn parse-amounts [period]
|
||||
(update period :accounts (fn [a]
|
||||
(map #(update % :amount js/parseFloat) a))))
|
||||
@@ -173,7 +184,7 @@
|
||||
{:client-id (:id c)
|
||||
:periods (mapv (fn [[start end] ] {:start (date->str start standard) :end (date->str end standard)} )
|
||||
(:periods params))}
|
||||
[[:periods [[:accounts [:name :amount :account-type :id :numeric-code :location]]]]]]]}
|
||||
[[:periods [[:accounts [:name :amount :account-type :id :count :numeric-code :location]]]]]]]}
|
||||
:on-success [::received]}))))))
|
||||
|
||||
|
||||
@@ -482,7 +493,8 @@
|
||||
status @(re-frame/subscribe [::status/single ::page])
|
||||
params @(re-frame/subscribe [::params])
|
||||
period-inputs @(re-frame/subscribe [::period-inputs])
|
||||
periods @(re-frame/subscribe [::periods])]
|
||||
periods @(re-frame/subscribe [::periods])
|
||||
unresolved-accounts @(re-frame/subscribe [::uncategorized-accounts]) ]
|
||||
|
||||
(if-not current-client
|
||||
[:div
|
||||
@@ -690,6 +702,13 @@
|
||||
[status/big-loader status]
|
||||
(when (not= :loading (:state status))
|
||||
[:div
|
||||
(when (seq unresolved-accounts)
|
||||
[:div.notification.is-warning.is-light
|
||||
"This report does not include " (str/join ", "
|
||||
(map #(str (:count %) " unresolved ledger entries for " (if (str/blank? (:location %))
|
||||
" all locations"
|
||||
(:location %)))
|
||||
unresolved-accounts))])
|
||||
[:<>
|
||||
(for [location @(re-frame/subscribe [::locations])]
|
||||
^{:key (str location "-summary")}
|
||||
|
||||
Reference in New Issue
Block a user