makes glimpse more forgiving and adds column headers

This commit is contained in:
2023-10-10 16:08:21 -07:00
parent 3383d12998
commit c00940fcbf
2 changed files with 27 additions and 17 deletions

View File

@@ -90,11 +90,11 @@
first)])))) first)]))))
deduplicate) deduplicate)
vendor-name-options (->> (stack-rank #{"VENDOR_NAME"} lookup) vendor-name-options (->> (stack-rank #{"VENDOR_NAME"} lookup)
(map (fn [t] (mapcat (fn [t]
[t (->> (solr/query solr/impl "vendors" {"query" (format "name:(%s) ", t) "fields" "score, *"}) (for [m (->> (solr/query solr/impl "vendors" {"query" (format "name:(%s) ", t) "fields" "score, *"})
(filter (fn [d] (> (:score d) 4.0))) (filter (fn [d] (> (:score d) 2.0)))
(map (comp #(Long/parseLong %) :id)) (map (comp #(Long/parseLong %) :id)))]
first)])) [t m])))
(deduplicate)) (deduplicate))
date-options (->> (stack-rank #{"INVOICE_RECEIPT_DATE" "ORDER_DATE" "DELIVERY_DATE"} lookup) date-options (->> (stack-rank #{"INVOICE_RECEIPT_DATE" "ORDER_DATE" "DELIVERY_DATE"} lookup)
(map (fn [t] (map (fn [t]
@@ -189,6 +189,7 @@ invoice_dropzone = new Dropzone(\"#invoice\", {
options]]))) options]])))
(defn textract->invoice-form* [textract-invoice] (defn textract->invoice-form* [textract-invoice]
(alog/info ::textract-invoiceform-rendering :textract-invoice textract-invoice)
[:form {:hx-post (bidi/path-for ssr-routes/only-routes [:form {:hx-post (bidi/path-for ssr-routes/only-routes
:invoice-glimpse-create-invoice :invoice-glimpse-create-invoice
:textract-invoice-id (:db/id textract-invoice))} :textract-invoice-id (:db/id textract-invoice))}
@@ -231,7 +232,7 @@ invoice_dropzone = new Dropzone(\"#invoice\", {
:textract-invoice/date :textract-invoice/date
second second
(coerce/to-date-time) (coerce/to-date-time)
(atime/unparse-local atime/iso-date)) (atime/unparse-local atime/normal-date))
:placeholder "Date"}))] :placeholder "Date"}))]
(pill-list* {:selected (:textract-invoice/date textract-invoice) (pill-list* {:selected (:textract-invoice/date textract-invoice)
:options (:textract-invoice/date-options textract-invoice) :options (:textract-invoice/date-options textract-invoice)
@@ -240,7 +241,7 @@ invoice_dropzone = new Dropzone(\"#invoice\", {
:->text (fn [[_ date]] :->text (fn [[_ date]]
(-> date (-> date
(coerce/to-date-time) (coerce/to-date-time)
(atime/unparse-local atime/iso-date)))}) (atime/unparse-local atime/normal-date)))})
[:div.col-span-2.col-start-1 [:div.col-span-2.col-start-1
(com/field {:label "Total"} (com/field {:label "Total"}
(com/money-input {:name "total" (com/money-input {:name "total"
@@ -358,7 +359,7 @@ invoice_dropzone = new Dropzone(\"#invoice\", {
(defn update-textract-invoice- [id {:strs [date total invoice-number client vendor]}] (defn update-textract-invoice- [id {:strs [date total invoice-number client vendor]}]
@(dc/transact-async conn [[:upsert-entity (cond-> {:db/id id} @(dc/transact-async conn [[:upsert-entity (cond-> {:db/id id}
date (assoc :textract-invoice/date [date (coerce/to-date (atime/parse date atime/iso-date))]) date (assoc :textract-invoice/date [date (coerce/to-date (atime/parse date atime/normal-date))])
total (assoc :textract-invoice/total [total (Double/parseDouble total)]) total (assoc :textract-invoice/total [total (Double/parseDouble total)])
invoice-number (assoc :textract-invoice/invoice-number [invoice-number invoice-number]) invoice-number (assoc :textract-invoice/invoice-number [invoice-number invoice-number])
client (assoc :textract-invoice/customer-identifier [(pull-attr (dc/db conn) :client/name (Long/parseLong client)) (Long/parseLong client)]) client (assoc :textract-invoice/customer-identifier [(pull-attr (dc/db conn) :client/name (Long/parseLong client)) (Long/parseLong client)])

View File

@@ -786,17 +786,26 @@
(defn balance-sheet-headers [pnl-data] (defn balance-sheet-headers [pnl-data]
(doto (cond-> []
[(into [{:value "Period Ending"}] (> (count (set (map :client-id (:data pnl-data)))) 1)
(conj (into [{:value "Client"}]
(mapcat identity (mapcat identity
(for [client (set (map :client-id (:data pnl-data))) ] (for [client (set (map :client-id (:data pnl-data))) ]
(cond-> [{:value (date->str (:date (:args pnl-data)))}] (cond-> [{:value (str (-> pnl-data :client-codes (get client)))}]
(:include-comparison (:args pnl-data)) (:include-comparison (:args pnl-data))
(into [{:value (date->str (:comparison-date (:args pnl-data)))} (into ["" ""]))))))
{:value "+/-"}])))))] true
println)) (conj (into [{:value "Period Ending"}]
(mapcat identity
(for [client (set (map :client-id (:data pnl-data))) ]
(cond-> [{:value (date->str (:date (:args pnl-data)))}]
(:include-comparison (:args pnl-data))
(into [{:value (date->str (:comparison-date (:args pnl-data)))}
{:value "+/-"}]))))))))
(defn append-deltas [table] (defn append-deltas [table]
(->> table (->> table