including a more verbose description.

This commit is contained in:
BC
2018-09-20 18:56:02 -07:00
parent 43555a4e25
commit 6c6ed0ebb7
2 changed files with 14 additions and 14 deletions

View File

@@ -189,10 +189,17 @@
(s3/put-object :bucket-name (:data-bucket env)
:key (str "merged-checks/" uuid ".pdf")
:input-stream (io/make-input-stream (.toByteArray merged-pdf-stream) {})
:metadata {:content-length (count (.toByteArray merged-pdf-stream))
:metadata {:content-length (count (.toByteArray merged-pdf-stream))
:content-type "application/pdf"})
(str "http://" (:data-bucket env) ".s3-website-us-east-1.amazonaws.com/merged-checks/" uuid ".pdf")))
(defn get-memo [invoices invoice-amounts]
(str "Invoice #'s: "
(str/join ", "
(map (fn [i]
(str (:invoice-number i) "(" (invoice-amounts (:id i)) ")"))
invoices))))
(defmulti check-for-invoices (fn [invoices vendor-id vendors company bank-account type index invoice-amounts]
@@ -200,14 +207,7 @@
(defmethod check-for-invoices "check" [invoices vendor-id vendors company bank-account type index invoice-amounts]
(let [uuid (str (UUID/randomUUID))
vendor (vendors vendor-id)
memo (str "Invoice #'s: "
(str/join ", "
(map (fn [i]
(str (:invoice-number i) "(" (invoice-amounts (:id i)) ")"))
invoices)))]
vendor (vendors vendor-id)]
{:s3-uuid uuid
:s3-key (str "checks/" uuid ".pdf")
:s3-url (str "http://" (:data-bucket env) ".s3-website-us-east-1.amazonaws.com/checks/" uuid ".pdf")
@@ -215,7 +215,7 @@
:type "check"
:bank-account-id (:id bank-account)
:amount (reduce + 0 (map (comp invoice-amounts :id) invoices))
:memo memo
:memo (get-memo invoices invoice-amounts)
:vendor-id (:id vendor)
:company-id (:id company)
:date (time/now)
@@ -223,7 +223,7 @@
:paid-to (:name vendor)
:amount (reduce + 0 (map (comp invoice-amounts :id) invoices))
:check (str (+ index (:check-number bank-account)))
:memo memo
:memo (get-memo invoices invoice-amounts)
:date (date->str (local-now))
:company {:name (:name company)
:address (:address company)
@@ -241,7 +241,7 @@
:bank-account-id (:id bank-account)
:amount (reduce + 0 (map (comp invoice-amounts :id) invoices))
:status "cleared"
:memo "Debit"
:memo (str "Debit " (get-memo invoices invoice-amounts))
:vendor-id (:id vendor)
:company-id (:id company)
:date (time/now)
@@ -253,7 +253,7 @@
:bank-account-id (:id bank-account)
:amount (reduce + 0 (map (comp invoice-amounts :id) invoices))
:status "cleared"
:memo "Cash"
:memo (str "Cash " (get-memo invoices invoice-amounts))
:vendor-id (:id vendor)
:company-id (:id company)
:date (time/now)

View File

@@ -39,7 +39,7 @@
(assert-admin identity)
(let [query [[:all_checks
{:company-id (query-params "company")}
[:id :check-number :amount :memo :date :status
[:id :check-number :amount :memo :date :status :type
[:invoices [:invoice-id :amount]]
[:bank-account [:number :bank-name :bank-code :id]]
[:vendor [:name :id :primary-contact :primary-email :primary-phone :default-expense-account [:address [:street1 :city :state :zip]]]]