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