marks as paid.

This commit is contained in:
Bryce Covert
2018-05-15 09:01:02 -07:00
parent d9994b988c
commit 7b7275f7a4
6 changed files with 39 additions and 20 deletions

View File

@@ -216,6 +216,8 @@
(make-pdfs (map second checks))
(companies/upsert company-id updated-company)
(doseq [{:keys [invoice-id]} invoice-payments]
(invoices/mark-finished-if-complete invoice-id))
{:invoices (mapcat first checks)
:pdf-url (merge-pdfs (map (comp :s3-key second) checks))}))

View File

@@ -3,6 +3,7 @@
[auto-ap.db.vendors :as vendors]
[auto-ap.db.invoices :as invoices]
[auto-ap.db.utils :refer [query]]
[auto-ap.utils :refer [by]]
[auto-ap.parse :as parse]
[auto-ap.routes.utils :refer [wrap-secure]]
[compojure.core :refer [GET POST context defroutes
@@ -107,20 +108,10 @@
{{:keys [excel-rows]} :edn-params}
(let [columns [:raw-date :vendor-name :check :location :invoice-number :amount :company :bill-entered :bill-rejected :added-on :exported-on]
all-vendors (reduce
(fn [x y]
(assoc x (:name y) y))
{}
(vendors/get-all))
all-vendors (by :name (vendors/get-all))
all-companies (reduce
(fn [x y]
(-> x
(assoc (:code y) y)
(assoc (:name y) y)))
{}
(companies/get-all))
all-companies (companies/get-all)
all-companies (merge (by :code all-companies) (by :name all-companies))
rows (->> (str/split excel-rows #"\n" )
(map #(str/split % #"\t"))