fully removes old invoice experience

This commit is contained in:
2024-08-09 20:32:32 -07:00
parent e947b4592c
commit 1bb8387051
21 changed files with 268 additions and 2333 deletions

View File

@@ -468,3 +468,236 @@
(dc/pull (dc/db conn) '[* {:bank-account/_plaid-account [:bank-account/code]}] 17592310327452)
(seq (dc/q '[:find ?ns
:in $ $$ ?log
:where
[$$ ?x :audit/user "admin-Ashlee Phillips"]
[(tx-data ?log ?x) [[?e ?a ?v _ ?added]]]
[?a :db/ident ?a2]
[(namespace ?a2) ?ns]
]
(dc/db conn)
(dc/history (dc/since (dc/db conn) #inst "2024-06-15T00:00:00-08:00"))
(dc/log conn)))
(dc/q '[:find ?d2 ?ns ?code ?a2 ?added (count ?x)
:in $ $$ ?log
:where
[$$ ?x :audit/user "admin-Ashlee Phillips"]
[(tx-data ?log ?x) [[?e ?a ?v _ ?added]]]
[(get-some $$ ?e :transaction/client :invoice/client :payment/client :journal-entry/client) [?attr ?c]]
[?c :client/code ?code]
[?a :db/ident ?a2]
[(namespace ?a2) ?ns]
[?x :db/txInstant ?d]
[(iol-ion.query/excel-date ?d) ?d2]]
(dc/db conn)
(dc/history (dc/since (dc/db conn) #inst "2024-07-01T00:00:00-08:00"))
(dc/log conn))
(defn join-attrs [xs]
(clojure.string/join ", " (sort xs)))
(comment
"Behaviors in time region"
(clojure.data.csv/write-csv *out*
(concat
(->> (dc/q '[:find ?d2 ?code ?entity ?e ?desc (user/join-attrs ?attr)
:in $$$ $$ $ ?log
:where
[$$ ?x :audit/user "admin-Ashlee Phillips"]
[(tx-data ?log ?x) [[?e ?a ?v _ ?added]]]
($$$ or-join [?e ?c]
[?c :client/bank-accounts ?e]
[?e :account-client-override/client ?c]
[?e :journal-entry/client ?c]
(and [?t :transaction/accounts ?e]
[?t :transaction/client ?c])
(and [?e :client/code]
[?e ?c])
(and [?je :journal-entry/line-items ?e]
[?je :journal-entry/client ?c])
[?e :payment/client ?c]
[?e :invoice/client ?c]
(and [?i :invoice/expense-accounts ?e]
[?i :invoice/client ?c])
[?e :transaction/client ?c]
(and [?e :invoice-payment/invoice ?i]
[?i :invoice/client ?c])
#_[(ground 0) ?c])
[(get-else $ ?c :client/code "") ?code]
[?a :db/ident ?a2]
[(namespace ?a2) ?entity]
[(name ?a2) ?attr]
#_[(= ?a3 "account-client-override")]
[?x :db/txInstant ?d]
[(iol-ion.query/excel-date ?d) ?d2]
[(if ?added "changed" "replaced/deleted") ?desc]]
(dc/history (dc/db conn))
(dc/history (dc/since (dc/db conn) #inst "2024-06-15T00:00:00-08:00"))
(dc/db conn)
(dc/log conn))
seq)
(->> (dc/q '[:find ?d2 ?code ?entity ?e ?desc (user/join-attrs ?attr)
:in $$$ $$ $ ?log
:where
[$$ ?x :audit/user "admin-Ashlee Phillips"]
[(tx-data ?log ?x) [[?e ?a ?v _ ?added]]]
[(ground "") ?code]
[?a :db/ident ?a2]
[(namespace ?a2) ?entity]
(not
[(get #{"invoice" "transaction" "account-client-override" "journal-entry"
"journal-entry-line" "bank-account" "payment" "invoice-payment"
"client" "invoice-expense-account" "transaction-account"} ?entity)])
[(name ?a2) ?attr]
#_[(= ?a3 "account-client-override")]
[?x :db/txInstant ?d]
[(iol-ion.query/excel-date ?d) ?d2]
[(if ?added "changed" "replaced/deleted") ?desc]]
(dc/history (dc/db conn))
(dc/history (dc/since (dc/db conn) #inst "2024-06-15T00:00:00-08:00"))
(dc/db conn)
(dc/log conn))
seq))
:separator \tab)
)
(clojure.data.csv/write-csv *out*
(concat
(->> (dc/q '[:find ?d2 ?code ?entity (count ?e)
:in $$$ $$ $ ?log
:where
[$$ ?x :audit/user "admin-Ashlee Phillips"]
[(tx-data ?log ?x) [[?e ?a ?v _ ?added]]]
($$$ or-join [?e ?c]
[?c :client/bank-accounts ?e]
[?e :account-client-override/client ?c]
[?e :journal-entry/client ?c]
(and [?t :transaction/accounts ?e]
[?t :transaction/client ?c])
(and [?e :client/code]
[?e ?c])
(and [?je :journal-entry/line-items ?e]
[?je :journal-entry/client ?c])
[?e :payment/client ?c]
[?e :invoice/client ?c]
(and [?i :invoice/expense-accounts ?e]
[?i :invoice/client ?c])
[?e :transaction/client ?c]
(and [?e :invoice-payment/invoice ?i]
[?i :invoice/client ?c])
#_[(ground 0) ?c])
[(get-else $ ?c :client/code "") ?code]
[?a :db/ident ?a2]
[(namespace ?a2) ?entity]
[(name ?a2) ?attr]
#_[(= ?a3 "account-client-override")]
[?x :db/txInstant ?d]
[(iol-ion.query/excel-date ?d) ?d2]
[(if ?added "changed" "replaced/deleted") ?desc]]
(dc/history (dc/db conn))
(dc/history (dc/since (dc/db conn) #inst "2024-06-15T00:00:00-08:00"))
(dc/db conn)
(dc/log conn))
seq)
(->> (dc/q '[:find ?d2 ?code ?entity (count ?e)
:in $$$ $$ $ ?log
:where
[$$ ?x :audit/user "admin-Ashlee Phillips"]
[(tx-data ?log ?x) [[?e ?a ?v _ ?added]]]
[(ground "") ?code]
[?a :db/ident ?a2]
[(namespace ?a2) ?entity]
(not
[(get #{"invoice" "transaction" "account-client-override" "journal-entry"
"journal-entry-line" "bank-account" "payment" "invoice-payment"
"client" "invoice-expense-account" "transaction-account"} ?entity)])
[(name ?a2) ?attr]
#_[(= ?a3 "account-client-override")]
[?x :db/txInstant ?d]
[(iol-ion.query/excel-date ?d) ?d2]
[(if ?added "changed" "replaced/deleted") ?desc]]
(dc/history (dc/db conn))
(dc/history (dc/since (dc/db conn) #inst "2024-06-15T00:00:00-08:00"))
(dc/db conn)
(dc/log conn))
seq))
:separator \tab)
(clojure.data.csv/write-csv *out*
(concat
(->> (dc/q '[:find ?code ?entity (count ?e)
:in $$$ $$ $ ?log
:where
[$$ ?x :audit/user "admin-Ashlee Phillips"]
[(tx-data ?log ?x) [[?e ?a ?v _ ?added]]]
($$$ or-join [?e ?c]
[?c :client/bank-accounts ?e]
[?e :account-client-override/client ?c]
[?e :journal-entry/client ?c]
(and [?t :transaction/accounts ?e]
[?t :transaction/client ?c])
(and [?e :client/code]
[?e ?c])
(and [?je :journal-entry/line-items ?e]
[?je :journal-entry/client ?c])
[?e :payment/client ?c]
[?e :invoice/client ?c]
(and [?i :invoice/expense-accounts ?e]
[?i :invoice/client ?c])
[?e :transaction/client ?c]
(and [?e :invoice-payment/invoice ?i]
[?i :invoice/client ?c])
#_[(ground 0) ?c])
[(get-else $ ?c :client/code "") ?code]
[?a :db/ident ?a2]
[(namespace ?a2) ?entity]
[(name ?a2) ?attr]
#_[(= ?a3 "account-client-override")]
[?x :db/txInstant ?d]
[(iol-ion.query/excel-date ?d) ?d2]
[(if ?added "changed" "replaced/deleted") ?desc]]
(dc/history (dc/db conn))
(dc/history (dc/since (dc/db conn) #inst "2024-06-15T00:00:00-08:00"))
(dc/db conn)
(dc/log conn))
seq)
(->> (dc/q '[:find ?code ?entity (count ?e)
:in $$$ $$ $ ?log
:where
[$$ ?x :audit/user "admin-Ashlee Phillips"]
[(tx-data ?log ?x) [[?e ?a ?v _ ?added]]]
[(ground "") ?code]
[?a :db/ident ?a2]
[(namespace ?a2) ?entity]
(not
[(get #{"invoice" "transaction" "account-client-override" "journal-entry"
"journal-entry-line" "bank-account" "payment" "invoice-payment"
"client" "invoice-expense-account" "transaction-account"} ?entity)])
[(name ?a2) ?attr]
#_[(= ?a3 "account-client-override")]
[?x :db/txInstant ?d]
[(iol-ion.query/excel-date ?d) ?d2]
[(if ?added "changed" "replaced/deleted") ?desc]]
(dc/history (dc/db conn))
(dc/history (dc/since (dc/db conn) #inst "2024-06-15T00:00:00-08:00"))
(dc/db conn)
(dc/log conn))
seq))
:separator \tab)
(dc/q '[:find ?c
:in $ [?e ...]
:where (or-join [?e ?c]
[?e :invoice/client ?c]
[?e :transaction/client ?c])]
(dc/db conn)
[17592296942460])
1