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 :value-fn :db/id
:content-fn #(:account/name (d-accounts/clientize (dc/pull (dc/db conn) d-accounts/default-read (:db/id %)) :content-fn #(:account/name (d-accounts/clientize (dc/pull (dc/db conn) d-accounts/default-read (:db/id %))
(:db/id (:client request))))})) (:db/id (:client request))))}))
(bank-account-filter* request) (bank-account-filter* request)
(date-range-field* request) (date-range-field* request)
(com/field {:label "Invoice #"} (com/field {:label "Invoice #"}
(com/text-input {:name "invoice-number" (com/text-input {:name "invoice-number"
@@ -128,7 +128,26 @@
:value (:invoice-number (:query-params request)) :value (:invoice-number (:query-params request))
: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"
@@ -186,7 +205,7 @@
:where ['[?e :journal-entry/source ?source]]} :where ['[?e :journal-entry/source ?source]]}
:args [(:source args)]}) :args [(:source args)]})
(:external? route-params) (:external? route-params)
(merge-query {:query { :where ['[?e :journal-entry/external-id]]} }) (merge-query {:query { :where ['[?e :journal-entry/external-id]]} })
(:vendor args) (:vendor args)
(merge-query {:query {:in ['?vendor-id] (merge-query {:query {:in ['?vendor-id]
@@ -194,27 +213,28 @@
:args [(:db/id (:vendor args))]}) :args [(:db/id (:vendor args))]})
(:invoice-number args) (:invoice-number args)
(merge-query {:query {:in ['?invoice-number] (merge-query {:query {:in ['?invoice-number]
:where ['[?e :journal-entry/original-entity ?oe] :where ['[?e :journal-entry/original-entity ?oe]
'[?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,11 +393,12 @@
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
(com/pill {:color :primary} "cleared") (com/pill {:color :primary} "cleared")
:payment-status/pending :payment-status/pending
(com/pill {:color :secondary} "pending") (com/pill {:color :secondary} "pending")
:payment-status/voided :payment-status/voided
@@ -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")))}