Makes new balance sheet page. It's much faster.

This commit is contained in:
2024-10-13 19:29:49 -07:00
parent fc64f81ace
commit c0bcc33b68
8 changed files with 294 additions and 157 deletions

View File

@@ -164,63 +164,91 @@
(defn ident [x] (defn ident [x]
(:db/ident x)) (:db/ident x))
(deftype Line [^Long id ^Long client-id ^Long account-id ^String location ^java.util.Date date ^Double debit ^Double credit ^Double running-balance])
(defn ->line [{[current-client current-account current-location current-date debit credit running-balance]
:v
id :e}]
(Line. id current-client current-account current-location current-date debit credit running-balance)
)
(defn compare-account [^Line l1 ^Line l2]
(let [a (compare (.-date l1) (.-date l2))]
(if (not= 0 a)
a
(compare (.-id l1) (.-id l2)))))
(defn account-sets [db client-id] (defn account-sets [db client-id]
(for [running-balance-set (->> (dc/index-range db :journal-entry-line/running-balance-tuple [client-id] [(inc client-id)]) (for [running-balance-set (->> (dc/index-range db :journal-entry-line/running-balance-tuple [client-id] [(inc client-id)])
(seq) (seq)
(partition-by (fn [{[current-client current-account current-location current-date debit credit running-balance] (map ->line)
:v}] (partition-by (fn set-partition [^Line l]
[current-client current-account current-location]))) ] [(.-account-id l) (.-location l)]))) ]
(->> running-balance-set (->> running-balance-set
(sort-by (fn [{id :e [_ _ _ current-date] :v}] (sort compare-account))))
[current-date id])))))
(defn account-snapshot [db client-id end] (defn account-snapshot [db client-id ^java.util.Date end]
(for [running-balance-set (account-sets db client-id) (for [running-balance-set (account-sets db client-id)
:let [{id :e [client-id account-id location date _ _ current-balance] :v} :let [{id :e [client-id account-id location date _ _ current-balance] :v}
(->> running-balance-set (->> running-balance-set
(take-while (fn [{id :e [_ _ _ current-date] :v}] (take-while (fn until-date [^Line l]
(<= (.compareTo current-date end) 0))) (let [^java.util.Date d (.-date l)]
(<= (.compareTo ^java.util.Date d end) 0))))
last)] last)]
:when id] :when id]
[client-id account-id location date current-balance])) [client-id account-id location date current-balance]))
(defn detailed-account-snapshot [db client-id end]
(defn detailed-account-snapshot [db client-id ^java.util.Date end]
(for [running-balance-set (account-sets db client-id) (for [running-balance-set (account-sets db client-id)
:let [{:keys [account-id client-id location current-balance debits credits count]} :let [{:keys [account-id client-id location current-balance debits credits count]}
(->> running-balance-set (->> running-balance-set
(take-while (fn [{id :e [_ _ _ current-date] :v}] (take-while (fn until-date [^Line l]
(<= (.compareTo current-date end) 0))) (let [^java.util.Date d (.-date l)]
(<= (.compareTo ^java.util.Date d end) 0))))
(reduce (reduce
(fn [acc {id :e [current-client current-account current-location current-date debit credit balance] :v}] (fn step [acc ^Line l]
(-> acc (assoc! acc
(update :count inc) :count (unchecked-inc (:count acc))
(update :debits + (or debit 0.0)) :debits (unchecked-add (:debits acc) (or (.-debit l) 0.0))
(update :credits + (or credit 0.0)) :credits (unchecked-add (:credits acc) (or (.-credit l) 0.0))
(assoc :current-balance balance :current-balance (.-running-balance l)
:account-id current-account :account-id (.-account-id l)
:client-id current-client :client-id (.-client-id l)
:location current-location))) :location (.-location l)))
{:count 0 (transient {:count 0
:debits 0.0 :debits 0.0
:credits 0.0 :credits 0.0
:current-balance 0.0}))] :current-balance 0.0})))]
:when client-id] :when client-id]
[client-id account-id location debits credits current-balance count])) [client-id account-id location debits credits current-balance count]))
(comment (comment
(detailed-account-snapshot (dc/db auto-ap.datomic/conn) (detailed-account-snapshot (dc/db auto-ap.datomic/conn)
(auto-ap.datomic/pull-id (dc/db auto-ap.datomic/conn) (auto-ap.datomic/pull-id (dc/db auto-ap.datomic/conn)
[:client/code "NGOP"]) [:client/code "NGOP"])
#inst "2024-01-01") #inst "2020-01-01")
(account-snapshot (dc/db auto-ap.datomic/conn) (account-snapshot (dc/db auto-ap.datomic/conn)
(auto-ap.datomic/pull-id (dc/db auto-ap.datomic/conn) (auto-ap.datomic/pull-id (dc/db auto-ap.datomic/conn)
[:client/code "NGOP"]) [:client/code "NGOP"])
#inst "2022-01-01") #inst "2022-01-01")
(def orig (into [] (take 5000 (mapcat (fn [ls]
(map #(.-id %) ls)) (account-sets (dc/db auto-ap.datomic/conn)
(auto-ap.datomic/pull-id (dc/db auto-ap.datomic/conn)
[:client/code "NGOP"]))))))
(def n (into [] (take 5000 (mapcat (fn [ls]
(map #(.-id %) ls)) (account-sets (dc/db auto-ap.datomic/conn)
(auto-ap.datomic/pull-id (dc/db auto-ap.datomic/conn)
[:client/code "NGOP"]))))))
(= orig n)
#_(seq (dc/q '[:find ?c ?a ?l ?date ?balance #_(seq (dc/q '[:find ?c ?a ?l ?date ?balance
:in $ :in $
:where [?c :client/code "NGOP"] :where [?c :client/code "NGOP"]

File diff suppressed because one or more lines are too long

View File

@@ -465,8 +465,6 @@
(refresh-bank-account-balances (map :db/id clients)) (refresh-bank-account-balances (map :db/id clients))
(count changes))))) (count changes)))))
(comment (comment
(pull-id (dc/db conn) [:client/code "SCCB"]) (pull-id (dc/db conn) [:client/code "SCCB"])

View File

@@ -56,7 +56,6 @@
(defn table->pdf [table widths] (defn table->pdf [table widths]
(let [cell-count (cell-count table)] (let [cell-count (cell-count table)]
(-> [:pdf-table {:header (mapv (-> [:pdf-table {:header (mapv
(fn [header] (fn [header]
(map cell->pdf header)) (map cell->pdf header))

View File

@@ -94,7 +94,7 @@
"sales" "sales"
(#{::payment-routes/all-page ::payment-routes/pending-page ::payment-routes/cleared-page ::payment-routes/voided-page} (:matched-route request)) (#{::payment-routes/all-page ::payment-routes/pending-page ::payment-routes/cleared-page ::payment-routes/voided-page} (:matched-route request))
"payments" "payments"
(#{::ledger-routes/all-page ::ledger-routes/external-page ::ledger-routes/external-import-page} (:matched-route request)) (#{::ledger-routes/all-page ::ledger-routes/external-page ::ledger-routes/external-import-page ::ledger-routes/balance-sheet} (:matched-route request))
"ledger" "ledger"
:else :else
nil)] nil)]
@@ -303,8 +303,20 @@
:profit-and-loss-detail)} "Profit & Loss Detail") :profit-and-loss-detail)} "Profit & Loss Detail")
(menu-button- {:href (bidi/path-for client-routes/routes (menu-button- {:href (bidi/path-for client-routes/routes
:cash-flows)} "Cash Flows") :cash-flows)} "Cash Flows")
(menu-button- {:href (bidi/path-for client-routes/routes
:balance-sheet)} "Balance Sheet") (if (is-admin? (:identity request))
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
::ledger-routes/balance-sheet))
:active? (= ::ledger-routes/balance-sheet (:matched-route request))
:hx-boost "true"}
[:div.flex.gap-2
"Balance Sheet"
(tags/pill- {:color :secondary} "WIP")])
(menu-button- {:href (bidi/path-for client-routes/routes
:balance-sheet)} "Balance Sheet"))
(when (is-admin? (:identity request))
(menu-button- {:href (bidi/path-for client-routes/routes
:balance-sheet)} "Old Balance Sheet"))
(when (can? (:identity request) (when (can? (:identity request)
{:subject :ledger {:subject :ledger
:activity :import}) :activity :import})

View File

@@ -1,11 +1,11 @@
(ns auto-ap.ssr.components.inputs (ns auto-ap.ssr.components.inputs
(:require (:require [auto-ap.ssr.components.buttons :as buttons]
[hiccup2.core :as hiccup] [auto-ap.ssr.components.tags :as tags]
[auto-ap.ssr.hiccup-helper :as hh] [auto-ap.ssr.hiccup-helper :as hh]
[clojure.string :as str] [auto-ap.ssr.hx :as hx]
[auto-ap.ssr.svg :as svg] [auto-ap.ssr.svg :as svg]
[auto-ap.ssr.components.tags :as tags] [clojure.string :as str]
[auto-ap.ssr.hx :as hx])) [hiccup2.core :as hiccup]))
(def default-input-classes (def default-input-classes
@@ -169,9 +169,23 @@
"x-bind:value" "v" "x-bind:value" "v"
))]] ))]]
[:div.flex.w-full.justify-items-stretch [:div.flex.w-full.justify-items-stretch
[:span.flex-grow.text-left [:span {"x-text" "value.size"} ] [:div.flex-grow.flex
" selected"] [:template {:x-if "value.size > 0"}
[:a.bg-blue-100.rounded-full.px-3 {:x-data "popper()"}
[:span.text-left {:x-ref "source"}
[:span {"x-text" "value.size"}]
" selected"]
(buttons/tooltip- {:x-bind "tooltip" }
[:div.flex.flex-wrap.gap-4.w-64
[:template {:x-for "v in Array.from(value.values())"}
[:div.bg-green-50.rounded-full.px-3.text-ellipsis.whitespace-nowrap.shrink.overflow-hidden.text-green-800 {:x-text "lookup[v]"}]]])]]
[:template {:x-if "value.size == 0"}
[:span.text-left.text-gray-400 "None selected"]]
[:div {:class "w-4 h-4 ml-2 inline text-gray-500 self-center rounded-full bg-gray-100 text-gray-500"
"@click.prevent.stop" "value = new Set([])"
:x-show "value.size > 0"}
svg/x]]
[:div {:class "w-3 h-3 m-1 inline ml-1 justify-self-end text-gray-500 self-center"} [:div {:class "w-3 h-3 m-1 inline ml-1 justify-self-end text-gray-500 self-center"}
svg/drop-down] svg/drop-down]
[:div {:x-show "value.warning" [:div {:x-show "value.warning"

View File

@@ -1,10 +1,12 @@
(ns auto-ap.ssr.ledger.balance-sheet (ns auto-ap.ssr.ledger.balance-sheet
(:require [auto-ap.datomic (:require [amazonica.aws.s3 :as s3]
[auto-ap.datomic
:refer [conn pull-many]] :refer [conn pull-many]]
[auto-ap.graphql.utils :refer [assert-can-see-client]] [auto-ap.graphql.utils :refer [assert-can-see-client]]
[auto-ap.ledger :refer [build-account-lookup]] [auto-ap.ledger :refer [build-account-lookup]]
[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.permissions :refer [wrap-must]] [auto-ap.permissions :refer [wrap-must]]
[auto-ap.routes.ledger :as route] [auto-ap.routes.ledger :as route]
[auto-ap.routes.utils [auto-ap.routes.utils
@@ -13,19 +15,25 @@
[auto-ap.ssr.components :as com] [auto-ap.ssr.components :as com]
[auto-ap.ssr.form-cursor :as fc] [auto-ap.ssr.form-cursor :as fc]
[auto-ap.ssr.hx :as hx] [auto-ap.ssr.hx :as hx]
[auto-ap.ssr.svg :as svg]
[auto-ap.ssr.ui :refer [base-page]] [auto-ap.ssr.ui :refer [base-page]]
[auto-ap.ssr.utils [auto-ap.ssr.utils
:refer [apply-middleware-to-all-handlers clj-date-schema :refer [apply-middleware-to-all-handlers clj-date-schema
field-validation-error html-response wrap-form-4xx-2 html-response modal-response wrap-form-4xx-2
wrap-merge-prior-hx wrap-schema-decode wrap-merge-prior-hx wrap-schema-enforce]]
wrap-schema-enforce]]
[auto-ap.time :as atime] [auto-ap.time :as atime]
[bidi.bidi :as bidi] [bidi.bidi :as bidi]
[clj-pdf.core :as pdf]
[clj-time.coerce :as coerce] [clj-time.coerce :as coerce]
[clj-time.core :as t]
[clojure.java.io :as io]
[clojure.string :as str] [clojure.string :as str]
[config.core :refer [env] :as env]
[datomic.api :as dc] [datomic.api :as dc]
[iol-ion.utils :refer [by]] [iol-ion.utils :refer [by]]
[malli.core :as mc])) [malli.core :as mc])
(:import [java.util UUID]
[org.apache.commons.io.output ByteArrayOutputStream]))
@@ -193,126 +201,134 @@
;; 3. General cleanup of the patterns in run-balance-sheet ;; 3. General cleanup of the patterns in run-balance-sheet
;; 4. Review ledger dialog ;; 4. Review ledger dialog
(defn get-report [{ {:keys [date comparison-date include-comparison client] :as qp} :query-params :as request}]
(when (and date client)
(let [client-ids (map :db/id client)
_ (doseq [client-id client-ids]
(assert-can-see-client (:identity request) client-id))
end-date (coerce/to-date date)
comparable-date (coerce/to-date comparison-date)
lookup-account (->> client-ids
(map (fn build-lookup [client-id]
[client-id (build-account-lookup client-id)]))
(into {}))
data (cond-> {:balance-sheet-accounts (into []
(mapcat
(fn calculate-accounts [client-id ]
(for [
[client-id account-id location debits credits balance count] (iol-ion.query/detailed-account-snapshot (dc/db conn) client-id end-date)
:let [account ( (or (lookup-account client-id) {}) account-id)]]
{:client-id client-id
:account-id account-id
:location location
:debits debits
:credits credits
:count count
:amount balance
:account-type (:account_type account)
:numeric-code (:numeric_code account)
:name (:name account) }))
client-ids))}
(and include-comparison comparison-date)
(assoc :comparable-balance-sheet-accounts
(into []
(mapcat
(fn calculate-accounts [client-id ]
(for [
[client-id account-id location debits credits balance count] (iol-ion.query/detailed-account-snapshot (dc/db conn) client-id comparable-date)
:let [account ( (or (lookup-account client-id) {}) account-id)]]
{:client-id client-id
:account-id account-id
:location location
:debits debits
:credits credits
:count count
:amount balance
:account-type (:account_type account)
:numeric-code (:numeric_code account)
:name (:name account) }))
client-ids)))
)
args (assoc (:query-params request)
:periods (filter identity (cond-> [date]
include-comparison (conj comparison-date))))
clients (pull-many (dc/db conn) [:client/code :client/name :db/id] client-ids)
data (concat (->> (:balance-sheet-accounts data)
(map (fn [b]
(assoc b
:period (:date args)))))
(->> (:comparable-balance-sheet-accounts data)
(map (fn [b]
(assoc b
:period (:comparison-date args))))))
pnl-data (l-reports/->PNLData args data (by :db/id :client/code clients))
report (l-reports/summarize-balance-sheet pnl-data) ]
(alog/info ::balance-sheet :params args)
{:data report
:report report})))
(defn balance-sheet* [{ {:keys [date comparison-date include-comparison client] } :query-params :as request}] (defn balance-sheet* [{ {:keys [date comparison-date include-comparison client] } :query-params :as request}]
[:div#report [:div#report
(when (and date client) (when (and date client)
(let [client-ids (map :db/id client) (let [{:keys [data report]} (get-report request)
client-count (count (set (map :client-id (:data data)))) ]
_ (doseq [client-id client-ids]
(assert-can-see-client (:identity request) client-id))
end-date (coerce/to-date date)
comparable-date (coerce/to-date comparison-date)
lookup-account (->> client-ids
(map (fn build-lookup [client-id]
[client-id (build-account-lookup client-id)]))
(into {}))
data (cond-> {:balance-sheet-accounts (into []
(mapcat
(fn calculate-accounts [client-id ]
(for [
[client-id account-id location debits credits balance count] (iol-ion.query/detailed-account-snapshot (dc/db conn) client-id end-date)
:let [account ( (or (lookup-account client-id) {}) account-id)]]
{:client-id client-id
:account-id account-id
:location location
:debits debits
:credits credits
:count count
:amount balance
:account-type (:account_type account)
:numeric-code (:numeric_code account)
:name (:name account) }))
client-ids))}
(and include-comparison comparison-date)
(assoc :comparable-balance-sheet-accounts
(into []
(mapcat
(fn calculate-accounts [client-id ]
(for [
[client-id account-id location debits credits balance count] (iol-ion.query/detailed-account-snapshot (dc/db conn) client-id comparable-date)
:let [account ( (or (lookup-account client-id) {}) account-id)]]
{:client-id client-id
:account-id account-id
:location location
:debits debits
:credits credits
:count count
:amount balance
:account-type (:account_type account)
:numeric-code (:numeric_code account)
:name (:name account) }))
client-ids)))
)
args (assoc (:query-params request)
:periods (filter identity (cond-> [date]
include-comparison (conj comparison-date))))
clients (pull-many (dc/db conn) [:client/code :client/name :db/id] client-ids)
data (concat (->> (:balance-sheet-accounts data)
(map (fn [b]
(assoc b
:period (:date args)))))
(->> (:comparable-balance-sheet-accounts data)
(map (fn [b]
(assoc b
:period (:comparison-date args))))))
pnl-data (l-reports/->PNLData args data (by :db/id :client/code clients))
client-count (count (set (map :client-id (:data pnl-data))))
report (l-reports/summarize-balance-sheet pnl-data) ]
(alog/info ::balance-sheet :params args)
(list (list
[:div.text-2xl.font-bold.text-gray-600 (str "Balance Sheet - " (str/join ", " (map :client/name clients))) ] [:div.text-2xl.font-bold.text-gray-600 (str "Balance Sheet - " (str/join ", " (map :client/name client))) ]
(table {:widths (cond-> (into [30 ] (repeat 13 client-count)) (table {:widths (cond-> (into [30 ] (repeat 13 client-count))
(:include-comparison args) (into (repeat 13 (* 2 client-count)))) (:include-comparison (:args data)) (into (repeat 13 (* 2 client-count))))
:click-event ::investigate-clicked :click-event ::investigate-clicked
:table report} ))))]) :table report} ))))])
(defn form* [request] (defn form* [request]
(let [params (merge (:query-params request) (:form-params request) {})] (let [params (merge (:query-params request) (:form-params request) {})]
(fc/start-form (fc/start-form
params params
(:form-errors request) (:form-errors request)
[:div#balance-sheet-form.flex.flex-col.gap-4.mt-4 [:div#balance-sheet-form.flex.flex-col.gap-4.mt-4
[:form {:hx-get (bidi.bidi/path-for ssr-routes/only-routes ::route/run-balance-sheet) [:div.flex.gap-8
:hx-target "#balance-sheet-form" [:form {:hx-get (bidi.bidi/path-for ssr-routes/only-routes ::route/run-balance-sheet)
:hx-swap "outerHTML"} :hx-target "#balance-sheet-form"
[:div.flex.gap-8 {:x-data (hx/json {:comparison (boolean (:include-comparison params))})} :hx-swap "outerHTML"
(fc/with-field :client :hx-disabled-elt "find fieldset"}
(com/validated-inline-field [:fieldset
{:label "Customers" :errors (fc/field-errors)} [:div.flex.gap-8 {:x-data (hx/json {:comparison (boolean (:include-comparison params))})}
(com/multi-typeahead {:name (fc/field-name) (fc/with-field :client
:class "w-64" (com/validated-inline-field
:id "client" {:label "Customers" :errors (fc/field-errors)}
:url (bidi/path-for ssr-routes/only-routes :company-search) (com/multi-typeahead {:name (fc/field-name)
:value (fc/field-value) :class "w-64"
:value-fn :db/id :id "client"
:content-fn :client/name}))) :url (bidi/path-for ssr-routes/only-routes :company-search)
(fc/with-field :date :value (or (fc/field-value)
(com/validated-inline-field {:label "Date" (take 5 (:clients request)))
:errors (fc/field-errors)} :value-fn :db/id
(com/date-input {:placeholder "12/21/2020" :content-fn :client/name})))
:name (fc/field-name) (fc/with-field :date
:value (some-> (fc/field-value) (com/validated-inline-field {:label "Date"
(atime/unparse-local atime/normal-date))}))) :errors (fc/field-errors)}
(fc/with-field :include-comparison (com/date-input {:placeholder "12/21/2020"
(com/toggle {:x-model "comparison" :name (fc/field-name) :checked (boolean (fc/field-value))} "Compare")) :name (fc/field-name)
[:div (hx/alpine-appear {:x-show "comparison"}) :value (some->
(fc/with-field :comparison-date (or (fc/field-value) (t/now))
(com/validated-inline-field {:label "Previous Date" (atime/unparse-local atime/normal-date))})))
:errors (fc/field-errors)} (fc/with-field :include-comparison
(com/toggle {:x-model "comparison" :name (fc/field-name) :checked (boolean (fc/field-value))} "Compare"))
[:div (hx/alpine-appear {:x-show "comparison"})
(fc/with-field :comparison-date
(com/validated-inline-field {:label "Previous Date"
:errors (fc/field-errors)}
(com/date-input {:placeholder "12/21/2020" (com/date-input {:placeholder "12/21/2020"
:name (fc/field-name) :name (fc/field-name)
:value (some-> (fc/field-value) :value (some-> (or (fc/field-value) (t/plus (t/now) (t/years -1)))
(atime/unparse-local atime/normal-date))})))] (atime/unparse-local atime/normal-date))})))]
(com/button {:color :primary :class "w-32"} (com/button {:color :primary :class "w-32"}
"Run")]] "Run")
(com/button {:formaction (bidi.bidi/path-for ssr-routes/only-routes ::route/export-balance-sheet) } "Export PDF")]]] ]
(balance-sheet* request)]))) (balance-sheet* request)])))
(defn form [request] (defn form [request]
@@ -335,6 +351,71 @@
(form* request)) (form* request))
"Balance Sheet")) "Balance Sheet"))
(defn make-balance-sheet-pdf [request report]
(let [ output-stream (ByteArrayOutputStream.)
client-count (count (or (seq (:client (:query-params request)))
(seq (:client (:form-params request)))))]
(pdf/pdf
(-> [{:left-margin 10 :right-margin 10 :top-margin 15 :bottom-margin 15
:size :letter
:font {:size 6
:ttf-name "fonts/calibri-light.ttf"}}
[:heading (str "Balance Sheet - " (str/join ", " (map :client/name (or (seq (:client (:query-params request)))
(seq (:client (:form-params request)))))))]]
(conj [:paragraph {:color [128 0 0] :size 9} (:warning report)])
(conj
(table->pdf report
(cond-> (into [30 ] (repeat client-count 13))
(or (:include-comparison (:query-params request))
(:include-comparison (:form-params request))) (into (repeat (* 2 client-count) 13))))))
output-stream)
(.toByteArray output-stream)))
(defn print-balance-sheet [request]
(let [uuid (str (UUID/randomUUID))
pdf-data (make-balance-sheet-pdf request (:report (get-report request)))
name "test" #_(balance-sheet-args->name args)
key (str "reports/balance-sheet/" uuid "/" name ".pdf")
url (str "https://" (:data-bucket env) "/" key)]
(s3/put-object :bucket-name (:data-bucket env/env)
:key key
:input-stream (io/make-input-stream pdf-data {})
:metadata {:content-length (count pdf-data)
:content-type "application/pdf"})
@(dc/transact conn
[{:report/name name
:report/client (map :db/id (:client (:query-params request)))
:report/key key
:report/url url
:report/creator (:user (:identity request))
:report/created (java.util.Date.)}])
{:report/name name
:report/url url }))
(defn export [request]
(modal-response
(com/modal {}
(com/modal-card
{}
"Ready!"
(com/modal-body {}
[:div.flex.flex-col.mt-4.space-y-4.items-center
[:a {:href (:report/url (print-balance-sheet request))}
[:div.w-24.h-24.bg-green-50.rounded-full.p-4.text-green-300 {:class " hover:scale-110 transition duration-100"}
svg/download]]
[:span.text-gray-800
"Click "
(com/link {:href (:report/url (print-balance-sheet request))} "here")
" to download"]
])
nil))
:headers (-> {}
(assoc "hx-retarget" ".modal-stack")
(assoc "hx-reswap" "beforeend"))))
(def key->handler (def key->handler
(apply-middleware-to-all-handlers (apply-middleware-to-all-handlers
(-> (->
@@ -343,7 +424,11 @@
(wrap-form-4xx-2 balance-sheet)) (wrap-form-4xx-2 balance-sheet))
::route/run-balance-sheet (-> form ::route/run-balance-sheet (-> form
(wrap-schema-enforce :query-schema query-schema) (wrap-schema-enforce :query-schema query-schema)
(wrap-form-4xx-2 form))}) (wrap-form-4xx-2 form))
::route/export-balance-sheet (-> export
(wrap-schema-enforce :query-schema query-schema)
(wrap-form-4xx-2 form))}
)
(fn [h] (fn [h]
(-> h (-> h
(wrap-merge-prior-hx) (wrap-merge-prior-hx)

View File

@@ -8,4 +8,5 @@
"/table" ::table "/table" ::table
"/bank-account-filter" ::bank-account-filter "/bank-account-filter" ::bank-account-filter
"/reports/balance-sheet" {"" ::balance-sheet "/reports/balance-sheet" {"" ::balance-sheet
"run" ::run-balance-sheet}}) "/run" ::run-balance-sheet
"/export" ::export-balance-sheet}})