Revert "Adds beginning of cash flows"

This reverts commit a9f71ef3f3.
This commit is contained in:
2022-12-10 13:49:23 -08:00
parent 2d3b796793
commit ff18d637ed
7 changed files with 2070 additions and 656 deletions

View File

@@ -37,7 +37,6 @@
"yodlee2" :yodlee2
"ledger/" {"" :ledger
"profit-and-loss" :profit-and-loss
"cash-flows" :cash-flows
"profit-and-loss-detail" :profit-and-loss-detail
"balance-sheet" :balance-sheet
"external" :external-ledger

View File

@@ -30,11 +30,7 @@
:payroll [60000 69999]
:controllable [70000 79999]
:fixed-overhead [80000 89999]
:ownership-controllable [90000 99999]
:operating-activities [10000 99999]
:investment-activities [10000 99999]
:financing-activities [10000 99999]
:bottom-line [10000 99999]})
:ownership-controllable [90000 99999]})
(def groupings
{:assets [["1100 Cash and Bank Accounts" 11000 11999]
@@ -85,16 +81,7 @@
["94000-96000 Other Owner Controllable Costs" 94000 95999]
["96000 Depreciation" 96000 96999]
["97000 Taxes" 97000 97999]
["98000 Other Expenses" 98000 98999]]
:operating-activities [["12000-14000 Accounts Receivable" 12000 13999]
["21000-28000 Accounts Payable" 21000 27999]
["96000-97000 Amortization" 96000 96999]]
:investment-activities [["14000-18000 Investments" 14000 17999]]
:financing-activities [["28000-35000 Financing Activities" 28000 34999]
["35001-40000 Other" 35001 39999]]
:bottom-line [["11000-12000 Bottom Line" 11000 11999]]})
["98000 Other Expenses" 98000 98999]]})
(defn in-range? [code]
(if code
@@ -459,67 +446,6 @@
{:header (headers pnl-datas title)
:rows (combine-tables pnl-datas table percent-of-sales deltas)}))
(defn cash-flows-location-detail-table [pnl-datas #_client-datas title prefix]
(let [table (-> []
(into (detail-rows pnl-datas
:operating-activities
(str prefix " Operating Activities")))
(into (detail-rows pnl-datas
:investment-activities
(str prefix " Investment Activities")))
(into (detail-rows pnl-datas
:financing-activities
(str prefix " Financing Activities")))
(into (detail-rows pnl-datas
:bottom-line
(str prefix " Bottom Line")))
#_(into (detail-rows pnl-datas
:cogs
(str prefix " COGS")))
#_(into (detail-rows
pnl-datas
:payroll
(str prefix " Payroll")))
#_(conj (subtotal-by-column-row (map #(filter-categories % [:payroll :cogs])
pnl-datas)
(str prefix " Prime Costs")))
#_(conj (subtotal-by-column-row (map #(-> %
(filter-categories [:sales :payroll :cogs])
(negate #{:payroll :cogs}))
pnl-datas)
(str prefix " Gross Profits")))
#_(into (detail-rows
pnl-datas
:controllable
(str prefix " Controllable Expenses")))
#_(into (detail-rows
pnl-datas
:fixed-overhead
(str prefix " Fixed Overhead")))
#_(into (detail-rows
pnl-datas
:ownership-controllable
(str prefix " Ownership Controllable")))
#_(conj (subtotal-by-column-row (map #(filter-categories % [:controllable :fixed-overhead :ownership-controllable]) pnl-datas)
(str prefix " Overhead")))
#_(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)
(str prefix " Net Income"))))
#_table #_(if (seq client-datas)
(conj table (subtotal-by-column-row (map #(-> %
(filter-categories [:sales :cogs :payroll :controllable :fixed-overhead :ownership-controllable])
(negate #{:cogs :payroll :controllable :fixed-overhead :ownership-controllable}))
client-datas)
"All Location Net Income"))
table)
percent-of-sales (calc-percent-of-sales table pnl-datas)
deltas (into [] (calc-deltas table))]
{:header (headers pnl-datas title)
:rows (combine-tables pnl-datas table percent-of-sales deltas)}))
(defn warning-message [pnl-data]
(let [errors (->> pnl-data
:data
@@ -587,36 +513,6 @@
(str (-> pnl-data :clients-by-id (get client-id)) " (" location ") Detail")
location))))})
(defn summarize-cash-flows [pnl-data]
(let [client-ids (->> (client-locations pnl-data)
(map first)
set)]
{:warning (warning-message pnl-data)
:details
(doall (if (-> pnl-data :args :column-per-location)
[(cash-flows-location-detail-table (mapcat identity (for [[period i] (map vector (-> pnl-data :args :periods ) (range))]
(concat
(for [[client-id location] (client-locations pnl-data)]
(-> pnl-data
(filter-client client-id)
(filter-location location)
(filter-period period)
(zebra i)))
[(-> pnl-data
(filter-period period)
(zebra i))])))
"All location Detail"
"")]
(for [client-id client-ids]
(cash-flows-location-detail-table (for [[period i] (map vector (-> pnl-data :args :periods ) (range))]
(-> pnl-data
(filter-client client-id)
(filter-location "A")
(filter-period period)
(zebra i)))
(str (-> pnl-data :clients-by-id (get client-id)) " Detail")
""))))}))
(defn balance-sheet-headers [pnl-data]
[(cond-> [{:value "Period Ending"}