This commit is contained in:
BC
2018-07-05 20:36:09 -07:00
parent e5caab4285
commit 6d685ffd3b
7 changed files with 45 additions and 17 deletions

View File

@@ -10,9 +10,12 @@
(defn fields->data [x]
(-> x
(assoc-in [:data :address] (:address x))
(dissoc :address)))
(assoc-in [:data :print-as] (:print-as x))
(dissoc :address)
(dissoc :print-as)))
(def all-fields [:name
:print-as
:code
:id
:invoice-reminder-schedule

View File

@@ -47,6 +47,18 @@
:vendor
{:fields {:id {:type 'Int}
:name {:type 'String}
:code {:type 'String}
:print_as {:type 'String}
:primary_contact {:type 'String}
:primary_email {:type 'String}
:primary_phone {:type 'String}
:secondary_contact {:type 'String}
:secondary_email {:type 'String}
:secondary_phone {:type 'String}
:default_expense_account {:type 'Int}
:invoice_reminder_schedule {:type 'String}}}
:reminder

View File

@@ -32,7 +32,7 @@
(let [output-stream (ByteArrayOutputStream.)]
(pdf/pdf
[{:left-margin 10 :right-margin 0 :top-margin 0 :bottom-margin 0 :size :letter}
(let [{:keys [paid-to company check date amount memo] {vendor-name :name :as vendor} :vendor} check
(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)
@@ -51,7 +51,9 @@
[[:cell {:size 16 :leading 16} "PAY"]
[:cell {:size 6 :leading 6 } "TO THE ORDER OF"]
[:cell {:colspan 7} vendor-name]
[:cell {:colspan 7} (if (seq print-as)
print-as
vendor-name)]
[:cell {:colspan 3} amount]]
[[:cell {}]
@@ -226,7 +228,7 @@
(companies/upsert company-id updated-company)
(doseq [{:keys [invoice-id amount]} invoice-payments]
(invoices/apply-payment invoice-id amount))
{:invoices (invoices/get-multi (map :id (doto (mapcat first checks) println)))
{:invoices (invoices/get-multi (map :id (mapcat first checks)))
:pdf-url (merge-pdfs (map (comp :s3-key second) checks))}))