From 91adf49e2a635dbdd54bc2b7482b089617212572 Mon Sep 17 00:00:00 2001 From: Bryce Covert Date: Mon, 24 Oct 2022 23:18:55 -0700 Subject: [PATCH] one more tweak. --- src/clj/auto_ap/graphql/ledger.clj | 2 +- src/cljc/auto_ap/ledger/reports.cljc | 43 ++++++++++++++-------------- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/src/clj/auto_ap/graphql/ledger.clj b/src/clj/auto_ap/graphql/ledger.clj index 911995f7..99ff72fe 100644 --- a/src/clj/auto_ap/graphql/ledger.clj +++ b/src/clj/auto_ap/graphql/ledger.clj @@ -553,7 +553,7 @@ :client_id client-id :location location :account (or account - {:name category}) + (str "All " {:name (name category)})) :journal_entries (when account (sort-by :date journal-entries)) :total (- (or (reduce + 0.0 (map #(or (:credit %) 0.0) journal-entries)) 0.0) (or (reduce + 0.0 (map #(or (:debit %) 0.0) journal-entries)) 0.0))})}) diff --git a/src/cljc/auto_ap/ledger/reports.cljc b/src/cljc/auto_ap/ledger/reports.cljc index 609ee093..67f2a28c 100644 --- a/src/cljc/auto_ap/ledger/reports.cljc +++ b/src/cljc/auto_ap/ledger/reports.cljc @@ -565,33 +565,34 @@ (fn [rows category] (into rows ;; TODO colspan ? - (concat [[{:value (str (client-codes (:client-id category)) " - " (:location category) " - " (name (:category category)) " - " (:name (:account category)) ) + (concat (when (seq (:journal-entries category)) + [[{:value (str (client-codes (:client-id category)) " - " (:location category) " - " (name (:category category)) " - " (:name (:account category)) ) + + } + {:value "Total"} + {:value ""} + {:value ""} + {:value (:total category) + :format :dollar}]]) + (map + (fn [je] + [{:value (user-friendly-date (:date je))} + {:value (:description je "")} + {:value (get je :debit) + :format :dollar} + {:value (get je :credit) + :format :dollar} + {:value (get je :running-balance) + :format :dollar}]) + (:journal-entries category)) + [[{:value (str (client-codes (:client-id category)) " - " (:location category) " - " (name (:category category)) " - " (:name (:account category)) ) } {:value "Total"} {:value ""} {:value ""} {:value (:total category) - :format :dollar}]] - (map - (fn [je] - [{:value (user-friendly-date (:date je))} - {:value (:description je "")} - {:value (get je :debit) - :format :dollar} - {:value (get je :credit) - :format :dollar} - {:value (get je :running-balance) - :format :dollar}]) - (:journal-entries category)) - [[{:value (str (client-codes (:client-id category)) " - " (:location category) " - " (name (:category category)) " - " (:name (:account category)) ) - - } - {:value "Total"} - {:value ""} - {:value ""} - {:value (:total category) - :format :dollar}]])) + :format :dollar}]])) ) []