Making it so manual ledger is searchable and usable

This commit is contained in:
Bryce Covert
2020-09-30 06:47:17 -07:00
parent a38894a10a
commit 429b02884a
8 changed files with 224 additions and 20 deletions

View File

@@ -18,7 +18,9 @@
'[?c :client/name ?sort-client]]
"date" ['[?e :journal-entry/date ?sort-date]]
"vendor" ['[?e :journal-entry/vendor ?sort-vendor]]
"amount" ['[?e :journal-entry/amount ?sort-amount]]}
"amount" ['[?e :journal-entry/amount ?sort-amount]]
"external-id" ['[?e :journal-entry/external-id ?sort-external-id]]
"source" ['[?e :journal-entry/source ?sort-source]]}
args)
(limited-clients (:id args))
@@ -31,6 +33,15 @@
:where ['[?e :journal-entry/client ?client-id]]}
:args [(:client-id args)]})
(:only-external args)
(merge-query {:query {:where ['(not [?e :journal-entry/original-entity ])]}})
(seq (:external-id-like args))
(merge-query {:query {:in ['?external-id-like]
:where ['[?e :journal-entry/external-id ?external-id]
'[(.contains ^String ?external-id ?external-id-like)]]}
:args [(:external-id-like args)]})
(:vendor-id args)
(merge-query {:query {:in ['?vendor-id]
:where ['[?e :journal-entry/vendor ?vendor-id]]}

View File

@@ -188,6 +188,7 @@
:journal_entry
{:fields {:id {:type :id}
:source {:type 'String}
:external_id {:type 'String}
:amount {:type 'String}
:note {:type 'String}
:cleared_against {:type 'String}
@@ -538,20 +539,7 @@
:resolve :get-transaction-rule-page}
:ledger_page {:type :ledger_page
:args {:client_id {:type :id}
:vendor_id {:type :id}
:account_id {:type :id}
:amount_lte {:type :money}
:amount_gte {:type :money}
:bank_account_id {:type :id}
:date_range {:type :date_range}
:location {:type 'String}
:from_numeric_code {:type 'Int}
:to_numeric_code {:type 'Int}
:start {:type 'Int}
:per_page {:type 'Int}
:sort {:type '(list :sort_item)}}
:args {:filters {:type :ledger_filters}}
:resolve :get-ledger-page}
:sales_order_page {:type :sales_order_page
@@ -607,6 +595,22 @@
:per_page {:type 'Int}
:sort {:type '(list :sort_item)}
:approval_status {:type :transaction_approval_status} }}
:ledger_filters {:fields {:client_id {:type :id}
:vendor_id {:type :id}
:account_id {:type :id}
:amount_lte {:type :money}
:amount_gte {:type :money}
:bank_account_id {:type :id}
:date_range {:type :date_range}
:location {:type 'String}
:from_numeric_code {:type 'Int}
:to_numeric_code {:type 'Int}
:start {:type 'Int}
:per_page {:type 'Int}
:only_external {:type 'Boolean}
:external_id_like {:type 'String}
:sort {:type '(list :sort_item)}}}
:invoice_payment_amount {:fields {:invoice_id {:type :id}
:amount {:type 'Float}}}
:edit_location_match {:fields {:location {:type 'String}

View File

@@ -22,7 +22,7 @@
(defn get-ledger-page [context args value]
(let [args (assoc args :id (:id context))
[journal-entries journal-entries-count] (l/get-graphql (<-graphql args))
[journal-entries journal-entries-count] (l/get-graphql (<-graphql (:filters args)))
journal-entries (mapv
(fn [je]
(update je :journal-entry/line-items