oops, admins only still.

This commit is contained in:
2023-01-15 09:13:00 -08:00
parent fa91c5b8a9
commit fa420a69ff
2 changed files with 32 additions and 1 deletions

View File

@@ -15,6 +15,37 @@
(:vendor/legal-entity-tin vendor)
(:vendor/legal-entity-tin-type vendor))))
(defn get-1099-companies-2 [user]
(let [clients (->> (d/q '[:find ?c
:in $ ?user
:where [?c :client/code]
[(auto-ap.graphql.utils/can-see-client? ?user ?c)]]
(d/db conn) user)
(map first)
set)]
(->> (d/q '[:find
?c
?v
(sum ?a)
:with ?p
:in $ [?c ...]
:where
[?p :payment/client ?c]
[?p :payment/type :payment-type/check]
[?p :payment/date ?d ]
[(>= ?d #inst "2022-01-01T08:00")]
[(< ?d #inst "2023-01-01T08:00")]
[?p :payment/amount ?a]
[?p :payment/vendor ?v]]
(d/db conn)
clients)
(filter (fn [[_ _ a]]
(>= a 600.0)))
(take 200)
(sort-by (fn [[client _ amount]]
[client amount]) ))))
(defn get-1099-companies [user]
(let [clients (->> (d/q '[:find ?c
:in $ ?user

View File

@@ -9,7 +9,7 @@
(def key->handler {:admin-history (wrap-client-redirect-unauthenticated (wrap-secure (wrap-admin admin/history)))
:admin-history-search (wrap-client-redirect-unauthenticated (wrap-secure (wrap-admin admin/history-search)))
:admin-history-inspect (wrap-client-redirect-unauthenticated (wrap-secure (wrap-admin admin/inspect)))
:company-1099 (wrap-client-redirect-unauthenticated (wrap-secure (wrap-admin company-1099/page)))
:company-1099 (wrap-client-redirect-unauthenticated (wrap-secure company-1099/page))
:company-1099-vendor-dialog (wrap-client-redirect-unauthenticated (wrap-secure company-1099/vendor-dialog))
:company-1099-vendor-save (wrap-client-redirect-unauthenticated (wrap-secure company-1099/vendor-save))})