huge number of changes to start making all usages of expense accounts dynamic.
This commit is contained in:
@@ -54,17 +54,13 @@
|
||||
(take 5))
|
||||
top-5 (vec (take 5 expense-account-stats))
|
||||
rest (drop 5 expense-account-stats)
|
||||
other {:expense-account-id 0 :expense-account-name "Other" :total (reduce + 0 (map :total rest))}]
|
||||
other {:account {:id 0 :name "Other"} :total (reduce + 0 (map :total rest))}]
|
||||
(cond-> db
|
||||
(seq top-5)
|
||||
(assoc ::top-expense-categories (conj top-5 other))
|
||||
|
||||
(seq invoice-stats)
|
||||
(assoc ::invoice-stats invoice-stats)
|
||||
|
||||
|
||||
)
|
||||
)))
|
||||
(assoc ::invoice-stats invoice-stats)))))
|
||||
|
||||
(re-frame/reg-sub
|
||||
::invoice-stats
|
||||
@@ -84,7 +80,7 @@
|
||||
:graphql {:token (-> db :user)
|
||||
:query-obj {:venia/queries [[:expense_account_stats
|
||||
{:client-id (:id @(re-frame/subscribe [::subs/client]))}
|
||||
[:expense-account-id :total :expense-account-name]]
|
||||
[[:account [:id :name]] :total]]
|
||||
[:invoice_stats
|
||||
{:client-id (:id @(re-frame/subscribe [::subs/client]))}
|
||||
[:name :paid :unpaid]]]}
|
||||
@@ -98,7 +94,7 @@
|
||||
[:h1.title.is-4 "Top expense categories"]
|
||||
(let [expense-categories @(re-frame/subscribe [::top-expense-categories])]
|
||||
(make-pie-chart {:width 800 :height 500 :data (clj->js
|
||||
(map (fn [x] {:name (:expense-account-name x) :value (:total x)}) expense-categories))}))
|
||||
(map (fn [x] {:name (:name (:account x)) :value (:total x)}) expense-categories))}))
|
||||
[:h1.title.is-4 "Upcoming Bills"]
|
||||
(make-bar-chart {:width 800 :height 500 :data (clj->js
|
||||
@(re-frame/subscribe [::invoice-stats]))})]}]))
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
(on-params-change (merge @params p)))}]
|
||||
"Showing " (inc start) "-" end "/" total
|
||||
|
||||
[:table.table.is-fullwidth
|
||||
[:table.table.is-fullwidth.compact
|
||||
[:thead
|
||||
[:tr
|
||||
(when-not selected-client
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
(fn [{:keys [db]} [_ edit-completed]]
|
||||
(when @(re-frame/subscribe [::can-submit])
|
||||
(let [{{:keys [id vendor-id account-id]} :data :as data} @(re-frame/subscribe [::forms/form ::edit-transaction])]
|
||||
(println "DATA" data)
|
||||
{:db (forms/loading db ::edit-transaction )
|
||||
:graphql
|
||||
{:token (-> db :user)
|
||||
|
||||
@@ -32,9 +32,9 @@
|
||||
[:client [:id :name :locations]]
|
||||
[:payments [:amount [:payment [:amount :s3_url :check_number ]]]]
|
||||
[:vendor [:id :name]]
|
||||
[:expense_accounts [:amount :id :expense_account_id
|
||||
[:expense_accounts [:amount :id
|
||||
:location
|
||||
[:expense_account [:id :name [:parent [:id :name]]]]]]])
|
||||
[:account [:id :numeric-code :name :location]]]]])
|
||||
|
||||
(defn does-amount-exceed-outstanding? [amount outstanding-balance]
|
||||
(let [amount (js/parseFloat amount)
|
||||
@@ -819,10 +819,10 @@
|
||||
[:div
|
||||
[:h2.subtitle "Expense Accounts"]
|
||||
|
||||
(for [[index {:keys [id location expense-account-id] :as expense-account}] (map vector (range) (:expense-accounts data))]
|
||||
(for [[index {:keys [id location] :as expense-account {account-id :id account-numeric-code :numeric-code account-name :name} :account}] (map vector (range) (:expense-accounts data))]
|
||||
^{:key id}
|
||||
[:div.columns
|
||||
[:div.column expense-account-id " - "(-> expense-account-id expense-accounts/expense-accounts :name)]
|
||||
[:div.column account-numeric-code " - " account-name]
|
||||
|
||||
(when multi-location?
|
||||
[:div.column location])
|
||||
|
||||
Reference in New Issue
Block a user