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
|
(when-not @!box
|
||||||
(reset! !box el)))}]]))))
|
(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]}]
|
(defn pnl-report [{:keys [args report-data]}]
|
||||||
(let [pnl-data (->> report-data
|
(let [pnl-data (->> report-data
|
||||||
:periods
|
:periods
|
||||||
@@ -546,22 +562,20 @@ Please download it by clicking this link: " report-url)))
|
|||||||
[k (:name v)]))
|
[k (:name v)]))
|
||||||
(into {}))
|
(into {}))
|
||||||
pnl-data (l-reports/->PNLData args pnl-data client-names)
|
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
|
[:div
|
||||||
[:h1.title "Profit and Loss - " (str/join ", " (map :name (:clients args)))]
|
[:h1.title "Profit and Loss - " (str/join ", " (map :name (:clients args)))]
|
||||||
(when (:warning report)
|
(when (:warning report)
|
||||||
[:div.notification.is-warning.is-light
|
[:div.notification.is-warning.is-light
|
||||||
(:warning report)])
|
(:warning report)])
|
||||||
(for [[index table] (map vector (range) (concat (:summaries report)
|
[table->pdf {:widths (into [20] (take (dec (cell-count table))
|
||||||
(:details report)))]
|
(mapcat identity
|
||||||
^{:key index}
|
(repeat
|
||||||
[table->pdf {:widths (into [20] (take (dec (cell-count table))
|
(if (-> pnl-data :args :include-deltas)
|
||||||
(mapcat identity
|
[13 6 13]
|
||||||
(repeat
|
[13 6])))))
|
||||||
(if (-> pnl-data :args :include-deltas)
|
:table table}]]))
|
||||||
[13 6 13]
|
|
||||||
[13 6])))))
|
|
||||||
:table table}])]))
|
|
||||||
|
|
||||||
|
|
||||||
(defn profit-and-loss-content []
|
(defn profit-and-loss-content []
|
||||||
|
|||||||
Reference in New Issue
Block a user