ledger improvements to handle credit cards
This commit is contained in:
@@ -59,12 +59,29 @@
|
|||||||
'[(<= ?date ?end-date)]]}
|
'[(<= ?date ?end-date)]]}
|
||||||
:args [(c/to-date (:end (:date-range args)))]})
|
:args [(c/to-date (:end (:date-range args)))]})
|
||||||
|
|
||||||
|
(or (:from-numeric-code args)
|
||||||
|
(:to-numeric-code args)
|
||||||
|
(:bank-account-id args)
|
||||||
|
(not-empty (:location args)))
|
||||||
|
(merge-query {:query {:where ['[?e :journal-entry/line-items ?li]]}})
|
||||||
|
|
||||||
|
(or (:from-numeric-code args)
|
||||||
|
(:to-numeric-code args))
|
||||||
|
(merge-query {:query {:in []
|
||||||
|
:where ['[?li :journal-entry-line/account ?a]
|
||||||
|
'(or-join [?c]
|
||||||
|
[?a :account/numeric-code ?c]
|
||||||
|
(and [?a :bank-account/type :bank-account-type/check]
|
||||||
|
[?c 11100])
|
||||||
|
(and [?a :bank-account/type :bank-account-type/cash]
|
||||||
|
[?c 11100])
|
||||||
|
(and [?a :bank-account/type :bank-account-type/credit]
|
||||||
|
[?c 28000]))]}
|
||||||
|
:args []})
|
||||||
|
|
||||||
(:from-numeric-code args)
|
(:from-numeric-code args)
|
||||||
(merge-query {:query {:in ['?from-numeric-code]
|
(merge-query {:query {:in ['?from-numeric-code]
|
||||||
:where ['[?e :journal-entry/line-items ?li]
|
:where ['[(>= ?c ?from-numeric-code)]]}
|
||||||
'[?li :journal-entry-line/account ?a]
|
|
||||||
'[?a :account/numeric-code ?c]
|
|
||||||
'[(>= ?c ?from-numeric-code)]]}
|
|
||||||
:args [(:from-numeric-code args)]})
|
:args [(:from-numeric-code args)]})
|
||||||
|
|
||||||
(:amount-gte args)
|
(:amount-gte args)
|
||||||
@@ -81,8 +98,7 @@
|
|||||||
|
|
||||||
(:bank-account-id args)
|
(:bank-account-id args)
|
||||||
(merge-query {:query {:in ['?a]
|
(merge-query {:query {:in ['?a]
|
||||||
:where ['[?e :journal-entry/line-items ?li]
|
:where ['[?li :journal-entry-line/account ?a]]}
|
||||||
'[?li :journal-entry-line/account ?a]]}
|
|
||||||
:args [(:bank-account-id args)]})
|
:args [(:bank-account-id args)]})
|
||||||
|
|
||||||
(:account-id args)
|
(:account-id args)
|
||||||
@@ -93,17 +109,14 @@
|
|||||||
|
|
||||||
(:to-numeric-code args)
|
(:to-numeric-code args)
|
||||||
(merge-query {:query {:in ['?to-numeric-code]
|
(merge-query {:query {:in ['?to-numeric-code]
|
||||||
:where ['[?e :journal-entry/line-items ?li]
|
:where ['[(<= ?c ?to-numeric-code)]]}
|
||||||
'[?li :journal-entry-line/account ?a]
|
|
||||||
'[?a :account/numeric-code ?c]
|
|
||||||
'[(<= ?c ?to-numeric-code)]]}
|
|
||||||
:args [(:to-numeric-code args)]})
|
:args [(:to-numeric-code args)]})
|
||||||
|
|
||||||
(not-empty (:location args))
|
(not-empty (:location args))
|
||||||
(merge-query {:query {:in ['?location]
|
(merge-query {:query {:in ['?location]
|
||||||
:where ['[?e :journal-entry/line-items ?li]
|
:where ['[?li :journal-entry-line/location ?location]]}
|
||||||
'[?li :journal-entry-line/location ?location]]}
|
|
||||||
:args [(:location args)]})
|
:args [(:location args)]})
|
||||||
|
|
||||||
(limited-clients (:id args))
|
(limited-clients (:id args))
|
||||||
(merge-query {:query {:in ['[?xx ...]]
|
(merge-query {:query {:in ['[?xx ...]]
|
||||||
:where ['[?e :journal-entry/client ?xx]]}
|
:where ['[?e :journal-entry/client ?xx]]}
|
||||||
|
|||||||
Reference in New Issue
Block a user