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

@@ -166,7 +166,7 @@
(filter (comp in-range? :numeric-code))
(filter #(not= "A" (:location %)))
(group-by (juxt :client-id :location))
(filter (fn [[_ as]]
(filter (fn [[_ as]]
(not (dollars-0? (reduce + 0 (map (comp or-0 :amount) as))))))
(mapcat second)
(map (fn [a]
@@ -185,11 +185,11 @@
(:location x))]))))
(defn aggregate-accounts [pnl-data]
(reduce (fnil + 0.0) 0.0 (map :amount (:data pnl-data))))
(reduce (fnil + 0.0) 0.0 (map (comp or-0 :amount) (:data pnl-data))))
(defn aggregate-cashflow-accounts [pnl-data]
(reduce (fnil + 0.0) 0.0 (map (fn [d]
(cashflow-account->amount (:numeric-code d) (:amount d)))
(reduce (fnil + 0.0) 0.0 (map (comp or-0 (fn [d]
(cashflow-account->amount (:numeric-code d) (:amount d))))
(:data pnl-data))))
(defn aggregate-credits [pnl-data]
@@ -260,6 +260,8 @@
(defn filter-period [pnl-data period]
(-> pnl-data
(update :data (fn [data]
#_(println "THE PERIOD IS" period
(take 3 ((group-by :period data) period)))
((group-by :period data) period)))
(update :filters (fn [f]
(assoc f :date-range period)))))
@@ -498,6 +500,10 @@
this-name-exists? (->> (:data p)
(filter (comp #{name} :name))
seq)]
(if ( = 40000 numeric-code)
(do (println "TEST HERE" numeric-code)
(clojure.pprint/pprint pnl-data))
)
(merge
(if this-name-exists?
{:format :dollar