From 223a3749ec04fcb273bc249174468d3f77014642 Mon Sep 17 00:00:00 2001 From: Bryce Covert Date: Wed, 2 Mar 2022 11:50:03 -0800 Subject: [PATCH] a number of small bug fixes. --- src/clj/auto_ap/graphql/checks.clj | 4 ++-- src/clj/auto_ap/graphql/invoices.clj | 4 ++-- .../auto_ap/views/pages/ledger/balance_sheet.cljs | 3 +-- .../auto_ap/views/pages/ledger/profit_and_loss.cljs | 13 +++++++++++-- src/cljs/auto_ap/views/pages/payments/table.cljs | 4 ++-- 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/clj/auto_ap/graphql/checks.clj b/src/clj/auto_ap/graphql/checks.clj index 9ef9ae49..38c350f2 100644 --- a/src/clj/auto_ap/graphql/checks.clj +++ b/src/clj/auto_ap/graphql/checks.clj @@ -413,8 +413,8 @@ (map ->graphql )) :total checks-count :count (count payments) - :start (:start args 0) - :end (+ (:start args 0) (count payments))}])) + :start (-> args :filters (:start 0) ) + :end (+ (-> args :filters (:start 0) ) (count payments))}])) (defn get-potential-payments [context args _] (let [transaction (d-transactions/get-by-id (:transaction_id args)) diff --git a/src/clj/auto_ap/graphql/invoices.clj b/src/clj/auto_ap/graphql/invoices.clj index eb8ee6f8..7f36002d 100644 --- a/src/clj/auto_ap/graphql/invoices.clj +++ b/src/clj/auto_ap/graphql/invoices.clj @@ -42,8 +42,8 @@ :total_amount total-amount :total invoice-count :count (count invoices) - :start (:start args 0) - :end (+ (:start args 0) (count invoices))}])) + :start (-> args :filters (:start 0)) + :end (+ (-> args :filters (:start 0)) (count invoices))}])) (defn get-all-invoices [context args _] (assert-admin (:id context)) diff --git a/src/cljs/auto_ap/views/pages/ledger/balance_sheet.cljs b/src/cljs/auto_ap/views/pages/ledger/balance_sheet.cljs index b411035e..461fafbc 100644 --- a/src/cljs/auto_ap/views/pages/ledger/balance_sheet.cljs +++ b/src/cljs/auto_ap/views/pages/ledger/balance_sheet.cljs @@ -348,8 +348,7 @@ [:table.table.compact.balance-sheet [:tr [:td.has-text-right "Period ending"] - (when (:include-comparison params) - [:td.has-text-right (date->str (str->date (:date params) standard))]) + [:td.has-text-right (date->str (str->date (:date params) standard))] (when (:include-comparison params) [:td.has-text-right (when (:date params) (date->str (str->date (:comparison-date params) standard)))]) diff --git a/src/cljs/auto_ap/views/pages/ledger/profit_and_loss.cljs b/src/cljs/auto_ap/views/pages/ledger/profit_and_loss.cljs index 517ab614..424bc850 100644 --- a/src/cljs/auto_ap/views/pages/ledger/profit_and_loss.cljs +++ b/src/cljs/auto_ap/views/pages/ledger/profit_and_loss.cljs @@ -812,6 +812,16 @@ (local-today)]) [:selected-period] "Year to date"])} "Year to date"]] + [:div.control + [:a.button + {:class (when (= selected-period "Full year") "is-active") + :on-click (dispatch-event + [::forms/change ::form + [:periods] + [[(t/local-date (dec (t/year (local-today))) 1 1) + (t/local-date (dec (t/year (local-today))) 12 31)]] + [:selected-period] "Last Calendar year"])} + "Last calendar year"]] [:div.control [:a.button {:class (when (= selected-period "Full year") "is-active") @@ -864,8 +874,7 @@ (defn profit-and-loss-content [] - (let [user @(re-frame/subscribe [::subs/user]) - status @(re-frame/subscribe [::status/single ::page]) + (let [status @(re-frame/subscribe [::status/single ::page]) unresolved-accounts @(re-frame/subscribe [::uncategorized-accounts]) {:keys [data report active? error id]} @(re-frame/subscribe [::forms/form ::form]) {:keys [form-inline field raw-field error-notification submit-button ]} pnl-form diff --git a/src/cljs/auto_ap/views/pages/payments/table.cljs b/src/cljs/auto_ap/views/pages/payments/table.cljs index dcb177f6..0e7adc0b 100644 --- a/src/cljs/auto_ap/views/pages/payments/table.cljs +++ b/src/cljs/auto_ap/views/pages/payments/table.cljs @@ -34,14 +34,14 @@ (re-frame/reg-event-db ::payment-voided - (fn [db [_ {:keys [void-payment]}]] + (fn [db [_ _]] db)) (defn row [{check :check selected-client :selected-client states :states }] - (let [{:keys [client s3-url bank-account payments type check-number date amount id vendor status invoices transaction] :as check} check] + (let [{:keys [client s3-url bank-account type check-number date amount id vendor status invoices transaction] :as check} check] [grid/row {:class (:class check) :id id :entity check} (when-not selected-client [grid/cell {} (:name client)])