Adds pedantic flag
This commit is contained in:
@@ -17,6 +17,8 @@
|
|||||||
(java.text DecimalFormat)
|
(java.text DecimalFormat)
|
||||||
(java.util UUID)))
|
(java.util UUID)))
|
||||||
|
|
||||||
|
(def ^:dynamic *report-pedantic* false)
|
||||||
|
|
||||||
(defn cell->pdf [cell]
|
(defn cell->pdf [cell]
|
||||||
(let [cell-contents (cond
|
(let [cell-contents (cond
|
||||||
(and (= :dollar (:format cell))
|
(and (= :dollar (:format cell))
|
||||||
@@ -28,7 +30,7 @@
|
|||||||
(.format (DecimalFormat. "$###,##0.00") (:value cell))
|
(.format (DecimalFormat. "$###,##0.00") (:value cell))
|
||||||
|
|
||||||
(= :percent (:format cell))
|
(= :percent (:format cell))
|
||||||
(.format (DecimalFormat. "0%") (:value cell))
|
(.format (DecimalFormat. (if *report-pedantic* "0.00%" "0%")) (:value cell))
|
||||||
|
|
||||||
:else
|
:else
|
||||||
(str (:value cell)))]
|
(str (:value cell)))]
|
||||||
|
|||||||
@@ -520,7 +520,8 @@
|
|||||||
["manually-pay-cintas" "Manually Pay Cintas"]
|
["manually-pay-cintas" "Manually Pay Cintas"]
|
||||||
["include-in-ntg-corp-reports" "Include in NTG Corporate reports"]
|
["include-in-ntg-corp-reports" "Include in NTG Corporate reports"]
|
||||||
["import-custom-amount" "Import Custom Amount Line Items from Square"]
|
["import-custom-amount" "Import Custom Amount Line Items from Square"]
|
||||||
["code-sysco-items" "Code individual sysco line items"]]})))
|
["code-sysco-items" "Code individual sysco line items"]
|
||||||
|
["report-pedantic" "Show two decimals in reports"]]})))
|
||||||
|
|
||||||
(com/data-grid-cell {:class "align-top"}
|
(com/data-grid-cell {:class "align-top"}
|
||||||
(com/a-icon-button {"@click.prevent.stop" "$refs.p.remove()"} svg/x))))
|
(com/a-icon-button {"@click.prevent.stop" "$refs.p.remove()"} svg/x))))
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
[auto-ap.ledger :refer [build-account-lookup upsert-running-balance]]
|
[auto-ap.ledger :refer [build-account-lookup upsert-running-balance]]
|
||||||
[auto-ap.ledger.reports :as l-reports]
|
[auto-ap.ledger.reports :as l-reports]
|
||||||
[auto-ap.logging :as alog]
|
[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.permissions :refer [can? wrap-must]]
|
||||||
[auto-ap.routes.ledger :as route]
|
[auto-ap.routes.ledger :as route]
|
||||||
[auto-ap.routes.utils
|
[auto-ap.routes.utils
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
[:or
|
[:or
|
||||||
[:enum :all]
|
[:enum :all]
|
||||||
[:vector {:coerce? true :min 1}
|
[: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}
|
[:column-per-location {:default false}
|
||||||
[:boolean {:decode/string {:enter #(if (= % "on") true
|
[: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)))}}))
|
:period {:start ( coerce/to-date (:start p)) :end (coerce/to-date (time/plus (:end p) (time/days 1)))}}))
|
||||||
args (assoc (:form-params request)
|
args (assoc (:form-params request)
|
||||||
:periods (map (fn [d] {:start ( coerce/to-date (:start d)) :end ( coerce/to-date (:end d))}) periods))
|
: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))
|
pnl-data (l-reports/->PNLData args data (by :db/id :client/code clients))
|
||||||
report (l-reports/summarize-pnl pnl-data)]
|
report (l-reports/summarize-pnl pnl-data)]
|
||||||
@@ -255,7 +255,8 @@
|
|||||||
(let [uuid (str (UUID/randomUUID))
|
(let [uuid (str (UUID/randomUUID))
|
||||||
{:keys [client warning]} (maybe-trim-clients request (:client (:form-params request)))
|
{:keys [client warning]} (maybe-trim-clients request (:client (:form-params request)))
|
||||||
request (assoc-in request [:form-params :client] client)
|
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)
|
name (profit-and-loss-args->name request)
|
||||||
key (str "reports/profit-and-loss/" uuid "/" name ".pdf")
|
key (str "reports/profit-and-loss/" uuid "/" name ".pdf")
|
||||||
url (str "https://" (:data-bucket env) "/" key)]
|
url (str "https://" (:data-bucket env) "/" key)]
|
||||||
|
|||||||
Reference in New Issue
Block a user