Improves balance sheet, starts moving it to new layout

This commit is contained in:
2024-10-11 20:36:23 -07:00
parent d41837db83
commit 427f50fb6b
9 changed files with 212 additions and 1194 deletions

View File

@@ -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)]