oops, admins only still.
This commit is contained in:
@@ -15,6 +15,37 @@
|
|||||||
(:vendor/legal-entity-tin vendor)
|
(:vendor/legal-entity-tin vendor)
|
||||||
(:vendor/legal-entity-tin-type 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]
|
(defn get-1099-companies [user]
|
||||||
(let [clients (->> (d/q '[:find ?c
|
(let [clients (->> (d/q '[:find ?c
|
||||||
:in $ ?user
|
:in $ ?user
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
(def key->handler {:admin-history (wrap-client-redirect-unauthenticated (wrap-secure (wrap-admin admin/history)))
|
(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-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)))
|
: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-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))})
|
:company-1099-vendor-save (wrap-client-redirect-unauthenticated (wrap-secure company-1099/vendor-save))})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user