forces things to line up.
This commit is contained in:
@@ -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 []
|
||||
|
||||
Reference in New Issue
Block a user