Using ions for dollar matching
This commit is contained in:
9
iol_ion/src/iol_ion/query.clj
Normal file
9
iol_ion/src/iol_ion/query.clj
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
(ns iol-ion.query)
|
||||||
|
|
||||||
|
#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
|
||||||
|
(defn dollars-0? [amt]
|
||||||
|
(< -0.001 amt 0.001))
|
||||||
|
|
||||||
|
#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
|
||||||
|
(defn dollars= [amt1 amt2]
|
||||||
|
(dollars-0? (- amt1 amt2) ))
|
||||||
@@ -3,5 +3,8 @@
|
|||||||
iol-ion.tx/reset-rels
|
iol-ion.tx/reset-rels
|
||||||
iol-ion.tx/upsert-ledger
|
iol-ion.tx/upsert-ledger
|
||||||
iol-ion.tx/min-by
|
iol-ion.tx/min-by
|
||||||
iol-ion.tx/propose-invoice]
|
iol-ion.tx/propose-invoice
|
||||||
|
|
||||||
|
iol-ion.query/dollars=
|
||||||
|
iol-ion.query/dollars-0?]
|
||||||
:app-name "iol-cloud"}
|
:app-name "iol-cloud"}
|
||||||
|
|||||||
@@ -117,7 +117,7 @@
|
|||||||
(:amount args)
|
(:amount args)
|
||||||
(merge-query {:query {:in ['?amount]
|
(merge-query {:query {:in ['?amount]
|
||||||
:where ['[?e :payment/amount ?transaction-amount]
|
:where ['[?e :payment/amount ?transaction-amount]
|
||||||
'[(auto-ap.utils/dollars= ?transaction-amount ?amount)]]}
|
'[(iol-ion.query/dollars= ?transaction-amount ?amount)]]}
|
||||||
:args [(:amount args)]})
|
:args [(:amount args)]})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@
|
|||||||
(:total args)
|
(:total args)
|
||||||
(merge-query {:query {:in ['?total]
|
(merge-query {:query {:in ['?total]
|
||||||
:where ['[?e :expected-deposit/total ?expected-deposit-total]
|
:where ['[?e :expected-deposit/total ?expected-deposit-total]
|
||||||
'[(auto-ap.utils/dollars= ?expected-deposit-total ?total)]]}
|
'[(iol-ion.query/dollars= ?expected-deposit-total ?total)]]}
|
||||||
:args [(:total args)]})
|
:args [(:total args)]})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -189,7 +189,7 @@
|
|||||||
(:total args)
|
(:total args)
|
||||||
(merge-query {:query {:in ['?total]
|
(merge-query {:query {:in ['?total]
|
||||||
:where ['[?e :sales-order/total ?sales-order-total]
|
:where ['[?e :sales-order/total ?sales-order-total]
|
||||||
'[(auto-ap.utils/dollars= ?sales-order-total ?total)]]}
|
'[(iol-ion.query/dollars= ?sales-order-total ?total)]]}
|
||||||
:args [(:total args)]})
|
:args [(:total args)]})
|
||||||
|
|
||||||
true
|
true
|
||||||
|
|||||||
Reference in New Issue
Block a user