allowing paying using debit.
This commit is contained in:
@@ -154,9 +154,10 @@
|
||||
(when-not selected-company
|
||||
[:td (:name company)])
|
||||
[:td (:name vendor)]
|
||||
[:td (if (= "cash" type)
|
||||
"Cash"
|
||||
check-number)]
|
||||
[:td (cond
|
||||
(= "cash" type) "Cash"
|
||||
(= "debit" type) "Debit"
|
||||
:else check-number)]
|
||||
[:td (date->str date) ]
|
||||
[:td (gstring/format "$%.2f" amount )]
|
||||
[:td status]
|
||||
|
||||
@@ -149,12 +149,13 @@
|
||||
(assoc-in i f v)
|
||||
i))))))
|
||||
|
||||
(defn print-checks-query [invoice-payments bank-account-id company-id]
|
||||
(defn print-checks-query [invoice-payments bank-account-id type company-id]
|
||||
{:venia/operation {:operation/type :mutation
|
||||
:operation/name "PrintChecks"}
|
||||
|
||||
:venia/queries [[:print-checks
|
||||
{:invoice_payments invoice-payments
|
||||
:type type
|
||||
:bank_account_id bank-account-id
|
||||
:company_id company-id}
|
||||
[[:invoices [:id :outstanding-balance [:checks [:amount [:check [:amount :s3_url :check_number ]]]]]]
|
||||
@@ -162,7 +163,7 @@
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
::print-checks
|
||||
(fn [{:keys [db]} [_ bank-account-id]]
|
||||
(fn [{:keys [db]} [_ bank-account-id type]]
|
||||
(let [invoice-amounts (by :id :outstanding-balance (get-in db [::invoice-page :invoices]))]
|
||||
|
||||
{:db (-> db
|
||||
@@ -176,6 +177,7 @@
|
||||
:amount (invoice-amounts id)})
|
||||
(get-in db [::invoice-page :checked]))
|
||||
bank-account-id
|
||||
type
|
||||
(:company db))
|
||||
:on-success [::checks-created]}})))
|
||||
|
||||
@@ -185,7 +187,12 @@
|
||||
::advanced-print-checks-submitted
|
||||
(fn [{:keys [db]} [_ bank-account-id]]
|
||||
(let [invoice-amounts (by :id (comp js/parseFloat :amount) (get-in db [::advanced-print-checks :invoices]))
|
||||
bank-account-id (get-in db [::advanced-print-checks :bank-account-id])]
|
||||
bank-account-id (get-in db [::advanced-print-checks :bank-account-id])
|
||||
type (->> @(re-frame/subscribe [::subs/company])
|
||||
:bank-accounts
|
||||
(filter #(= bank-account-id (:id %)))
|
||||
first
|
||||
:type)]
|
||||
{:db (-> db
|
||||
(assoc-in [::advanced-print-checks :printing?] true ))
|
||||
:graphql
|
||||
@@ -196,6 +203,7 @@
|
||||
:amount (invoice-amounts (:id x))})
|
||||
(get-in db [::advanced-print-checks :invoices]))
|
||||
bank-account-id
|
||||
(or type "check")
|
||||
(:company db))
|
||||
|
||||
:on-success [::checks-created]}})))
|
||||
@@ -793,10 +801,11 @@
|
||||
[:div.dropdown-content
|
||||
(list
|
||||
(for [{:keys [id number name type]} (:bank-accounts current-company)]
|
||||
(do (println type)
|
||||
(if (= "cash" type)
|
||||
^{:key id} [:a.dropdown-item {:on-click (dispatch-event [::print-checks id])} "With cash"]
|
||||
^{:key id} [:a.dropdown-item {:on-click (dispatch-event [::print-checks id])} "Print checks from " name])))
|
||||
(if (= "cash" type)
|
||||
^{:key id} [:a.dropdown-item {:on-click (dispatch-event [::print-checks id "cash"])} "With cash"]
|
||||
(list
|
||||
^{:key (str id "-check")} [:a.dropdown-item {:on-click (dispatch-event [::print-checks id "check"])} "Print checks from " name]
|
||||
^{:key (str id "-debit")} [:a.dropdown-item {:on-click (dispatch-event [::print-checks id "debit"])} "Debit from " name])))
|
||||
^{:key "advanced-divider"} [:hr.dropdown-divider]
|
||||
|
||||
(when (= 1 (count checked))
|
||||
|
||||
Reference in New Issue
Block a user