fixing checks to have company name, and invoice validation
This commit is contained in:
@@ -159,6 +159,7 @@
|
||||
[:cell {:align :right :colspan 2}
|
||||
"Check:\n"
|
||||
"Vendor:\n"
|
||||
"Company:\n"
|
||||
"Bank Account:\n"
|
||||
"Paid To:\n"
|
||||
"Amount:\n"
|
||||
@@ -167,6 +168,7 @@
|
||||
[:cell {:colspan 5}
|
||||
[:paragraph check]
|
||||
[:paragraph vendor-name]
|
||||
[:paragraph (:client/name client)]
|
||||
[:paragraph (:bank-account/bank-name bank-account)]
|
||||
[:paragraph paid-to]
|
||||
[:paragraph amount]
|
||||
|
||||
@@ -91,9 +91,14 @@
|
||||
|
||||
|
||||
|
||||
(defn add-invoice [context {{:keys [total invoice_number location client_id vendor_id vendor_name date] :as in} :invoice} value]
|
||||
(defn add-invoice [context {{:keys [total expense_accounts invoice_number location client_id vendor_id vendor_name date] :as in} :invoice} value]
|
||||
(assert-no-conflicting in)
|
||||
(assert-can-see-client (:id context) client_id)
|
||||
(doseq [expense-account expense_accounts]
|
||||
(when (empty? (:location expense-account))
|
||||
(throw (ex-info "Expense account is missing location" {:validation-error "Expense account is missing location"})))
|
||||
(when (nil? (:account_id expense-account))
|
||||
(throw (ex-info "Expense account is missing account" {:validation-error "Expense account is missing account"}))))
|
||||
(let [transaction-result (audit-transact [(add-invoice-transaction in)] (:id context))]
|
||||
(-> (d-invoices/get-by-id (get-in transaction-result [:tempids "invoice"]))
|
||||
(->graphql))))
|
||||
|
||||
Reference in New Issue
Block a user