From ed22f9d0cc059bd075a453222fea3dd57c1acdd6 Mon Sep 17 00:00:00 2001 From: Bryce Date: Tue, 30 Jul 2024 21:05:00 -0700 Subject: [PATCH] Removes plaid matching, disables payment for scheduled. --- .gitignore | 1 + src/clj/auto_ap/import/plaid.clj | 2 +- src/clj/auto_ap/ssr/invoices.clj | 33 +++++++++++++++++++++----------- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index 1a187aa9..fa6f0382 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,4 @@ data/solr/data/logs data/solr/logs .vscode/** sysco-poller/**/*.csv +.aider* diff --git a/src/clj/auto_ap/import/plaid.clj b/src/clj/auto_ap/import/plaid.clj index 828074c8..6e8120a6 100644 --- a/src/clj/auto_ap/import/plaid.clj +++ b/src/clj/auto_ap/import/plaid.clj @@ -56,7 +56,7 @@ (:merchant_name t) (assoc :transaction/plaid-merchant {:plaid-merchant/name (:merchant_name t) :db/id (random-tempid)}) (not (str/blank? (:check_number t))) (assoc :transaction/check-number (Integer/parseInt (:check_number t))) - (plaid-merchant->vendor-id (:merchant_name t)) (assoc :transaction/default-vendor + #_#_(plaid-merchant->vendor-id (:merchant_name t)) (assoc :transaction/default-vendor (plaid-merchant->vendor-id (:merchant_name t))))) (defn build-plaid-merchant->vendor-id [] diff --git a/src/clj/auto_ap/ssr/invoices.clj b/src/clj/auto_ap/ssr/invoices.clj index 16ddec0a..7e604bad 100644 --- a/src/clj/auto_ap/ssr/invoices.clj +++ b/src/clj/auto_ap/ssr/invoices.clj @@ -344,6 +344,14 @@ (defn pay-button* [params] (let [ids (:ids params) + ids (if (seq ids) + (map first + (dc/q '[:find ?i + :in $ [?i ...] + :where (not [?i :invoice/scheduled-payment])] + (dc/db conn) + ids)) + ids) selected-client-count (if (seq ids) (ffirst (dc/q '[:find (count ?c) @@ -392,10 +400,10 @@ :x-ref "button" :minimal-loading? true :class "relative"} - (if (> (count (:ids params)) 0) + (if (> (count ids) 0) (format "Pay %d invoices ($%,.2f)" - (count (:ids params)) + (count ids) (or total 0.0)) "Pay") (when (or (= 0 (count ids)) @@ -516,16 +524,18 @@ (some-> due (atime/unparse-local atime/normal-date)))} {:key "status" :name "Status" - :render (fn [{:invoice/keys [status]}] - (condp = status - :invoice-status/paid + :render (fn [{:invoice/keys [status scheduled-payment]}] + (cond (= status :invoice-status/paid) (com/pill {:color :primary} "Paid") - - :invoice-status/unpaid - (com/pill {:color :secondary} "Unpaid") - :invoice-status/voided + (= status :invoice-status/voided) (com/pill {:color :red} "Voided") - nil + + scheduled-payment + (com/pill {:color :yellow} "Scheduled") + + (= status :invoice-status/unpaid) + (com/pill {:color :secondary} "Unpaid") + :else ""))} {:key "accounts" :name "Account" @@ -1197,7 +1207,8 @@ (->> (dc/q '[:find ?i :in $ [?i ...] :where [?i :invoice/status :invoice-status/unpaid] - [?i :invoice/client ?c]] + [?i :invoice/client ?c] + (not [?i :invoice/scheduled-payment])] (dc/db conn) ids) (map first)))