Improves balance sheet, starts moving it to new layout
This commit is contained in:
@@ -808,14 +808,19 @@
|
||||
{:value "+/-"}]))))))))
|
||||
|
||||
(defn append-deltas [table]
|
||||
(->> table
|
||||
(map (fn [[title a b]]
|
||||
[title a b (and (:value a) (:value b)
|
||||
(number? (:value a)) (number? (:value b))
|
||||
{:border (:border b)
|
||||
:format :dollar
|
||||
:value (- (doto (or (:value a) 0.0) println)
|
||||
(doto (or (:value b) 0.0) println))})]))))
|
||||
(->> table
|
||||
(map (fn [[title & pairs]]
|
||||
(reduce
|
||||
(fn [result [ a b]]
|
||||
(into result
|
||||
[a b (and (:value a) (:value b)
|
||||
(number? (:value a)) (number? (:value b))
|
||||
{:border (:border b)
|
||||
:format :dollar
|
||||
:value (- (or (:value a) 0.0)
|
||||
(or (:value b) 0.0))})]))
|
||||
[title]
|
||||
(partition 2 pairs))))))
|
||||
|
||||
|
||||
#_(defn summarize-balance-sheet [pnl-data]
|
||||
@@ -867,8 +872,7 @@
|
||||
p (:periods (:args pnl-data))]
|
||||
(-> pnl-data
|
||||
(filter-client client-id)
|
||||
(filter-period p))
|
||||
)]
|
||||
(filter-period p)))]
|
||||
(let [table (-> []
|
||||
(into (detail-rows pnl-datas
|
||||
:assets
|
||||
@@ -880,11 +884,11 @@
|
||||
:equities
|
||||
"Owner's Equity"))
|
||||
(conj (subtotal-by-column-row
|
||||
(map #(-> %
|
||||
(filter-categories [:sales :cogs :payroll :controllable :fixed-overhead :ownership-controllable])
|
||||
(negate #{:cogs :payroll :controllable :fixed-overhead :ownership-controllable}))
|
||||
pnl-datas)
|
||||
"Retained Earnings")))
|
||||
(map #(-> %
|
||||
(filter-categories [:sales :cogs :payroll :controllable :fixed-overhead :ownership-controllable])
|
||||
(negate #{:cogs :payroll :controllable :fixed-overhead :ownership-controllable}))
|
||||
pnl-datas)
|
||||
"Retained Earnings")))
|
||||
table (if (:include-comparison (:args pnl-data))
|
||||
(append-deltas table)
|
||||
table)]
|
||||
|
||||
Reference in New Issue
Block a user