adding ability to choose location

This commit is contained in:
Bryce Covert
2018-07-23 13:36:02 -07:00
parent ecc5dc7d77
commit 695cd38227
6 changed files with 34 additions and 6 deletions

View File

@@ -253,6 +253,7 @@
:add_invoice
{:fields {:id {:type 'Int}
:invoice_number {:type 'String}
:location {:type 'String}
:date {:type 'String}
:company_id {:type 'Int}
:vendor_id {:type 'Int}

View File

@@ -11,7 +11,7 @@
(vendors/get-by-id vendor-id)
(vendors/insert {:name vendor-name :default-expense-account 0})))
(defn add-invoice [context {{:keys [total invoice_number company_id vendor_id vendor_name date] :as in} :invoice} value]
(defn add-invoice [context {{:keys [total invoice_number location company_id vendor_id vendor_name date] :as in} :invoice} value]
(let [vendor (-create-or-get-vendor vendor_id vendor_name)
_ (assert-can-see-company (:id context) company_id)
company (companies/get-by-id company_id)
@@ -27,7 +27,7 @@
)]
(invoices-expense-accounts/replace-for-invoice
(:id invoice) [{:expense-account-id (:default-expense-account vendor)
:location (first (:locations company))
:location location
:amount total}] )
(-> invoice
(->graphql))))