ledger fixes
This commit is contained in:
@@ -57,14 +57,17 @@
|
||||
["1300 Inventory" 1300 1399]
|
||||
["1400 Prepaid Expenses" 1400 1499]
|
||||
["1500 Property and Equipment" 1500 1599]
|
||||
["1600 Intangible Assets" 1600 1699]]
|
||||
:liability [["2100 Accounts Payable" 2100 2399]
|
||||
["1600 Intangible Assets" 1600 1699]
|
||||
["1700 Other Assets" 1700 1999]]
|
||||
:liability [["2000 Accounts Payable" 2000 2399]
|
||||
["2400 Accrued Expenses" 2400 2499]
|
||||
["2500 Other Liabilities" 2500 2599]
|
||||
["2600 Split Accounts" 2600 2699]
|
||||
["2700 Current Portion of Long-Term Debt" 2700 2799]
|
||||
["2800 Notes Payable" 2800 3000]
|
||||
]})
|
||||
]
|
||||
:equity [["3000 Owner's Equity" 3000 3999]]
|
||||
:revenue [["Retained Earnings" 4000 9999]]})
|
||||
|
||||
(re-frame/reg-event-db
|
||||
::received
|
||||
@@ -82,6 +85,7 @@
|
||||
::params-change
|
||||
(fn [cofx [_ params]]
|
||||
{:db (-> (:db cofx)
|
||||
(assoc-in [::error] nil)
|
||||
(assoc-in [::loading] true)
|
||||
(assoc-in [::params] params))
|
||||
:graphql {:token (-> cofx :db :user)
|
||||
@@ -145,6 +149,24 @@
|
||||
[:th.has-text-right (->$ (- (reduce + 0 (map :amount @(re-frame/subscribe [::accounts type])))
|
||||
(reduce + 0 (map :amount (vals @(re-frame/subscribe [::comparable-accounts-by-id type]))))))]]))
|
||||
|
||||
|
||||
(defn retained-earnings []
|
||||
|
||||
(list
|
||||
|
||||
#_(grouping {:accounts @(re-frame/subscribe [::accounts type])
|
||||
:comparable-accounts @(re-frame/subscribe [::comparable-accounts-by-id type])
|
||||
})
|
||||
[:tr [:th.has-text-centered "Retained Earnings"]
|
||||
[:th.has-text-right (->$ (- (reduce + 0 (map :amount @(re-frame/subscribe [::accounts :revenue])))
|
||||
(reduce + 0 (map :amount @(re-frame/subscribe [::accounts :expense])))))]
|
||||
[:th.has-text-right (->$ (- (reduce + 0 (map :amount (vals @(re-frame/subscribe [::comparable-accounts-by-id :revenue]))))
|
||||
(reduce + 0 (map :amount (vals @(re-frame/subscribe [::comparable-accounts-by-id :expense]))))))]
|
||||
[:th.has-text-right (->$ (- (- (reduce + 0 (map :amount @(re-frame/subscribe [::accounts :revenue])))
|
||||
(reduce + 0 (map :amount @(re-frame/subscribe [::accounts :expense]))))
|
||||
(- (reduce + 0 (map :amount (vals @(re-frame/subscribe [::comparable-accounts-by-id :revenue]))))
|
||||
(reduce + 0 (map :amount (vals @(re-frame/subscribe [::comparable-accounts-by-id :expense])))))))]]))
|
||||
|
||||
(def balance-sheet-content
|
||||
(with-meta
|
||||
(fn []
|
||||
@@ -153,20 +175,21 @@
|
||||
params @(re-frame/subscribe [::params])]
|
||||
[:div.is-inline
|
||||
[:h1.title "Balance Sheet"]
|
||||
[:p.help "Date"]
|
||||
[bind-field
|
||||
[date-picker {:class-name "input"
|
||||
:class "input"
|
||||
:format-week-number (fn [] "")
|
||||
:previous-month-button-label ""
|
||||
:placeholder "mm/dd/yyyy"
|
||||
:next-month-button-label ""
|
||||
:next-month-label ""
|
||||
:type "date"
|
||||
:field [:date]
|
||||
:event [::date-picked]
|
||||
:popper-props (clj->js {:placement "right"})
|
||||
:subscription params}]]
|
||||
[:div.report-controls
|
||||
[:p.help "Date"]
|
||||
[bind-field
|
||||
[date-picker {:class-name "input"
|
||||
:class "input"
|
||||
:format-week-number (fn [] "")
|
||||
:previous-month-button-label ""
|
||||
:placeholder "mm/dd/yyyy"
|
||||
:next-month-button-label ""
|
||||
:next-month-label ""
|
||||
:type "date"
|
||||
:field [:date]
|
||||
:event [::date-picked]
|
||||
:popper-props (clj->js {:placement "right"})
|
||||
:subscription params}]]]
|
||||
(if @(re-frame/subscribe [::loading])
|
||||
[:div [:i.icon.fa.fa-spin.fa-spinner]]
|
||||
[:table.table.compact.balance-sheet
|
||||
@@ -179,7 +202,8 @@
|
||||
(list
|
||||
(overall-grouping :asset "Assets")
|
||||
(overall-grouping :liability "Liabilities" )
|
||||
(overall-grouping :equity "Owner's Equity" ))])
|
||||
(overall-grouping :equity "Owner's Equity" )
|
||||
(retained-earnings))])
|
||||
|
||||
|
||||
]))
|
||||
|
||||
Reference in New Issue
Block a user