report updates for nick the greek.
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
|
||||
(defn process-sqs []
|
||||
(lc/with-context {:source "import-uploaded-invoices"}
|
||||
|
||||
(try
|
||||
(log/info "Fetching messages from sqs...")
|
||||
(doseq [message (:messages (sqs/receive-message {:queue-url (:invoice-import-queue-url env)
|
||||
|
||||
@@ -150,7 +150,7 @@
|
||||
args (assoc args
|
||||
:periods (filter identity (cond-> [(:date args)]
|
||||
(:include-comparison args) (conj (:comparison-date args)))))
|
||||
clients (d/pull-many (d/db conn) '[:client/name :db/id] [(:client-id args)])
|
||||
clients (d/pull-many (d/db conn) '[:client/code :client/name :db/id] [(:client-id args)])
|
||||
data (concat (->> (:balance-sheet-accounts data)
|
||||
(map (fn [b]
|
||||
(assoc b
|
||||
@@ -159,7 +159,7 @@
|
||||
(map (fn [b]
|
||||
(assoc b
|
||||
:period (:comparison-date args))))))
|
||||
pnl-data (l-reports/->PNLData args data (by :db/id clients))
|
||||
pnl-data (l-reports/->PNLData args data (by :db/id :client/code clients))
|
||||
report (l-reports/summarize-balance-sheet pnl-data)
|
||||
output-stream (ByteArrayOutputStream.)]
|
||||
(log/info report)
|
||||
@@ -181,7 +181,7 @@
|
||||
|
||||
(let [data (<-graphql data)
|
||||
args (<-graphql args)
|
||||
clients (d/pull-many (d/db conn) '[:client/name :db/id] (:client-ids args))
|
||||
clients (d/pull-many (d/db conn) '[:client/code :client/name :db/id] (:client-ids args))
|
||||
data (->> data
|
||||
:periods
|
||||
(mapcat (fn [p1 p2]
|
||||
@@ -192,7 +192,7 @@
|
||||
(:accounts p2))
|
||||
)
|
||||
(:periods args)))
|
||||
pnl-data (l-reports/->PNLData args data (by :db/id clients))
|
||||
pnl-data (l-reports/->PNLData args data (by :db/id :client/code clients))
|
||||
report (l-reports/summarize-pnl pnl-data)
|
||||
output-stream (ByteArrayOutputStream.)]
|
||||
(pdf/pdf
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
(ns auto-ap.square.core
|
||||
(:require [auto-ap.datomic :refer [conn remove-nils]]
|
||||
[auto-ap.time :as atime]
|
||||
[c(daily-results )lj-http.client :as client]
|
||||
[clj-http.client :as client]
|
||||
[clj-time.coerce :as coerce]
|
||||
[clj-time.core :as time]
|
||||
[clj-time.periodic :as periodic]
|
||||
@@ -12,7 +12,6 @@
|
||||
[datomic.api :as d]
|
||||
[mount.core :as mount]
|
||||
[unilog.context :as lc]
|
||||
#_{:clj-kondo/ignore [:unused-namespace]}
|
||||
[yang.scheduler :as scheduler]
|
||||
[clojure.core.async :as async]))
|
||||
|
||||
|
||||
@@ -304,8 +304,9 @@
|
||||
(if (-> pnl-data :args :column-per-location)
|
||||
(mapcat
|
||||
(fn [p]
|
||||
(cond-> [(merge {:value (or (
|
||||
-> p :filters :location) "Total")
|
||||
(cond-> [(merge {:value (or (when (-> p :filters :location)
|
||||
(str ((-> p :client-codes) (-> p :filters :client-id)) "-" (-> p :filters :location)))
|
||||
"Total")
|
||||
:align :right}
|
||||
(:cell-args p))
|
||||
(merge {:value "%"
|
||||
@@ -470,8 +471,9 @@
|
||||
(if (-> pnl-data :args :column-per-location)
|
||||
[(location-summary-table (mapcat identity (for [[period i] (map vector (-> pnl-data :args :periods ) (range))]
|
||||
(concat
|
||||
(for [location (set (map second (client-locations pnl-data)))]
|
||||
(for [[client-id location] (client-locations pnl-data)]
|
||||
(-> pnl-data
|
||||
(filter-client client-id)
|
||||
(filter-location location)
|
||||
(filter-period period)
|
||||
(zebra i)))
|
||||
@@ -488,9 +490,10 @@
|
||||
:details
|
||||
(doall (if (-> pnl-data :args :column-per-location)
|
||||
[(location-detail-table (mapcat identity (for [[period i] (map vector (-> pnl-data :args :periods ) (range))]
|
||||
(concat
|
||||
(for [location (set (map second (client-locations pnl-data)))]
|
||||
(concat
|
||||
(for [[client-id location] (client-locations pnl-data)]
|
||||
(-> pnl-data
|
||||
(filter-client client-id)
|
||||
(filter-location location)
|
||||
(filter-period period)
|
||||
(zebra i)))
|
||||
@@ -557,4 +560,4 @@
|
||||
:rows table}))
|
||||
|
||||
|
||||
(defrecord PNLData [args data client-names])
|
||||
(defrecord PNLData [args data client-codes])
|
||||
|
||||
@@ -82,7 +82,9 @@
|
||||
encode-period
|
||||
(:periods (:data db)))
|
||||
:clients (mapv #(select-keys % [:name :id]) (:clients (:data db))) }
|
||||
:db (dissoc db :report)})))
|
||||
:db (-> db
|
||||
(dissoc :report)
|
||||
(update-in [:data :clients] #(into [] (filter seq %))))})))
|
||||
|
||||
(defn email-body [report-url]
|
||||
(js/encodeURIComponent
|
||||
@@ -440,11 +442,11 @@ NOTE: Please review the transactions we may have question for you here: https://
|
||||
)
|
||||
(:accounts p2)))
|
||||
(:periods args)))
|
||||
client-names (->> @(re-frame/subscribe [::subs/clients-by-id])
|
||||
client-codes (->> @(re-frame/subscribe [::subs/clients-by-id])
|
||||
(map (fn [[k v]]
|
||||
[k (:name v)]))
|
||||
[k (:code v)]))
|
||||
(into {}))
|
||||
pnl-data (l-reports/->PNLData args pnl-data client-names)
|
||||
pnl-data (l-reports/->PNLData args pnl-data client-codes)
|
||||
report (l-reports/summarize-pnl pnl-data)
|
||||
table (rtable/concat-tables (concat (:summaries report) (:details report)))]
|
||||
[:div
|
||||
|
||||
@@ -144,7 +144,8 @@
|
||||
(for [[i override] (map vector (range) value)
|
||||
:let [is-disabled? (if (= false allow-change?)
|
||||
(not (boolean (:new? override)))
|
||||
nil)]]
|
||||
nil)]
|
||||
]
|
||||
^{:key (:key override)}
|
||||
[:div.level
|
||||
[:div.level-left
|
||||
@@ -174,9 +175,12 @@
|
||||
(filter (fn [r]
|
||||
(not= [:key :new?] (keys r)))
|
||||
(assoc-in value (into [i] (get-in template [1 :field]))
|
||||
(if (and e (.. e -target))
|
||||
(.. e -target -value )
|
||||
e) ))))
|
||||
(update
|
||||
(if (and e (.. e -target))
|
||||
(.. e -target -value )
|
||||
e)
|
||||
:key
|
||||
(fnil identity (random-uuid))) ))))
|
||||
(on-change (mapv
|
||||
(fn [v]
|
||||
(dissoc v :new? :key))
|
||||
|
||||
Reference in New Issue
Block a user