progress on reports.

This commit is contained in:
2024-11-10 22:09:14 -08:00
parent eed9bfbd11
commit df3183f85c
7 changed files with 54 additions and 33 deletions

View File

@@ -472,6 +472,7 @@
(mark-all-clients-dirty)
(clients-needing-refresh (dc/db conn))
(upsert-running-balance)

View File

@@ -341,6 +341,7 @@
(update :class (fnil hh/add-class "") default-input-classes)
(assoc :x-modelable "value")
(assoc :type "text")
(assoc "autocomplete" "off")
(assoc :x-data (hx/json {:dp nil}) )
(assoc :x-init " dp = initDatepicker($el);")
(assoc "@htmx:before-history-save" "destroyDatepicker(dp)" )

View File

@@ -33,7 +33,8 @@
[config.core :refer [env] :as env]
[datomic.api :as dc]
[iol-ion.utils :refer [by]]
[malli.core :as mc])
[malli.core :as mc]
[medley.core :refer [map-vals]])
(:import
[java.util UUID]
[org.apache.commons.io.output ByteArrayOutputStream]))
@@ -84,7 +85,7 @@
data (into []
(for [client-id client-ids
p periods
[client-id account-id location debits credits balance count] (iol-ion.query/detailed-account-snapshot (dc/db conn) client-id (coerce/to-date (:end p)))
[client-id account-id location debits credits balance count] (iol-ion.query/detailed-account-snapshot (dc/db conn) client-id (coerce/to-date (:end p)) (coerce/to-date (:start p)))
:let [account ((or (lookup-account client-id) {}) account-id)]]
{:client-id client-id
:account-id account-id
@@ -92,7 +93,11 @@
:debits debits
:credits credits
:count count
:amount balance
:amount (if (#{:account-type/asset
:account-type/dividend
:account-type/expense} (:account_type account))
(- (or debits 0.0) (or credits 0.0))
(- (or credits 0.0) (or debits 0.0)))
:account-type (:account_type account)
:numeric-code (:numeric_code account)
:name (:name account)
@@ -120,7 +125,7 @@
(let [{:keys [client warning]} (maybe-trim-clients request client)
{:keys [data report]} (get-report (assoc-in request [:form-params :client] client))
client-count (count (set (map :client-id (:data data))))
table-contents (concat-tables (:details report))]
table-contents (concat-tables (concat (:summaries report) (:details report)))]
(list
[:div.text-2xl.font-bold.text-gray-600 (str "Profit and loss - " (str/join ", " (map :client/name client)))]
(table {:widths (into [20] (take (dec (cell-count table-contents))