From a538cffe6dd20ede2e38fc770e240e548e7cd51f Mon Sep 17 00:00:00 2001 From: Bryce Covert Date: Thu, 31 Mar 2022 07:27:56 -0700 Subject: [PATCH] forces things to line up. --- .../views/pages/ledger/profit_and_loss.cljs | 36 +++++++++++++------ 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/src/cljs/auto_ap/views/pages/ledger/profit_and_loss.cljs b/src/cljs/auto_ap/views/pages/ledger/profit_and_loss.cljs index c5b72be3..64f0cf75 100644 --- a/src/cljs/auto_ap/views/pages/ledger/profit_and_loss.cljs +++ b/src/cljs/auto_ap/views/pages/ledger/profit_and_loss.cljs @@ -530,6 +530,22 @@ Please download it by clicking this link: " report-url))) (when-not @!box (reset! !box el)))}]])))) +(defn concat-tables [tables] + (println (count tables)) + (let [[first & rest] tables] + {:header (:header first) + :rows (concat (:rows first) + [[]] + (mapcat + (fn [table] + (-> (:header table) + (into (:rows table)) + (conj [])) + #_(println "table 1" table) + #_[(:header table) + (:rows table)]) + rest))})) + (defn pnl-report [{:keys [args report-data]}] (let [pnl-data (->> report-data :periods @@ -546,22 +562,20 @@ Please download it by clicking this link: " report-url))) [k (:name v)])) (into {})) pnl-data (l-reports/->PNLData args pnl-data client-names) - report (l-reports/summarize-pnl pnl-data)] + report (l-reports/summarize-pnl pnl-data) + table (concat-tables (concat (:summaries report) (:details report)))] [:div [:h1.title "Profit and Loss - " (str/join ", " (map :name (:clients args)))] (when (:warning report) [:div.notification.is-warning.is-light (:warning report)]) - (for [[index table] (map vector (range) (concat (:summaries report) - (:details report)))] - ^{:key index} - [table->pdf {:widths (into [20] (take (dec (cell-count table)) - (mapcat identity - (repeat - (if (-> pnl-data :args :include-deltas) - [13 6 13] - [13 6]))))) - :table table}])])) + [table->pdf {:widths (into [20] (take (dec (cell-count table)) + (mapcat identity + (repeat + (if (-> pnl-data :args :include-deltas) + [13 6 13] + [13 6]))))) + :table table}]])) (defn profit-and-loss-content []