Recalculates running balance as report is run
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
[auto-ap.datomic
|
||||
:refer [conn pull-many]]
|
||||
[auto-ap.graphql.utils :refer [assert-can-see-client]]
|
||||
[auto-ap.ledger :refer [build-account-lookup]]
|
||||
[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]]
|
||||
@@ -72,6 +72,8 @@
|
||||
_ (doseq [client-id client-ids]
|
||||
(assert-can-see-client (:identity request) client-id))
|
||||
|
||||
_ (upsert-running-balance (into #{} client-ids))
|
||||
|
||||
lookup-account (->> client-ids
|
||||
(map (fn build-lookup [client-id]
|
||||
[client-id (build-account-lookup client-id)]))
|
||||
@@ -184,10 +186,10 @@
|
||||
|
||||
(defn make-balance-sheet-pdf [request report]
|
||||
|
||||
(let [ output-stream (ByteArrayOutputStream.)
|
||||
(let [output-stream (ByteArrayOutputStream.)
|
||||
client-count (count (or (seq (:client (:query-params request)))
|
||||
(seq (:client (:form-params request)))))
|
||||
date (:date (:query-params request))]
|
||||
date (:date (:query-params request)) ]
|
||||
(pdf/pdf
|
||||
(-> [{:left-margin 10 :right-margin 10 :top-margin 15 :bottom-margin 15
|
||||
:size :letter
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
[auto-ap.datomic
|
||||
:refer [conn pull-many]]
|
||||
[auto-ap.graphql.utils :refer [assert-can-see-client]]
|
||||
[auto-ap.ledger :refer [build-account-lookup]]
|
||||
[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]]
|
||||
@@ -33,8 +33,7 @@
|
||||
[config.core :refer [env] :as env]
|
||||
[datomic.api :as dc]
|
||||
[iol-ion.utils :refer [by]]
|
||||
[malli.core :as mc]
|
||||
[medley.core :refer [map-vals]])
|
||||
[malli.core :as mc])
|
||||
(:import
|
||||
[java.util UUID]
|
||||
[org.apache.commons.io.output ByteArrayOutputStream]))
|
||||
@@ -76,6 +75,7 @@
|
||||
(when (and (seq periods) client)
|
||||
(let [client (if (= :all client) (take 5 (:clients request)) client)
|
||||
client-ids (map :db/id client)
|
||||
_ (upsert-running-balance (into #{} client-ids))
|
||||
_ (doseq [client-id client-ids]
|
||||
(assert-can-see-client (:identity request) client-id))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user