From 1178e723d12ab48869eb254dc18a8e91f1b9493a Mon Sep 17 00:00:00 2001 From: Bryce Covert Date: Tue, 14 Dec 2021 07:38:05 -0800 Subject: [PATCH] fixes client bug when investigating --- src/clj/user.clj | 4 +++- .../auto_ap/views/pages/ledger/profit_and_loss.cljs | 10 +++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/clj/user.clj b/src/clj/user.clj index 6d701e4a..744761bb 100644 --- a/src/clj/user.clj +++ b/src/clj/user.clj @@ -658,6 +658,7 @@ invoice (d/entity db invoice-id) current-total (:invoice/total invoice) target-total (invoice-totals invoice-id) ;; TODO should include expense accounts not visible + _ (println current-total target-total) new-account? (not (boolean (or (some-> invoice-expense-account-id not-empty Long/parseLong) (:db/id (first (:invoice/expense-accounts invoice)))))) @@ -685,7 +686,8 @@ [?ip :invoice-payment/amount ?a] [?ip :invoice-payment/payment ?p] ] - db invoice-id))]] + db invoice-id))] + :when current-total] [ (when (not (auto-ap.utils/dollars= current-total target-total)) 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 26564569..517ab614 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 @@ -231,13 +231,13 @@ ))) -(defn data-params->query-params [params] +(defn data-params->query-params [params client-id] (when params {:start (:start params 0) :sort (:sort params) :per-page (:per-page params) :vendor-id (:id (:vendor params)) - :client-id (:client-id params ) + :client-id client-id :from-numeric-code (:from-numeric-code params) :to-numeric-code (:to-numeric-code params) :location (:location params) @@ -252,7 +252,11 @@ {:graphql {:token user :owns-state {:single [::data-page/page ::ledger]} :query-obj {:venia/queries [[:ledger-page - {:filters (data-params->query-params ledger-params)} + {:filters (data-params->query-params ledger-params + (->> (get-in db [::forms/forms ::form :data]) + :clients + first + :id ))} [[:journal-entries [:id :source :original-entity