adds creator.

This commit is contained in:
2022-03-31 07:35:06 -07:00
parent a538cffe6d
commit 7199b9192e
8 changed files with 18 additions and 40 deletions

View File

@@ -210,31 +210,9 @@
(defn profit-and-loss-pdf [context args value]
(let [data (get-profit-and-loss context args value)
result (print-pnl args data)]
result (print-pnl (:id context) args data)]
(->graphql {:report_url result}))
#_(let [client-id (:client_id args)
client-ids (or (some-> client-id vector)
(filter identity (:client_ids args)))
_ (when (not (seq client-ids))
(throw (ex-info "Please select a client." {:validation-error "Please select a client."})))
_ (doseq [client-id client-ids]
(assert-can-see-client (:id context) client-id))
all-ledger-entries (->> client-ids
(map (fn [client-id]
[client-id (full-ledger-for-client client-id)]))
(into {}))
lookup-account (->> client-ids
(map (fn [client-id]
[client-id (build-account-lookup client-id)]))
(into {}))]
(->graphql
{:periods
(->> (:periods args)
(mapv (fn [{:keys [start end]}]
{:accounts (mapcat
#(roll-up-until (lookup-account %) (all-ledger-entries %) (coerce/to-date end) (coerce/to-date start) )
client-ids)})))})))
(->graphql {:report_url result})))
(defn assoc-error [f]

View File

@@ -36,6 +36,7 @@
{:fields {:url {:type 'String}
:name {:type 'String}
:created {:type :iso_date}
:creator {:type 'String}
:id {:type :id}}}
:report_page