pnl changes

This commit is contained in:
2026-01-03 22:44:58 -08:00
parent 269fa45923
commit 8511d30715

View File

@@ -221,27 +221,37 @@
"Profit and loss"))
(defn make-profit-and-loss-pdf [request report]
(let [ output-stream (ByteArrayOutputStream.)
(let [output-stream (ByteArrayOutputStream.)
date (:periods (:form-params request))
table (concat-tables (:details report))]
(pdf/pdf
(-> [{:left-margin 10 :right-margin 10 :top-margin 15 :bottom-margin 15
:size :letter
:font {:size 6
:ttf-name "fonts/calibri-light.ttf"}}
[:heading (str "Balance Sheet - " (str/join ", " (map :client/name (seq (:client (:form-params request))))))]]
(-> [{:left-margin 10 :right-margin 10 :top-margin 15 :bottom-margin 15
:size :letter
:font {:size 6
:ttf-name "fonts/calibri-light.ttf"}}
[:heading (str "Profit and Loss - " (str/join ", " (map :client/name (seq (:client (:form-params request))))))]]
(conj [:paragraph {:color [128 0 0] :size 9} (:warning report)
])
(conj
(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 (-> (:form-params request) :include-deltas)
[13 6 13]
[13 6]))))))))
output-stream)
(mapcat identity
(repeat
(if (-> (:form-params request) :include-deltas)
[13 6 13]
[13 6]))))))))
#_(conj
(table->pdf table
(into [20] (take (dec (cell-count table))
(mapcat identity
(repeat
(if (-> (:form-params request) :include-deltas)
[13 6 13]
[13 6]))))))))
output-stream)
(.toByteArray output-stream)))
(defn join-names [client-ids]
@@ -252,7 +262,7 @@
(:date (:query-params request))
atime/iso-date)
name (->> request :query-params :client (map :db/id) join-names)]
(format "Balance-sheet-%s-for-%s" date name)))
(format "Profit-and-loss-%s-for-%s" date name)))
(defn print-profit-and-loss [request]
(let [uuid (str (UUID/randomUUID))