now all payments can go through datomic, but pdfs need work.
This commit is contained in:
@@ -34,6 +34,24 @@
|
||||
result
|
||||
nil)))
|
||||
|
||||
(def functions
|
||||
[{:db/ident :pay
|
||||
:db/doc "Data function that increments value of attribute a by amount."
|
||||
:db/fn #db/fn {:lang "clojure"
|
||||
:params [db e amount]
|
||||
:code (let [current-outstanding-balance (-> (d/entity db e) :invoice/outstanding-balance)
|
||||
new-outstanding-balance (- current-outstanding-balance amount)]
|
||||
[[:db/add e :invoice/outstanding-balance new-outstanding-balance]
|
||||
[:db/add e :invoice/status (if (> new-outstanding-balance 0)
|
||||
:invoice-status/unpaid
|
||||
:invoice-status/paid)]])}}
|
||||
{:db/ident :inc
|
||||
:db/doc "Data function that increments value of attribute a by amount."
|
||||
:db/fn #db/fn {:lang "clojure"
|
||||
:params [db e a amount]
|
||||
:code [[:db/add e a
|
||||
(-> (d/entity db e) a (+ amount))]]}}] )
|
||||
|
||||
(def vendor-schema
|
||||
[{:db/ident :vendor/original-id
|
||||
:db/valueType :db.type/long
|
||||
@@ -512,7 +530,7 @@
|
||||
|
||||
(defn create-schema []
|
||||
(->>
|
||||
(concat address-schema contact-schema vendor-schema client-schema bank-account-schema invoice-schema invoice-expense-account-schema payment-schema invoice-payment-schema transaction-schema user-schema)
|
||||
(concat address-schema contact-schema vendor-schema client-schema bank-account-schema invoice-schema invoice-expense-account-schema payment-schema invoice-payment-schema transaction-schema user-schema functions)
|
||||
|
||||
(d/transact (d/connect uri))))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user