calls out client on summaries.
This commit is contained in:
@@ -45,6 +45,7 @@
|
||||
|
||||
(def default-read '[:db/id
|
||||
[:sales-summary/date :xform clj-time.coerce/from-date]
|
||||
{:sales-summary/client [:client/code :client/name]}
|
||||
*]) ;; TODO
|
||||
|
||||
(defn fetch-ids [db request]
|
||||
@@ -140,10 +141,19 @@
|
||||
:title "Sales Summaries"
|
||||
:entity-name "Daily Summary"
|
||||
:route ::route/table
|
||||
:headers [{:key "date"
|
||||
:headers [{:key "client"
|
||||
:name "Client"
|
||||
:sort-key "client"
|
||||
:hide? (fn [args]
|
||||
(= (count (:clients args)) 1))
|
||||
:render #(-> % :sales-summary/client :client/code)}
|
||||
|
||||
|
||||
{:key "date"
|
||||
:name "Date"
|
||||
:sort-key "date"
|
||||
:render #(some-> % :sales-summary/date (atime/unparse-local atime/normal-date))}
|
||||
|
||||
{:key "credits"
|
||||
:name "credits"
|
||||
:sort-key "credits"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
(init-repl)
|
||||
|
||||
(comment
|
||||
(defn setup-randy-queries []
|
||||
(import '[java.util UUID])
|
||||
@@ -325,3 +326,24 @@
|
||||
|
||||
|
||||
)
|
||||
|
||||
|
||||
(clojure.data.csv/write-csv *out*
|
||||
(let [db (dc/db conn)]
|
||||
|
||||
(dc/q '[:find ?d4 ?s (sum ?total)
|
||||
:in $ [?clients ?start-date ?end-date]
|
||||
:where
|
||||
[(iol-ion.query/scan-sales-orders $ ?clients ?start-date ?end-date) [[?e _ ?sort-default] ...]]
|
||||
[?e :sales-order/source ?s]
|
||||
[?e :sales-order/total ?total]
|
||||
[?e :sales-order/date ?d]
|
||||
[(iol-ion.query/excel-date ?d) ?d4]]
|
||||
|
||||
db
|
||||
[
|
||||
[ (pull-attr db :db/id [:client/code "NGRV"])]
|
||||
#inst "2024-03-01" #inst "2024-03-30"]))
|
||||
:separator \tab)
|
||||
|
||||
(pull-attr (dc/db conn) :db/id [:client/code "NGRV"])
|
||||
|
||||
Reference in New Issue
Block a user