(cloud) moves pay to datomic ions.
This commit is contained in:
@@ -391,3 +391,13 @@
|
||||
(if journal-entry
|
||||
(upsert-ledger db journal-entry)
|
||||
[[:db/retractEntity [:journal-entry/original-entity (:db/id transaction)]]]))))
|
||||
|
||||
|
||||
(defn pay [db e amount]
|
||||
(let [current-outstanding-balance (-> (dc/pull db [:invoice/outstanding-balance] e) :invoice/outstanding-balance)
|
||||
new-outstanding-balance (- current-outstanding-balance amount)]
|
||||
(upsert-invoice db {:db/id e
|
||||
:invoice/outstanding-balance new-outstanding-balance
|
||||
:invoice/status (if (> new-outstanding-balance 0)
|
||||
:invoice-status/unpaid
|
||||
:invoice-status/paid)})))
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
iol-ion.tx/min-by
|
||||
iol-ion.tx/propose-invoice
|
||||
iol-ion.tx/upsert-invoice
|
||||
|
||||
iol-ion.tx/upsert-transaction
|
||||
iol-ion.tx/pay
|
||||
iol-ion.query/dollars=
|
||||
iol-ion.query/dollars-0?]
|
||||
:app-name "iol-cloud"}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
[amazonica.aws.s3 :as s3]
|
||||
[auto-ap.datomic :refer [conn remove-nils plus pull-many audit-transact]]
|
||||
[auto-ap.datomic.accounts :as a]
|
||||
[iol-ion.tx :refer [upsert-invoice]]
|
||||
[iol-ion.tx :refer [upsert-invoice pay]]
|
||||
[auto-ap.datomic.bank-accounts :as d-bank-accounts]
|
||||
[auto-ap.datomic.checks :as d-checks]
|
||||
[auto-ap.datomic.clients :as d-clients]
|
||||
@@ -230,7 +230,7 @@
|
||||
[{:invoice-payment/payment (-> invoice :invoice/vendor :db/id str)
|
||||
:invoice-payment/amount invoice-amount
|
||||
:invoice-payment/invoice (:db/id invoice)}
|
||||
`(d-checks/pay ~(:db/id invoice) ~invoice-amount)])
|
||||
`(pay ~(:db/id invoice) ~invoice-amount)])
|
||||
(reduce into [])))
|
||||
|
||||
(defn base-payment [invoices vendor client bank-account _ _ invoice-amounts]
|
||||
@@ -759,8 +759,7 @@
|
||||
:mutation/void-payments void-payments
|
||||
:mutation/print-checks print-checks
|
||||
:mutation/pay-invoices-from-balance pay-invoices-from-balance
|
||||
:mutation/add-handwritten-check add-handwritten-check
|
||||
})
|
||||
:mutation/add-handwritten-check add-handwritten-check})
|
||||
|
||||
(defn attach [schema]
|
||||
(->
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
* try again to see if we can get upsert-ledger into the same transaction, making it all or nothing
|
||||
* look for all usages of transact-with-ledger
|
||||
|
||||
it looks like there are a bbunch of orrphaned customizations for accounts, breaking indexes
|
||||
upsertledger - matching transaction rule might not assign an account. Other things might not assign accounts. This is an assertion that is commented out. Determine consequence of disabling
|
||||
Double check each job still functions in the new system
|
||||
|
||||
Reference in New Issue
Block a user