Adds the ability to filter down to unbalanced

This commit is contained in:
2025-03-11 21:07:51 -07:00
parent 3d65816d9c
commit 581033001b
5 changed files with 92 additions and 47 deletions

View File

@@ -54,5 +54,4 @@
(comment
(regenerate-literals)
(auto-ap.datomic/install-functions)
)
(auto-ap.datomic/install-functions))

View File

@@ -12,7 +12,17 @@
db
(:invoice/invoice-number invoice)
(:invoice/client invoice)
(:invoice/vendor invoice))))]
(if existing?
(:invoice/vendor invoice))))
[ locked-until] (first (dc/q '[:find ?locked-until
:in $ ?c
:where [?c :client/locked-until ?locked-until]]
db
(:invoice/client invoice)))
is-locked? (cond
(not locked-until) false
(not (:invoice/date invoice)) true
(< (compare (:invoice/date invoice) locked-until) 0) true
:else false)]
(if (or existing? is-locked?)
[]
[[:upsert-invoice invoice]])))