ignoring vendor on transactions.

This commit is contained in:
Bryce
2018-06-29 15:11:09 -07:00
parent 5f6bc5beea
commit 9ee2c6fc2f
5 changed files with 6 additions and 27 deletions

View File

@@ -76,8 +76,6 @@
:description_original {:type 'String}
:description_simple {:type 'String}
:status {:type 'String}
:vendor {:type :vendor
:resolve :get-vendor-for-transaction}
:company {:type :company
:resolve :get-company-for-transaction}
:check {:type :check
@@ -389,7 +387,6 @@
:get-vendor-for-check gq-checks/get-vendor-for-check
:get-company-for-check gq-checks/get-company-for-check
:get-company-for-transaction gq-transactions/get-company-for-transaction
:get-vendor-for-transaction gq-transactions/get-vendor-for-transaction
:get-check-for-transaction gq-transactions/get-check-for-transaction
:get-company-for-invoice get-company-for-invoice
:get-invoices-checks get-invoices-checks

View File

@@ -11,12 +11,6 @@
[auto-ap.db.companies :as companies]
[auto-ap.time :refer [parse normal-date]]))
(defn get-vendor-for-transaction [context args value]
(->graphql
(if-let [vendor-cache (:vendor-cache context)]
(vendor-cache (:vendor_id value))
(vendors/get-by-id (:vendor_id value)))))
(defn get-check-for-transaction [context args value]
(->graphql
(checks/get-by-id (:check_id value))))

View File

@@ -8,12 +8,8 @@
[auto-ap.time :as time]))
(defn transaction->vendor-id [_]
(-> (vendors/get-all)
first
:id))
(defn transaction->check-id [_ check-number company-id vendor-id]
(defn transaction->check-id [_ check-number company-id]
(when check-number
(-> (checks/get-graphql {:company-id company-id
:check-number check-number})
@@ -57,8 +53,7 @@
(assoc-in transaction [:description :original] (str "check xxx" (rand-nth ["6789" "1234" "6790"])))
transaction)
check-number (extract-check-number transaction)
company-id (account->company account-id)
vendor-id (transaction->vendor-id transaction)]]
company-id (account->company account-id) ]]
(try
(transactions/upsert!
@@ -72,10 +67,9 @@
:type type
:status status
:company-id company-id
:vendor-id vendor-id
:check-number check-number
:bank-account-id (yodlee-account-id->bank-account-id account-id)
:check-id (transaction->check-id transaction check-number company-id vendor-id)
:check-id (transaction->check-id transaction check-number company-id)
})
(catch Exception e
(println e))))))

View File

@@ -39,7 +39,6 @@
:post_date
:status
:description_original
[:vendor [:name :id]]
[:check [:check_number :s3_url]]
[:company [:name :id]]]]
:total
@@ -84,12 +83,7 @@
:sort-by sort-by
:asc asc}
"Company"]
[sorted-column {:on-sort opc
:style {:width "33%" :cursor "pointer"}
:sort-key "vendor"
:sort-by sort-by
:asc asc}
"Vendor"]
[sorted-column {:on-sort opc
:style {:width "33%" :cursor "pointer"}
:sort-key "description-original"
@@ -123,12 +117,11 @@
[:tr
[:td {:col-span 5}
[:i.fa.fa-spin.fa-spinner]]]
(for [{:keys [company check status description-original date amount id vendor] :as i} (:transactions @transaction-page)]
(for [{:keys [company check status description-original date amount id ] :as i} (:transactions @transaction-page)]
^{:key id}
[:tr {:class (:class i)}
[:td (:name company)]
[:td (:name vendor)]
[:td description-original]
[:td (date->str date) ]
[:td (gstring/format "$%.2f" amount )]