customized transactions.

This commit is contained in:
Bryce Covert
2020-04-30 07:22:39 -07:00
parent 8043fb0b81
commit 4a6aeaab8f
18 changed files with 184 additions and 126 deletions

View File

@@ -173,40 +173,44 @@
(let [current-client @(re-frame/subscribe [::subs/client])
user @(re-frame/subscribe [::subs/user])
params @(re-frame/subscribe [::params])]
[:div.is-inline
[:h1.title "Balance Sheet"]
[: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
[:tr
[:td.has-text-right "Period ending"]
[:td.has-text-right (date->str (str->date (:date params) standard))]
[:td.has-text-right (when (:date params)
(date->str (t/minus (str->date (:date params) standard) (t/years 1))))]
[:td]]
(list
(overall-grouping :asset "Assets")
(overall-grouping :liability "Liabilities" )
(overall-grouping :equity "Owner's Equity" )
(retained-earnings))])
]))
(if current-client
[:div.is-inline
[:h1.title "Balance Sheet"]
[: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
[:tr
[:td.has-text-right "Period ending"]
[:td.has-text-right (date->str (str->date (:date params) standard))]
[:td.has-text-right (when (:date params)
(date->str (t/minus (str->date (:date params) standard) (t/years 1))))]
[:td]]
(list
(overall-grouping :asset "Assets")
(overall-grouping :liability "Liabilities" )
(overall-grouping :equity "Owner's Equity" )
(retained-earnings))])
]
[:div
[:h1.title "Balance sheet"]
[:h2.subtitle "Please choose a client first"]])))
{:component-will-mount #(re-frame/dispatch-sync [::params-change {:date (date->str (local-now) standard)}]) }))
(defn balance-sheet-page []

View File

@@ -132,7 +132,6 @@
(re-frame/reg-event-db
::error
(fn [db [_ [error]]]
(println (:message error))
(assoc db ::error (:message error)
::loading false)))
@@ -209,7 +208,6 @@
(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)

View File

@@ -25,6 +25,7 @@
(let [{:keys [sort]} @(re-frame/subscribe [::table-params])
{:keys [journal-entries start end count total]} @ledger-page
selected-client @(re-frame/subscribe [::subs/client])
accounts-by-id @(re-frame/subscribe [::subs/accounts-by-id selected-client])
percentage-size (if selected-client "25%" "33%")
opc (fn [e]
(re-frame/dispatch [::params-changed e]))]
@@ -114,7 +115,8 @@
(when status?
[:td status])]]
(for [{:keys [debit credit location account id]} line-items]
(for [{:keys [debit credit location account id]} line-items
:let [account (accounts-by-id (:id account))]]
^{:key id}
[:tr {:class (:class i)}
(when-not selected-client