lots of improvements to editing invoices.
This commit is contained in:
@@ -354,6 +354,7 @@
|
||||
:edit_invoice
|
||||
{:fields {:id {:type :id}
|
||||
:invoice_number {:type 'String}
|
||||
:expense_accounts {:type '(list :edit_expense_account)}
|
||||
:date {:type 'String}
|
||||
:total {:type 'Float}}}}
|
||||
|
||||
|
||||
@@ -260,7 +260,11 @@
|
||||
(defmethod invoices->entities :payment-type/debit [invoices vendor client bank-account type index invoice-amounts]
|
||||
(let [payment (assoc (base-payment invoices vendor client bank-account type index invoice-amounts)
|
||||
:payment/type :payment-type/debit
|
||||
:payment/memo "Debit"
|
||||
:payment/memo (str "Debit Invoice #'s: "
|
||||
(str/join ", "
|
||||
(map (fn [i]
|
||||
(str (:invoice/invoice-number i) "(" (invoice-amounts (:db/id i)) ")"))
|
||||
invoices)))
|
||||
:payment/status :payment-status/cleared)]
|
||||
(-> []
|
||||
(conj payment)
|
||||
@@ -269,7 +273,11 @@
|
||||
(defmethod invoices->entities :payment-type/cash [invoices vendor client bank-account type index invoice-amounts]
|
||||
(let [payment (assoc (base-payment invoices vendor client bank-account type index invoice-amounts)
|
||||
:payment/type :payment-type/cash
|
||||
:payment/memo "Cash"
|
||||
:payment/memo (str "Cash Invoice #'s: "
|
||||
(str/join ", "
|
||||
(map (fn [i]
|
||||
(str (:invoice/invoice-number i) "(" (invoice-amounts (:db/id i)) ")"))
|
||||
invoices)))
|
||||
:payment/status :payment-status/cleared)]
|
||||
(-> []
|
||||
(conj payment)
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
(->graphql))))
|
||||
|
||||
|
||||
(defn edit-invoice [context {{:keys [id invoice_number total vendor_id date client_id] :as in} :invoice} value]
|
||||
(defn edit-invoice [context {{:keys [id invoice_number total vendor_id date client_id expense_accounts] :as in} :invoice} value]
|
||||
|
||||
|
||||
(let [invoice (d-invoices/get-by-id id)
|
||||
@@ -90,7 +90,11 @@
|
||||
:invoice/invoice-number invoice_number
|
||||
:invoice/date (coerce/to-date (parse date iso-date))
|
||||
:invoice/total total
|
||||
:invoice/outstanding-balance (- total paid-amount)})]
|
||||
:invoice/outstanding-balance (- total paid-amount)
|
||||
:invoice/expense-accounts (map (fn [ea]
|
||||
{:db/id (:id ea)
|
||||
:invoice-expense-account/amount (Double/parseDouble (:amount ea))})
|
||||
expense_accounts)})]
|
||||
(-> updated-invoice
|
||||
(->graphql))))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user