Adds pedantic flag

This commit is contained in:
2025-11-05 20:57:54 -08:00
parent a462c56595
commit bd8cb34a0f
3 changed files with 10 additions and 6 deletions

View File

@@ -7,7 +7,7 @@
[auto-ap.ledger :refer [build-account-lookup upsert-running-balance]]
[auto-ap.ledger.reports :as l-reports]
[auto-ap.logging :as alog]
[auto-ap.pdf.ledger :refer [table->pdf]]
[auto-ap.pdf.ledger :refer [table->pdf *report-pedantic*]]
[auto-ap.permissions :refer [can? wrap-must]]
[auto-ap.routes.ledger :as route]
[auto-ap.routes.utils
@@ -45,7 +45,7 @@
[:or
[:enum :all]
[:vector {:coerce? true :min 1}
[:entity-map {:pull [:db/id :client/name]}]]]]
[:entity-map {:pull [:db/id :client/name :client/feature-flags]}]]]]
[:column-per-location {:default false}
[:boolean {:decode/string {:enter #(if (= % "on") true
@@ -106,7 +106,7 @@
:period {:start ( coerce/to-date (:start p)) :end (coerce/to-date (time/plus (:end p) (time/days 1)))}}))
args (assoc (:form-params request)
:periods (map (fn [d] {:start ( coerce/to-date (:start d)) :end ( coerce/to-date (:end d))}) periods))
clients (pull-many (dc/db conn) [:client/code :client/name :db/id] client-ids)
clients (pull-many (dc/db conn) [:client/code :client/name :db/id :client/feature-flags] client-ids)
pnl-data (l-reports/->PNLData args data (by :db/id :client/code clients))
report (l-reports/summarize-pnl pnl-data)]
@@ -255,7 +255,8 @@
(let [uuid (str (UUID/randomUUID))
{:keys [client warning]} (maybe-trim-clients request (:client (:form-params request)))
request (assoc-in request [:form-params :client] client)
pdf-data (make-profit-and-loss-pdf request (:report (get-report request)))
pdf-data (binding [*report-pedantic* (boolean ((set (:client/feature-flags (first client)))
"report-pedantic"))] (make-profit-and-loss-pdf request (:report (get-report request))))
name (profit-and-loss-args->name request)
key (str "reports/profit-and-loss/" uuid "/" name ".pdf")
url (str "https://" (:data-bucket env) "/" key)]