Files
integreat/src/clj/auto_ap/jobs/close_auto_invoices.clj
Bryce ba87805d4c Add vendor pre-population for bulk code and individual edit forms
- Add vendor-changed HTMX handlers for both bulk code and individual edit
- Pre-populate default account at 100% when vendor is selected and no accounts exist
- Fix render-accounts-section to render from step-params correctly
- Change bulk code vendor-changed from hx-get to hx-post to include form data
- Add routes for vendor-changed endpoints
- Update e2e tests to cover vendor pre-population
- Run lein cljfmt fix across codebase
2026-05-21 14:45:19 -07:00

29 lines
1.2 KiB
Clojure

(ns auto-ap.jobs.close-auto-invoices
(:require
[auto-ap.datomic :refer [conn]]
[auto-ap.jobs.core :refer [execute]]
[auto-ap.time :as time]
[clj-time.coerce :as coerce]
[auto-ap.logging :as alog]
[datomic.api :as dc]))
(defn close-auto-invoices []
(let [invoices-to-close (dc/q {:find ['?e]
:in ['$ '?today]
:where ['[?e :invoice/scheduled-payment ?d]
'[?e :invoice/status :invoice-status/unpaid]
'[(<= ?d ?today)]]}
(dc/db conn) (coerce/to-date (time/local-now)))]
(alog/info ::closing :count (count invoices-to-close))
@(dc/transact conn (some->> invoices-to-close
seq
(mapv (fn [[i]] {:db/id i
:invoice/outstanding-balance 0.0
:invoice/status :invoice-status/paid}))))
(alog/info ::closed :count (count invoices-to-close))))
(defn -main [& _]
(execute "close-auto-invoices" close-auto-invoices))