transactions page progress.
This commit is contained in:
27
dev-resources/BAI Test Report(1).csv
Normal file
27
dev-resources/BAI Test Report(1).csv
Normal file
@@ -0,0 +1,27 @@
|
||||
1,121142287,121142287,230808,1435,1,,,2/,,,,,,
|
||||
2,,121142287,1,230807,,USD,2/,,,,,,,
|
||||
3,502009095,USD,15,4471085,0,,40,7416920,0,,45,4471085,0,/
|
||||
16,191,1104372,,,,TRANSFER FROM BASIC BUSINESS CHECK ACCOUNT XXXXXX9103/,,,,,,,,
|
||||
16,451,4050207,,19620409,,AMEX EPAYMENT ACH PMT A8334/,,,,,,,,
|
||||
49,21513669,4/,,,,,,,,,,,,
|
||||
3,502006000,USD,15,5533562,0,,40,4784698,0,,45,5533562,0,/
|
||||
16,108,18815,,142939792,,Deposit/,,,,,,,,
|
||||
16,108,17955,,142939789,,Deposit/,,,,,,,,
|
||||
16,108,17530,,142939793,,Deposit/,,,,,,,,
|
||||
16,108,15340,,142939795,,Deposit/,,,,,,,,
|
||||
16,108,15290,,142939794,,Deposit/,,,,,,,,
|
||||
16,108,14735,,142939790,,Deposit/,,,,,,,,
|
||||
16,108,14140,,142939791,,Deposit/,,,,,,,,
|
||||
16,191,747488,,,,TRANSFER FROM BASIC BUSINESS CHECK ACCOUNT XXXXXX8469/,,,,,,,,
|
||||
16,191,85171,,,,TRANSFER FROM BASIC BUSINESS CHECK ACCOUNT XXXXXX8451/,,,,,,,,
|
||||
16,475,197600,,910147509,1196,Check Paid/,,,,,,,,
|
||||
49,16995886,12/,,,,,,,,,,,,
|
||||
3,502009137,USD,15,4153082,0,,40,3572123,0,,45,4153082,0,/
|
||||
16,191,572495,,,,TRANSFER FROM BASIC BUSINESS CHECK ACCOUNT XXXXXX9145/,,,,,,,,
|
||||
16,191,58464,,,,TRANSFER FROM BASIC BUSINESS CHECK ACCOUNT XXXXXX9152/,,,,,,,,
|
||||
16,475,50000,,910039240,547,Check Paid/,,,,,,,,
|
||||
49,12559246,5/,,,,,,,,,,,,
|
||||
3,502008527,USD,15,0,0,,40,0,0,,45,0,0,/
|
||||
49,0,2/,,,,,,,,,,,,
|
||||
98,51068801,4,25/,,,,,,,,,,,
|
||||
99,51068801,1,27/,,,,,,,,,,,
|
||||
|
27
dev-resources/BAI Test Report.csv
Normal file
27
dev-resources/BAI Test Report.csv
Normal file
@@ -0,0 +1,27 @@
|
||||
1,121142287,121142287,230808,1435,1,,,2/,,,,,,
|
||||
2,,121142287,1,230807,,USD,2/,,,,,,,
|
||||
3,502009095,USD,15,4471085,0,,40,7416920,0,,45,4471085,0,/
|
||||
16,191,1104372,,,,TRANSFER FROM BASIC BUSINESS CHECK ACCOUNT XXXXXX9103/,,,,,,,,
|
||||
16,451,4050207,,19620409,,AMEX EPAYMENT ACH PMT A8334/,,,,,,,,
|
||||
49,21513669,4/,,,,,,,,,,,,
|
||||
3,502006000,USD,15,5533562,0,,40,4784698,0,,45,5533562,0,/
|
||||
16,108,18815,,142939792,,Deposit/,,,,,,,,
|
||||
16,108,17955,,142939789,,Deposit/,,,,,,,,
|
||||
16,108,17530,,142939793,,Deposit/,,,,,,,,
|
||||
16,108,15340,,142939795,,Deposit/,,,,,,,,
|
||||
16,108,15290,,142939794,,Deposit/,,,,,,,,
|
||||
16,108,14735,,142939790,,Deposit/,,,,,,,,
|
||||
16,108,14140,,142939791,,Deposit/,,,,,,,,
|
||||
16,191,747488,,,,TRANSFER FROM BASIC BUSINESS CHECK ACCOUNT XXXXXX8469/,,,,,,,,
|
||||
16,191,85171,,,,TRANSFER FROM BASIC BUSINESS CHECK ACCOUNT XXXXXX8451/,,,,,,,,
|
||||
16,475,197600,,910147509,1196,Check Paid/,,,,,,,,
|
||||
49,16995886,12/,,,,,,,,,,,,
|
||||
3,502009137,USD,15,4153082,0,,40,3572123,0,,45,4153082,0,/
|
||||
16,191,572495,,,,TRANSFER FROM BASIC BUSINESS CHECK ACCOUNT XXXXXX9145/,,,,,,,,
|
||||
16,191,58464,,,,TRANSFER FROM BASIC BUSINESS CHECK ACCOUNT XXXXXX9152/,,,,,,,,
|
||||
16,475,50000,,910039240,547,Check Paid/,,,,,,,,
|
||||
49,12559246,5/,,,,,,,,,,,,
|
||||
3,502008527,USD,15,0,0,,40,0,0,,45,0,0,/
|
||||
49,0,2/,,,,,,,,,,,,
|
||||
98,51068801,4,25/,,,,,,,,,,,
|
||||
99,51068801,1,27/,,,,,,,,,,,
|
||||
|
BIN
dev-resources/BAI2 Code List.docx
Normal file
BIN
dev-resources/BAI2 Code List.docx
Normal file
Binary file not shown.
BIN
dev-resources/_RE~_BAI_Test_File_-__08212023.zip
Normal file
BIN
dev-resources/_RE~_BAI_Test_File_-__08212023.zip
Normal file
Binary file not shown.
File diff suppressed because one or more lines are too long
165
src/clj/auto_ap/fix_unlinked_payments.fiddle
Normal file
165
src/clj/auto_ap/fix_unlinked_payments.fiddle
Normal file
@@ -0,0 +1,165 @@
|
||||
|
||||
(def to-remove (dc/q '[:find (pull ?p [{:payment/client [:client/code]}
|
||||
[:payment/date :xform clj-time.coerce/from-date]
|
||||
:payment/amount
|
||||
:db/id])
|
||||
:where [?ip :invoice-payment/payment ?p]
|
||||
[?p :payment/status :payment-status/cleared]
|
||||
(not [?ip :invoice-payment/invoice]) ]
|
||||
(dc/db conn)))
|
||||
|
||||
#'user/to-remove
|
||||
|
||||
(def to-remove-ids (into #{} (map (comp :db/id first) to-remove)))
|
||||
|
||||
|
||||
(def new-invoice-fixes
|
||||
(into [] (dc/q '[:find ?ip ?pi ?pa ?deleted-invoice-number ?target-i ?target-total
|
||||
:in $ $$ [ ?pi ...]
|
||||
:where
|
||||
[?pi :payment/client ?c]
|
||||
[?c :client/code "NGPX"]
|
||||
[?pi :payment/amount ?pa]
|
||||
[?ip :invoice-payment/payment ?pi]
|
||||
(not [?ip :invoice-payment/invoice])
|
||||
[$$ ?ip :invoice-payment/invoice ?deleted-i _ true]
|
||||
[$$ ?deleted-i :invoice/invoice-number ?deleted-invoice-number _ true]
|
||||
[?target-i :invoice/client ?c]
|
||||
[?target-i :invoice/status :invoice-status/unpaid]
|
||||
[?target-i :invoice/invoice-number ?deleted-invoice-number]
|
||||
[?target-i :invoice/total ?target-total]
|
||||
#_[(iol-ion.query/dollars= ?target-total ?deleted-i-total)]]
|
||||
(dc/db conn)
|
||||
(dc/history (dc/db conn))
|
||||
to-remove-ids)))
|
||||
|
||||
|
||||
(reduce
|
||||
(fn [acc [pi t invoice number a]]
|
||||
(-> acc
|
||||
(assoc-in [ pi :total] t)
|
||||
(update-in [ pi :fixes-total] (fnil + 0.0) a)
|
||||
(update-in [ pi :fixes-list] (fnil conj []) [invoice number])))
|
||||
{}
|
||||
new-invoice-fixes )
|
||||
|
||||
;;=> {17592295145246
|
||||
;; {:total 3026.2300000000005,
|
||||
;; :fixes-total 4074.4900000000016,
|
||||
;; :fixes-list
|
||||
;; [["549126264" 17592339946782]
|
||||
;; ["549127019" 17592339946787]
|
||||
;; ["549117468" 17592339946772]
|
||||
;; ["549130300" 17592339946792]
|
||||
;; ["549121810" 17592339946777]
|
||||
;; ["549114455" 17592339946767]
|
||||
;; ["549137551" 17592339946802]]},
|
||||
;; 17592295143072
|
||||
;; {:total 7360.6,
|
||||
;; :fixes-total 3888.9599999999996,
|
||||
;; :fixes-list
|
||||
;; [["549136814" 17592339946797]
|
||||
;; ["549139494" 17592339946807]
|
||||
;; ["549139495" 17592339946812]]}}
|
||||
;;
|
||||
|
||||
(def link-to-new-invoices (for [[ip _ _ _ i] new-invoice-fixes
|
||||
n [[:db/add ip :invoice-payment/invoice i]
|
||||
[:db/add i :invoice/status :invoice-status/paid]
|
||||
[:db/add i :invoice/outstanding-balance 0.0]]]
|
||||
n))
|
||||
|
||||
(def with-new-invoice-fixes (:db-after (dc/with (dc/db conn)
|
||||
link-to-new-invoices)))
|
||||
|
||||
|
||||
(def recreate-invoice-fixes
|
||||
(into []
|
||||
(dc/q '[:find (pull $$$ ?deleted-i [*] ) ?extant-ledger ?ip
|
||||
:in $ $$ $$$ [ ?p ...]
|
||||
:where
|
||||
[?p :payment/client ?c]
|
||||
[?p :payment/amount ?a]
|
||||
[?c :client/code "NGPX"]
|
||||
[?ip :invoice-payment/payment ?p]
|
||||
(not [?ip :invoice-payment/invoice])
|
||||
[$$ ?ip :invoice-payment/invoice ?deleted-i _ true]
|
||||
[$$ ?deleted-i :invoice/invoice-number ?deleted-invoice-number _ true]
|
||||
[$$ ?deleted-i :invoice/total ?deleted-invoice-total _ true]
|
||||
[$$ ?extant-ledger :journal-entry/original-entity ?deleted-i _ true]
|
||||
[?extant-ledger :journal-entry/date ?d]
|
||||
(not [?extant-ledger :journal-entry/original-entity ?deleted-i])
|
||||
#_[?target-i :invoice/client ?c]
|
||||
#_[?target-i :invoice/status :invoice-status/unpaid]
|
||||
#_[?target-i :invoice/invoice-number ?deleted-invoice-number]
|
||||
#_[?target-i :invoice/total ?target-total]
|
||||
#_[(iol-ion.query/dollars= ?target-total ?deleted-i-total)]]
|
||||
|
||||
with-new-invoice-fixes
|
||||
(dc/history (dc/db conn))
|
||||
(dc/as-of (dc/db conn) #inst "2023-10-01")
|
||||
|
||||
to-remove-ids)))
|
||||
|
||||
;;=> #'user/recreate-invoice-fixes
|
||||
;;
|
||||
recreate-invoice-fixes
|
||||
|
||||
(def recreate-invoices
|
||||
(for [[{:keys [db/id] :as i} je ip] recreate-invoice-fixes
|
||||
n [(assoc i :invoice/status :invoice-status/paid :invoice/outstanding-balance 0.0)
|
||||
{:db/id ip :invoice-payment/invoice id}
|
||||
{:db/id je :journal-entry/original-entity id}]]
|
||||
n))
|
||||
|
||||
to-remove-ids
|
||||
(def with-recreate-invoices
|
||||
(:db-after (dc/with
|
||||
with-new-invoice-fixes
|
||||
recreate-invoices
|
||||
)))
|
||||
|
||||
|
||||
|
||||
|
||||
(into []
|
||||
(dc/q '[:find ?a (sum ?ipa) (sum ?it) (pull ?p [:payment/amount :payment/date :payment/memo {:invoice-payment/_payment [:invoice-payment/amount {:invoice-payment/invoice [:invoice/invoice-number :invoice/total]}]}])
|
||||
:with ?ip
|
||||
:in $ [ ?p ...]
|
||||
:where
|
||||
[?p :payment/client ?c]
|
||||
[?p :payment/amount ?a]
|
||||
[?c :client/code "NGPX"]
|
||||
[?ip :invoice-payment/payment ?p]
|
||||
[?ip :invoice-payment/amount ?ipa ]
|
||||
[?ip :invoice-payment/invoice ?i]
|
||||
[?i :invoice/total ?it]
|
||||
#_(not [?ip :invoice-payment/invoice])
|
||||
#_[$$ ?ip :invoice-payment/invoice ?deleted-i _ true]
|
||||
#_[$$ ?deleted-i :invoice/invoice-number ?deleted-invoice-number _ true]
|
||||
#_[$$ ?deleted-i :invoice/total ?deleted-invoice-total _ true]
|
||||
#_[$$ ?extant-ledger :journal-entry/original-entity ?deleted-i _ true]
|
||||
#_[?extant-ledger :journal-entry/date ?d]
|
||||
#_(not [?extant-ledger :journal-entry/original-entity ?deleted-i])
|
||||
#_[?target-i :invoice/client ?c]
|
||||
#_[?target-i :invoice/status :invoice-status/unpaid]
|
||||
#_[?target-i :invoice/invoice-number ?deleted-invoice-number]
|
||||
#_[?target-i :invoice/total ?target-total]
|
||||
#_[(iol-ion.query/dollars= ?target-total ?deleted-i-total)]]
|
||||
with-recreate-invoices
|
||||
|
||||
|
||||
to-remove-ids))
|
||||
|
||||
|
||||
|
||||
(dc/pull (dc/db conn)
|
||||
'[*]
|
||||
17592295143072)
|
||||
|
||||
|
||||
(reverse (sort (dc/q '[:find ?d
|
||||
:where [?je :journal-entry/source "invoice"]
|
||||
(not [?je :journal-entry/original-entity])
|
||||
[?je :journal-entry/date ?d]]
|
||||
(dc/db conn))))
|
||||
@@ -259,6 +259,7 @@
|
||||
:oob (or oob []))))
|
||||
|
||||
(def next-handler
|
||||
|
||||
(-> (fn [{:keys [wizard] :as request}]
|
||||
(let [current-step (get-current-step wizard)]
|
||||
(if (satisfies? CustomNext current-step)
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
[auto-ap.ssr-routes :as ssr-routes]
|
||||
[auto-ap.ssr.components :as com]
|
||||
[auto-ap.ssr.components.link-dropdown :refer [link-dropdown]]
|
||||
[auto-ap.ssr.transaction.edit :as edit]
|
||||
[auto-ap.ssr.grid-page-helper :as helper :refer [wrap-apply-sort]]
|
||||
[auto-ap.ssr.hx :as hx]
|
||||
[auto-ap.ssr.ledger :refer [wrap-ensure-bank-account-belongs]]
|
||||
@@ -271,17 +272,10 @@
|
||||
::route/new)}
|
||||
"Add Transaction")])
|
||||
:row-buttons (fn [request entity]
|
||||
[#_(when (and (can? (:identity request) {:subject :transaction :activity :edit}))
|
||||
(com/icon-button {:hx-put (bidi/path-for ssr-routes/only-routes
|
||||
::route/edit-wizard
|
||||
:db/id (:db/id entity))}
|
||||
svg/pencil))
|
||||
#_(when (and (can? (:identity request) {:subject :transaction :activity :delete}))
|
||||
(com/icon-button {:hx-delete (bidi/path-for ssr-routes/only-routes
|
||||
::route/delete
|
||||
:db/id (:db/id entity))
|
||||
:hx-confirm "Are you sure you want to delete this transaction?"}
|
||||
svg/trash))])
|
||||
[(com/icon-button {:hx-get (bidi/path-for ssr-routes/only-routes
|
||||
::route/edit-wizard
|
||||
:db/id (:db/id entity))}
|
||||
svg/pencil)])
|
||||
|
||||
:breadcrumbs [[:a {:href (bidi/path-for ssr-routes/only-routes ::route/page)}
|
||||
"Transactions"]]
|
||||
@@ -290,6 +284,10 @@
|
||||
:entity-name "register"
|
||||
:route ::route/table
|
||||
:csv-route ::route/csv
|
||||
:table-attributes (fn [_]
|
||||
{:hx-trigger "refreshTable from:body"
|
||||
:hx-get (bidi/path-for ssr-routes/only-routes ::route/table)
|
||||
:hx-target "#entity-table"})
|
||||
:break-table (fn [request entity]
|
||||
(cond
|
||||
(= (-> request :query-params :sort first :name) "Vendor")
|
||||
@@ -375,18 +373,19 @@
|
||||
(def csv (helper/csv-route grid-page))
|
||||
|
||||
(def key->handler
|
||||
(apply-middleware-to-all-handlers
|
||||
{::route/page page
|
||||
::route/table table
|
||||
::route/csv csv
|
||||
::route/bank-account-filter bank-account-filter}
|
||||
(fn [h]
|
||||
(-> h
|
||||
(wrap-copy-qp-pqp)
|
||||
(wrap-apply-sort grid-page)
|
||||
(merge edit/key->handler
|
||||
(apply-middleware-to-all-handlers
|
||||
{::route/page page
|
||||
::route/table table
|
||||
::route/csv csv
|
||||
::route/bank-account-filter bank-account-filter}
|
||||
(fn [h]
|
||||
(-> h
|
||||
(wrap-copy-qp-pqp)
|
||||
(wrap-apply-sort grid-page)
|
||||
(wrap-ensure-bank-account-belongs)
|
||||
(wrap-merge-prior-hx)
|
||||
(wrap-schema-enforce :query-schema query-schema)
|
||||
(wrap-schema-enforce :hx-schema query-schema)
|
||||
(wrap-must {:activity :view :subject :transaction})
|
||||
(wrap-client-redirect-unauthenticated)))))
|
||||
(wrap-schema-enforce :query-schema query-schema)
|
||||
(wrap-schema-enforce :hx-schema query-schema)
|
||||
(wrap-must {:activity :view :subject :transaction})
|
||||
(wrap-client-redirect-unauthenticated))))))
|
||||
1078
src/clj/auto_ap/ssr/transaction/edit.clj
Normal file
1078
src/clj/auto_ap/ssr/transaction/edit.clj
Normal file
File diff suppressed because it is too large
Load Diff
@@ -329,7 +329,7 @@
|
||||
|
||||
#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
|
||||
(defn tx-detail [i]
|
||||
(map (juxt :e #(pull-attr (dc/db conn) :db/ident (:a %)) :v)
|
||||
(map (juxt :e #(pull-attr (dc/db conn) :db/ident (:a %)) :v :added)
|
||||
(:data (first
|
||||
(dc/tx-range (dc/log conn)
|
||||
i
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
(ns auto-ap.routes.transactions)
|
||||
|
||||
(def routes {"" {:get ::page}
|
||||
(def routes {"" {:get ::page
|
||||
:put ::edit-wizard-navigate}
|
||||
"/new" {:get ::new
|
||||
:post ::new-submit
|
||||
"/location-select" ::location-select
|
||||
@@ -13,5 +14,18 @@
|
||||
"/import" ::external-import-import}
|
||||
|
||||
"/table" ::table
|
||||
"/csv" ::csv
|
||||
"/bank-account-filter" ::bank-account-filter })
|
||||
"/csv" ::csv
|
||||
"/bank-account-filter" ::bank-account-filter
|
||||
|
||||
["/" [#"\d+" :db/id]] {"/edit" {:get ::edit-wizard
|
||||
} }
|
||||
"/edit-submit" ::edit-submit
|
||||
"/location-select" ::location-select
|
||||
"/account-total" ::account-total
|
||||
"/account-balance" ::account-balance
|
||||
"/edit-wizard-new-account" ::edit-wizard-new-account
|
||||
"/match-payment" ::match-payment
|
||||
"/match-autopay-invoices" ::match-autopay-invoices
|
||||
"/match-unpaid-invoices" ::match-unpaid-invoices
|
||||
"/apply-rule" ::apply-rule
|
||||
"/unlink-payment" ::unlink-payment})
|
||||
Reference in New Issue
Block a user