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

1
.gitignore vendored
View File

@@ -19,3 +19,4 @@ data/
*.iml *.iml
private private
node_modules node_modules
**/*.swp

View File

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

View File

@@ -11,12 +11,6 @@
[auto-ap.db.companies :as companies] [auto-ap.db.companies :as companies]
[auto-ap.time :refer [parse normal-date]])) [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] (defn get-check-for-transaction [context args value]
(->graphql (->graphql
(checks/get-by-id (:check_id value)))) (checks/get-by-id (:check_id value))))

View File

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

View File

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