various fixes.

This commit is contained in:
2023-09-06 13:34:08 -07:00
parent 558fc58371
commit 766be867f7
4 changed files with 32 additions and 10 deletions

View File

@@ -66,13 +66,19 @@
(.atZone (java.time.ZoneId/of "US/Pacific"))
(.get java.time.temporal.ChronoField/DAY_OF_MONTH)))
(defn next-day [d]
(some-> d
coerce/to-date-time
(time/plus (time/days 1))
coerce/to-date))
(defn scan-invoices [db clients start end]
(for [c clients
:let [c (entid db c)]
r (seq (dc/index-range db
:invoice/client+date
[c (or start #inst "2001-01-01T08:00:00.000-00:00") ]
[c (or end #inst "2030-03-05T08:00:00.000-00:00") ]))]
[c (or (next-day end) #inst "2030-03-05T08:00:00.000-00:00") ]))]
[(:e r) (first (:v r)) (second (:v r))]))
(defn scan-transactions [db clients start end]
@@ -81,7 +87,7 @@
r (seq (dc/index-range db
:transaction/client+date
[c (or start #inst "2001-01-01T08:00:00.000-00:00") ]
[c (or end #inst "2030-03-05T08:00:00.000-00:00") ]))]
[c (or (next-day end) #inst "2030-03-05T08:00:00.000-00:00") ]))]
[(:e r) (first (:v r)) (second (:v r))]))
(defn scan-ledger [db clients start end]
@@ -90,7 +96,7 @@
r (seq (dc/index-range db
:journal-entry/client+date
[c (or start #inst "2001-01-01T08:00:00.000-00:00") ]
[c (or end #inst "2030-03-05T08:00:00.000-00:00") ]))]
[c (or (next-day end) #inst "2030-03-05T08:00:00.000-00:00") ]))]
[(:e r) (first (:v r)) (second (:v r))]))
(defn scan-payments [db clients start end]
@@ -99,5 +105,5 @@
r (seq (dc/index-range db
:payment/client+date
[c (or start #inst "2001-01-01T08:00:00.000-00:00") ]
[c (or end #inst "2030-03-05T08:00:00.000-00:00") ]))]
[c (or (next-day end) #inst "2030-03-05T08:00:00.000-00:00") ]))]
[(:e r) (first (:v r)) (second (:v r))]))