pretty sure the checks will be very close.
This commit is contained in:
@@ -28,75 +28,74 @@
|
||||
(defn date->str [t]
|
||||
(f/unparse parser t))
|
||||
|
||||
(defn distribute [nums]
|
||||
(let [sum (reduce + 0 nums)]
|
||||
(map #(* 100 (/ % sum)) nums)))
|
||||
|
||||
(defn make-check-pdf [check]
|
||||
(let [output-stream (ByteArrayOutputStream.)]
|
||||
(pdf/pdf
|
||||
[{:left-margin 10 :right-margin 0 :top-margin 0 :bottom-margin 0 :size :letter}
|
||||
[{:left-margin 7 :right-margin 0 :top-margin 0 :bottom-margin 0 :size :letter}
|
||||
(let [{:keys [paid-to company check date amount memo] {print-as :print-as vendor-name :name :as vendor} :vendor} check
|
||||
df (DecimalFormat. "#,###.00")
|
||||
word-amount (num->words amount)
|
||||
|
||||
amount (str "--" (.format df amount) "--")]
|
||||
|
||||
[:table {:num-cols 12 :border false :leading 11}
|
||||
[:table {:num-cols 12 :border false :leading 11 :widths (distribute [2 3 3 3 3 3 3 3 3 2 2 2])}
|
||||
[(let [{:keys [name bank] {:keys [street1 street2 city state zip ]} :address} company]
|
||||
[:cell {:colspan 4 } [:paragraph {:leading 14} name "\n" street1 "\n" (str city ", " state " " zip)] ])
|
||||
[:cell {:colspan 3 } [:paragraph {:leading 14} name "\n" street1 "\n" (str city ", " state " " zip)] ])
|
||||
(let [{{:keys [name acct]} :bank} company]
|
||||
[:cell {:colspan 6 :align :center} [:paragraph {:style :bold} name] [:paragraph acct]])
|
||||
[:cell {:colspan 7 :align :center} [:paragraph {:style :bold} name] [:paragraph acct]])
|
||||
[:cell {:colspan 2 :size 13}
|
||||
check]]
|
||||
|
||||
[[:cell {:colspan 9}]
|
||||
[:cell {:colspan 3} date]]
|
||||
|
||||
[[:cell {:size 16 :leading 16} "PAY"]
|
||||
[:cell {:size 6 :leading 6 } "TO THE ORDER OF"]
|
||||
[[:cell {:size 13 :leading 13} "PAY"]
|
||||
[:cell {:size 8 :leading 8 } "TO THE ORDER OF"]
|
||||
[:cell {:colspan 7} (if (seq print-as)
|
||||
print-as
|
||||
vendor-name)]
|
||||
[:cell {:colspan 3} amount]]
|
||||
|
||||
[[:cell {}]
|
||||
[:cell {:colspan 8} word-amount [:line]]
|
||||
[:cell {:colspan 8} word-amount [:line {:line-width 0.15 :color [50 50 50]}]]
|
||||
[:cell {:colspan 3}]]
|
||||
|
||||
[[:cell {:colspan 12} [:spacer]]]
|
||||
[[:cell {:colspan 12} [:spacer]]]
|
||||
[[:cell {:colspan 12} [:spacer]]]
|
||||
[[:cell {:colspan 12 :leading 50} [:spacer]]]
|
||||
|
||||
[[:cell "MEMO"]
|
||||
[:cell {:colspan 7} memo [:line]]
|
||||
[:cell {:colspan 4}]]
|
||||
[:cell {:colspan 5} memo [:line {:line-width 0.15 :color [50 50 50]}]]
|
||||
[:cell {:colspan 6}]]
|
||||
|
||||
[[:cell {:colspan 2}]
|
||||
[:cell {:colspan 10 :leading 30}
|
||||
[:phrase {:size 18 :ttf-name "public/micrenc.ttf"} (str "c" check "c a" (:acct-number (:bank company)) "a 10302c")]]]
|
||||
|
||||
[[:cell {:colspan 12} [:spacer]]]
|
||||
[[:cell {:colspan 12} [:spacer]]]
|
||||
[[:cell {:colspan 12} [:spacer]]]
|
||||
[[:cell {:colspan 12 :leading 42} [:spacer]]]
|
||||
|
||||
[[:cell]
|
||||
(into
|
||||
[:cell {:colspan 9}]
|
||||
(let [{:keys [name]
|
||||
{:keys [street1 city state zip bank]} :address} company]
|
||||
(list
|
||||
[:paragraph name]
|
||||
[:paragraph street1]
|
||||
[:paragraph city ", " state " " zip]
|
||||
[:paragraph " " name]
|
||||
[:paragraph " " street1]
|
||||
[:paragraph " " city ", " state " " zip]
|
||||
)))
|
||||
[:cell {:colspan 2 :size 13}
|
||||
check]]
|
||||
|
||||
[[:cell {:colspan 12} [:spacer]]]
|
||||
[[:cell {:colspan 12} [:spacer]]]
|
||||
[[:cell {:colspan 12} [:spacer]]]
|
||||
[[:cell {:colspan 12 :leading 62} [:spacer]]]
|
||||
|
||||
[[:cell]
|
||||
[:cell {:colspan 5} [:paragraph
|
||||
vendor-name "\n"
|
||||
(:street1 (:address vendor)) "\n"
|
||||
(:city (:address vendor)) ", " (:state (:address vendor)) " " (:zip (:address vendor))]]
|
||||
[:cell {:colspan 5} [:paragraph
|
||||
" " vendor-name "\n"
|
||||
" " (:street1 (:address vendor)) "\n"
|
||||
" " (:city (:address vendor)) ", " (:state (:address vendor)) " " (:zip (:address vendor))]]
|
||||
[:cell {:align :right}
|
||||
"Paid to:\n"
|
||||
"Amount:\n"
|
||||
@@ -113,9 +112,6 @@
|
||||
[[:cell {:colspan 12} [:spacer]]]
|
||||
[[:cell {:colspan 12} [:spacer]]]
|
||||
[[:cell {:colspan 12} [:spacer]]]
|
||||
[[:cell {:colspan 12} [:spacer]]]
|
||||
[[:cell {:colspan 12} [:spacer]]]
|
||||
[[:cell {:colspan 12} [:spacer]]]
|
||||
|
||||
[[:cell {:colspan 5}]
|
||||
[:cell {:align :right :colspan 2}
|
||||
|
||||
Reference in New Issue
Block a user