supports credits
This commit is contained in:
@@ -17,36 +17,42 @@
|
||||
[db [type id]]
|
||||
(let [{:expected-deposit/keys [total client date]} (d/pull db '[:expected-deposit/total :expected-deposit/client :expected-deposit/date] id)]
|
||||
#:journal-entry
|
||||
{:source "expected-deposit"
|
||||
:original-entity id
|
||||
{:source "expected-deposit"
|
||||
:original-entity id
|
||||
|
||||
:client client
|
||||
:date date
|
||||
:amount total
|
||||
:vendor :vendor/ccp-square
|
||||
:line-items [#:journal-entry-line
|
||||
{:credit total
|
||||
:location "A"
|
||||
:account :account/receipts-split}
|
||||
#:journal-entry-line
|
||||
{:debit total
|
||||
:location "A"
|
||||
:account :account/ccp}]}))
|
||||
:client client
|
||||
:date date
|
||||
:amount total
|
||||
:vendor :vendor/ccp-square
|
||||
:line-items [#:journal-entry-line
|
||||
{:credit total
|
||||
:location "A"
|
||||
:account :account/receipts-split}
|
||||
#:journal-entry-line
|
||||
{:debit total
|
||||
:location "A"
|
||||
:account :account/ccp}]}))
|
||||
|
||||
|
||||
|
||||
|
||||
(defn regenerate-literals []
|
||||
(require 'com.github.ivarref.gen-fn)
|
||||
(spit
|
||||
"resources/functions.edn"
|
||||
(let [datomic-fn @(resolve 'com.github.ivarref.gen-fn/datomic-fn)]
|
||||
[(datomic-fn :pay #'iol-ion.tx.pay/pay)
|
||||
(datomic-fn :plus #'iol-ion.tx.plus/plus)
|
||||
(datomic-fn :propose-invoice #'iol-ion.tx.propose-invoice/propose-invoice)
|
||||
(datomic-fn :reset-rels #'iol-ion.tx.reset-rels/reset-rels)
|
||||
(datomic-fn :reset-scalars #'iol-ion.tx.reset-scalars/reset-scalars)
|
||||
(datomic-fn :upsert-entity #'iol-ion.tx.upsert-entity/upsert-entity)
|
||||
(datomic-fn :upsert-invoice #'iol-ion.tx.upsert-invoice/upsert-invoice)
|
||||
(datomic-fn :upsert-ledger #'iol-ion.tx.upsert-ledger/upsert-ledger)
|
||||
(datomic-fn :upsert-transaction #'iol-ion.tx.upsert-transaction/upsert-transaction)])))
|
||||
(spit
|
||||
"resources/functions.edn"
|
||||
(let [datomic-fn @(resolve 'com.github.ivarref.gen-fn/datomic-fn)]
|
||||
[(datomic-fn :pay #'iol-ion.tx.pay/pay)
|
||||
(datomic-fn :plus #'iol-ion.tx.plus/plus)
|
||||
(datomic-fn :propose-invoice #'iol-ion.tx.propose-invoice/propose-invoice)
|
||||
(datomic-fn :reset-rels #'iol-ion.tx.reset-rels/reset-rels)
|
||||
(datomic-fn :reset-scalars #'iol-ion.tx.reset-scalars/reset-scalars)
|
||||
(datomic-fn :upsert-entity #'iol-ion.tx.upsert-entity/upsert-entity)
|
||||
(datomic-fn :upsert-invoice #'iol-ion.tx.upsert-invoice/upsert-invoice)
|
||||
(datomic-fn :upsert-ledger #'iol-ion.tx.upsert-ledger/upsert-ledger)
|
||||
(datomic-fn :upsert-transaction #'iol-ion.tx.upsert-transaction/upsert-transaction)])))
|
||||
|
||||
(comment
|
||||
(regenerate-literals)
|
||||
|
||||
(auto-ap.datomic/install-functions)
|
||||
)
|
||||
@@ -6,6 +6,6 @@
|
||||
new-outstanding-balance (- current-outstanding-balance amount)]
|
||||
[[:upsert-invoice {:db/id e
|
||||
:invoice/outstanding-balance new-outstanding-balance
|
||||
:invoice/status (if (> new-outstanding-balance 0)
|
||||
:invoice-status/unpaid
|
||||
:invoice-status/paid)}]]))
|
||||
:invoice/status (if (< -0.0001 new-outstanding-balance 0.0001)
|
||||
:invoice-status/paid
|
||||
:invoice-status/unpaid)}]]))
|
||||
|
||||
Reference in New Issue
Block a user