a bunch of filtering fixes.
This commit is contained in:
@@ -77,6 +77,18 @@
|
||||
:where ['[?e :payment/bank-account ?bank-account-id]]}
|
||||
:args [(:bank-account-id args)]})
|
||||
|
||||
(:amount-gte args)
|
||||
(merge-query {:query {:in ['?amount-gte]
|
||||
:where ['[?e :payment/amount ?a]
|
||||
'[(>= ?a ?amount-gte)]]}
|
||||
:args [(:amount-gte args)]})
|
||||
|
||||
(:amount-lte args)
|
||||
(merge-query {:query {:in ['?amount-lte]
|
||||
:where ['[?e :payment/amount ?a]
|
||||
'[(<= ?a ?amount-lte)]]}
|
||||
:args [(:amount-lte args)]})
|
||||
|
||||
(:amount args)
|
||||
(merge-query {:query {:in ['?amount]
|
||||
:where ['[?e :payment/amount ?transaction-amount]
|
||||
|
||||
@@ -84,7 +84,19 @@
|
||||
(merge-query {:query {:in ['?vendor-id]
|
||||
:where ['[?e :invoice/vendor ?vendor-id]]}
|
||||
:args [ (:vendor-id args)]})
|
||||
|
||||
|
||||
(:amount-gte args)
|
||||
(merge-query {:query {:in ['?amount-gte]
|
||||
:where ['[?e :invoice/total ?total-filter]
|
||||
'[(>= ?total-filter ?amount-gte)]]}
|
||||
:args [(:amount-gte args)]})
|
||||
|
||||
(:amount-lte args)
|
||||
(merge-query {:query {:in ['?amount-lte]
|
||||
:where ['[?e :invoice/total ?total-filter]
|
||||
'[(<= ?total-filter ?amount-lte)]]}
|
||||
:args [(:amount-lte args)]})
|
||||
|
||||
(seq (:invoice-number-like args))
|
||||
(merge-query {:query {:in ['?invoice-number-like]
|
||||
:where ['[?e :invoice/invoice-number ?invoice-number]
|
||||
|
||||
@@ -398,6 +398,8 @@
|
||||
:status {:type :invoice_status}
|
||||
:client_id {:type :id}
|
||||
:vendor_id {:type :id}
|
||||
:amount_lte {:type :money}
|
||||
:amount_gte {:type :money}
|
||||
:invoice_number_like {:type 'String}
|
||||
:start {:type 'Int}
|
||||
:sort {:type '(list :sort_item)}}
|
||||
@@ -464,6 +466,8 @@
|
||||
:args {:client_id {:type :id}
|
||||
:vendor_id {:type :id}
|
||||
:date_range {:type :date_range}
|
||||
:amount_lte {:type :money}
|
||||
:amount_gte {:type :money}
|
||||
:check_number_like {:type 'String}
|
||||
:start {:type 'Int}
|
||||
:sort {:type '(list :sort_item)}}
|
||||
|
||||
@@ -366,7 +366,7 @@
|
||||
(defn void-check [context {id :payment_id} value]
|
||||
(let [check (d-checks/get-by-id id)]
|
||||
(assert (or (= :payment-status/pending (:payment/status check))
|
||||
(#{:payment-type/cash} (:payment/type check))))
|
||||
(#{:payment-type/cash :payment-type/debit} (:payment/type check))))
|
||||
(assert-can-see-client (:id context) (:db/id (:payment/client check)))
|
||||
(let [removing-payments (mapcat (fn [x]
|
||||
(let [invoice (:invoice-payment/invoice x)
|
||||
|
||||
Reference in New Issue
Block a user