unifying reports even more.

This commit is contained in:
2022-03-29 18:02:13 -07:00
parent c9943bbae1
commit 17fde0dd16
3 changed files with 131 additions and 139 deletions

View File

@@ -167,31 +167,31 @@
report (l-reports/summarize-pnl pnl-data)
output-stream (ByteArrayOutputStream.)]
(pdf/pdf
(into
[{:left-margin 10 :right-margin 10 :top-margin 15 :bottom-margin 15
:size (cond
(and (>= (count (-> pnl-data :args :periods)) 8 )
(-> pnl-data :args :include-deltas))
:a2
(-> [{:left-margin 10 :right-margin 10 :top-margin 15 :bottom-margin 15
:size (cond
(and (>= (count (-> pnl-data :args :periods)) 8 )
(-> pnl-data :args :include-deltas))
:a2
(>= (count (-> pnl-data :args :periods)) 4 )
:tabloid
:else
:letter)
:orientation :landscape
:font {:size 6
:ttf-name "fonts/calibri-light.ttf"}}
[:heading (str "Profit and Loss - " (str/join ", " (map :client/name clients)))]]
(for [table (concat (:summaries report)
(:details report))]
(table->pdf table
(into [20] (take (dec (cell-count table))
(mapcat identity
(repeat
(if (-> pnl-data :args :include-deltas)
[13 6 13]
[13 6]))))))))
(>= (count (-> pnl-data :args :periods)) 4 )
:tabloid
:else
:letter)
:orientation :landscape
:font {:size 6
:ttf-name "fonts/calibri-light.ttf"}}
[:heading (str "Profit and Loss - " (str/join ", " (map :client/name clients)))]]
(conj [:paragraph {:color [128 0 0] :size 9} (:warning report)])
(into
(for [table (concat (:summaries report)
(:details report))]
(table->pdf table
(into [20] (take (dec (cell-count table))
(mapcat identity
(repeat
(if (-> pnl-data :args :include-deltas)
[13 6 13]
[13 6])))))))))
output-stream)
(.toByteArray output-stream)))