final fix.

This commit is contained in:
2022-11-16 11:27:57 -08:00
parent 2050c0da33
commit 4dff4cfb2a

View File

@@ -540,7 +540,8 @@
:description (or (:name (:vendor je))
(:alternate_description je))
:account (:account jel)
:location (:location jel)}))))))
:location (:location jel)})))))
(into []))
_ (swap! category-totals assoc-in [client-id location category]
(- (or (reduce + 0.0 (map #(or (:credit %) 0.0) all-journal-entries)) 0.0)
(or (reduce + 0.0 (map #(or (:debit %) 0.0) all-journal-entries)) 0.0)) )
@@ -575,8 +576,8 @@
:account {:name "Gross Profit"}
:journal_entries nil
:total (+ (get-in @category-totals [client-id location :sales] 0.0)
(- (get-in @category-totals [client-id location :cogs] 0.0))
(- (get-in @category-totals [client-id location :payroll] 0.0)))}
(get-in @category-totals [client-id location :cogs] 0.0)
(get-in @category-totals [client-id location :payroll] 0.0))}
{:client_id client-id
:location location
:account {:name "Overhead"}
@@ -589,8 +590,8 @@
:account {:name "Net Profit"}
:journal_entries nil
:total (+ (get-in @category-totals [client-id location :sales] 0.0)
(- (get-in @category-totals [client-id location :cogs] 0.0))
(- (get-in @category-totals [client-id location :payroll] 0.0))
(get-in @category-totals [client-id location :cogs] 0.0)
(get-in @category-totals [client-id location :payroll] 0.0)
(- (+ (get-in @category-totals [client-id location :controllable] 0.0)
(get-in @category-totals [client-id location :fixed-overhead] 0.0)
(get-in @category-totals [client-id location :ownership-controllable] 0.0))))}]]