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

@@ -129,6 +129,25 @@
:placeholder "e.g., ABC-456" :placeholder "e.g., ABC-456"
:size :small})) :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"} (com/field {:label "Amount"}
[:div.flex.space-x-4.items-baseline [:div.flex.space-x-4.items-baseline
(com/money-input {:name "amount-gte" (com/money-input {:name "amount-gte"
@@ -199,22 +218,23 @@
'[?oe :invoice/invoice-number ?invoice-number]]} '[?oe :invoice/invoice-number ?invoice-number]]}
:args [(:invoice-number args)]}) :args [(:invoice-number args)]})
(or (seq (:numeric-code args)) (or (:numeric-code-lte args)
(:numeric-code-gte args)
(:account args) (:account args)
(:db/id (:bank-account args)) (:db/id (:bank-account args))
(not-empty (:location args))) (not-empty (:location args)))
(merge-query {:query {:where ['[?e :journal-entry/line-items ?li]]}}) (merge-query {:query {:where ['[?e :journal-entry/line-items ?li]]}})
(seq (:numeric-code args)) (or (:numeric-code-gte args)
(merge-query {:query {:in ['[[?from-numeric-code ?to-numeric-code]]] (:numeric-code-lte args))
(merge-query {:query {:in '[?from-numeric-code ?to-numeric-code]
:where ['[?li :journal-entry-line/account ?a] :where ['[?li :journal-entry-line/account ?a]
'(or-join [?a ?c] '(or-join [?a ?c]
[?a :account/numeric-code ?c] [?a :account/numeric-code ?c]
[?a :bank-account/numeric-code ?c]) [?a :bank-account/numeric-code ?c])
'[(>= ?c ?from-numeric-code)] '[(>= ?c ?from-numeric-code)]
'[(<= ?c ?to-numeric-code)]]} '[(<= ?c ?to-numeric-code)]]}
:args [(vec (for [{:keys [from to]} (:numeric-code args)] :args [(or (:numeric-code-gte args) 0) (or (:numeric-code-lte args) 99999)]})
[(or from 0) (or to 99999)]))]})
(seq (:account args)) (seq (:account args))
(merge-query {:query {:in ['?a3] (merge-query {:query {:in ['?a3]
@@ -347,6 +367,8 @@
[:start {:optional true :default 0} [:maybe :int]] [:start {:optional true :default 0} [:maybe :int]]
[:amount-gte {:optional true} [:maybe :double]] [:amount-gte {:optional true} [:maybe :double]]
[:amount-lte {: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]}]]] [: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]}]]] [: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]}]]] [:account {:optional true :default nil} [:maybe [:entity-map {:pull [:db/id :account/name]}]]]
@@ -477,9 +499,7 @@
:hide? (fn [args] :hide? (fn [args]
(and (= (count (:clients args)) 1) (and (= (count (:clients args)) 1)
(= 1 (count (:client/locations (:client args)))))) (= 1 (count (:client/locations (:client args))))))
:render (fn [x] [:div.flex.items-center.gap-2 (-> x :invoice/client :client/name) :render (fn [x] [:div.flex.items-center.gap-2 (-> x :journal-entry/client :client/name) ])}
(map #(com/pill {:color :primary} (-> % :invoice-expense-account/location))
(:invoice/expense-accounts x)) ])}
{:key "vendor" {:key "vendor"
:name "Vendor" :name "Vendor"

View File

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