Merge branch 'master' of codecommit://integreat

This commit is contained in:
2024-09-15 21:42:45 -07:00
2 changed files with 37 additions and 14 deletions

View File

@@ -117,9 +117,9 @@
:value-fn :db/id
:content-fn #(:account/name (d-accounts/clientize (dc/pull (dc/db conn) d-accounts/default-read (:db/id %))
(:db/id (:client request))))}))
(bank-account-filter* request)
(date-range-field* request)
(com/field {:label "Invoice #"}
(com/text-input {:name "invoice-number"
@@ -128,7 +128,26 @@
:value (:invoice-number (:query-params request))
:placeholder "e.g., ABC-456"
:size :small}))
(com/field {:label "Account Code"}
[:div.flex.space-x-4.items-baseline
(com/int-input {:name "numeric-code-gte"
:id "numeric-code-gte"
:hx-preserve "true"
:class "hot-filter w-20"
:value (:numeric-code-gte (:query-params request))
:placeholder "40000"
:size :small})
[:div.align-baseline
"to"]
(com/int-input {:name "numeric-code-lte"
:hx-preserve "true"
:id "numeric-code-lte"
:class "hot-filter w-20"
:value (:numeric-code-lte (:query-params request))
:placeholder "50000"
:size :small})])
(com/field {:label "Amount"}
[:div.flex.space-x-4.items-baseline
(com/money-input {:name "amount-gte"
@@ -186,7 +205,7 @@
:where ['[?e :journal-entry/source ?source]]}
:args [(:source args)]})
(:external? route-params)
(merge-query {:query { :where ['[?e :journal-entry/external-id]]} })
(merge-query {:query { :where ['[?e :journal-entry/external-id]]} })
(:vendor args)
(merge-query {:query {:in ['?vendor-id]
@@ -194,27 +213,28 @@
:args [(:db/id (:vendor args))]})
(:invoice-number args)
(merge-query {:query {:in ['?invoice-number]
(merge-query {:query {:in ['?invoice-number]
:where ['[?e :journal-entry/original-entity ?oe]
'[?oe :invoice/invoice-number ?invoice-number]]}
:args [(:invoice-number args)]})
(or (seq (:numeric-code args))
(or (:numeric-code-lte args)
(:numeric-code-gte args)
(:account args)
(:db/id (:bank-account args))
(not-empty (:location args)))
(merge-query {:query {:where ['[?e :journal-entry/line-items ?li]]}})
(seq (:numeric-code args))
(merge-query {:query {:in ['[[?from-numeric-code ?to-numeric-code]]]
(or (:numeric-code-gte args)
(:numeric-code-lte args))
(merge-query {:query {:in '[?from-numeric-code ?to-numeric-code]
:where ['[?li :journal-entry-line/account ?a]
'(or-join [?a ?c]
[?a :account/numeric-code ?c]
[?a :bank-account/numeric-code ?c])
'[(>= ?c ?from-numeric-code)]
'[(<= ?c ?to-numeric-code)]]}
:args [(vec (for [{:keys [from to]} (:numeric-code args)]
[(or from 0) (or to 99999)]))]})
:args [(or (:numeric-code-gte args) 0) (or (:numeric-code-lte args) 99999)]})
(seq (:account args))
(merge-query {:query {:in ['?a3]
@@ -347,6 +367,8 @@
[:start {:optional true :default 0} [:maybe :int]]
[:amount-gte {:optional true} [:maybe :double]]
[:amount-lte {:optional true} [:maybe :double]]
[:numeric-code-gte {:optional true} [:maybe nat-int?]]
[:numeric-code-lte {:optional true} [:maybe nat-int?]]
[:vendor {:optional true :default nil} [:maybe [:entity-map {:pull [:db/id :vendor/name]}]]]
[:bank-account {:optional true :default nil} [:maybe [:entity-map {:pull [:db/id :bank-account/name]}]]]
[:account {:optional true :default nil} [:maybe [:entity-map {:pull [:db/id :account/name]}]]]
@@ -477,9 +499,7 @@
:hide? (fn [args]
(and (= (count (:clients args)) 1)
(= 1 (count (:client/locations (:client args))))))
:render (fn [x] [:div.flex.items-center.gap-2 (-> x :invoice/client :client/name)
(map #(com/pill {:color :primary} (-> % :invoice-expense-account/location))
(:invoice/expense-accounts x)) ])}
:render (fn [x] [:div.flex.items-center.gap-2 (-> x :journal-entry/client :client/name) ])}
{:key "vendor"
:name "Vendor"

View File

@@ -393,11 +393,12 @@
check-number))}
{:key "status"
:name "Status"
:sort-key "status"
:render (fn [{:payment/keys [status]}]
(condp = status
:payment-status/cleared
(com/pill {:color :primary} "cleared")
:payment-status/pending
(com/pill {:color :secondary} "pending")
:payment-status/voided
@@ -406,10 +407,12 @@
""))}
{:key "date"
:name "Date"
:sort-key "date"
:show-starting "lg"
:render (fn [{:payment/keys [date]}]
(some-> date (atime/unparse-local atime/normal-date)))}
{:key "amount"
:sort-key "amount"
:name "Amount"
:render (fn [{:payment/keys [amount]}]
(some->> amount (format "$%.2f")))}