diff --git a/src/clj/auto_ap/graphql/ledger.clj b/src/clj/auto_ap/graphql/ledger.clj index 54644c71..bfa31936 100644 --- a/src/clj/auto_ap/graphql/ledger.clj +++ b/src/clj/auto_ap/graphql/ledger.clj @@ -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))))}]]