Merge branch 'master' of bitbucket.org:brycecovertoperations/integreat
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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]]]]
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
(mapcat (fn [transaction-group]
|
||||
(map
|
||||
(fn [index {:keys [date description-original high-level-category amount account-id] :as transaction}]
|
||||
{:id (str date "-" description-original "-" amount "-" index "-" company-id)
|
||||
{:id (str date "-" account-id "-" description-original "-" amount "-" index "-" company-id)
|
||||
:bank-account-id account-id
|
||||
:date (time/unparse date "YYYY-MM-dd")
|
||||
:amount {:amount amount}
|
||||
|
||||
Reference in New Issue
Block a user