Merge branch 'master' of bitbucket.org:brycecovertoperations/integreat
This commit is contained in:
18
notes.txt
18
notes.txt
@@ -5,3 +5,21 @@
|
||||
5) List of payments
|
||||
6) add payment
|
||||
7) add invoice - X
|
||||
|
||||
|
||||
|
||||
--
|
||||
Rules priority:
|
||||
Match check
|
||||
Match debit
|
||||
Match rule (assign vendor and account)
|
||||
+ Memo
|
||||
+ Wild card matches
|
||||
+ Match memo and amount
|
||||
+ Match for specificclient
|
||||
+ Match for specifo
|
||||
|
||||
Transfers
|
||||
Splits
|
||||
|
||||
|
||||
|
||||
@@ -29,3 +29,12 @@
|
||||
#_(map first)
|
||||
|
||||
#_(first)))
|
||||
|
||||
(defn assoc-image [code image]
|
||||
@(d/transact (d/connect uri)
|
||||
[{ :client/code code
|
||||
:client/signature-file (str "https://s3.amazonaws.com/integreat-signature-images/" image)}]))
|
||||
|
||||
|
||||
#_(d/pull (d/db (d/connect uri)) '[*] [:client/code "FTLO"])
|
||||
#_(assoc-image "FTLO" "Fratello.jpg" )
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
[auto-ap.datomic.clients :as d-clients]
|
||||
[auto-ap.datomic.bank-accounts :as d-bank-accounts]
|
||||
[auto-ap.datomic :refer [uri remove-nils]]
|
||||
[auto-ap.utils :refer [by]]
|
||||
[auto-ap.utils :refer [by dollars-0?]]
|
||||
[auto-ap.numeric :refer [num->words]]
|
||||
[config.core :refer [env]]
|
||||
[auto-ap.time :refer [parse normal-date iso-date local-now]]
|
||||
@@ -368,7 +368,7 @@
|
||||
[[:db.fn/retractEntity (:db/id x)]
|
||||
{:db/id (:db/id invoice)
|
||||
:invoice/outstanding-balance new-balance
|
||||
:invoice/status (if (< -0.001 new-balance 0.001)
|
||||
:invoice/status (if (dollars-0? new-balance)
|
||||
(:invoice/status invoice)
|
||||
:invoice-status/unpaid)}]))
|
||||
(:payment/invoices check))
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
[auto-ap.expense-accounts :as expense-accounts]
|
||||
[auto-ap.graphql.checks :as gq-checks]
|
||||
[auto-ap.time :refer [parse iso-date]]
|
||||
[auto-ap.utils :refer [dollars=]]
|
||||
[datomic.api :as d]
|
||||
[auto-ap.datomic :refer [uri]]
|
||||
[clj-time.coerce :as coerce]
|
||||
@@ -105,7 +106,7 @@
|
||||
(throw (ex-info (str "Invoice '" invoice_number "' already exists.") {:invoice-number invoice_number})))
|
||||
|
||||
expense-account-total (reduce + 0 (map (fn [x] (Double/parseDouble (:amount x))) expense_accounts))
|
||||
_ (when (not= total expense-account-total)
|
||||
_ (when-not (dollars= total expense-account-total)
|
||||
(let [error (str "Expense account total (" expense-account-total ") does not equal invoice total (" total ")")]
|
||||
(throw (ex-info error {:validation-error error}))))
|
||||
paid-amount (- (:invoice/total invoice) (:invoice/outstanding-balance invoice))
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
[:client [:name :id :code :locations]]]]]
|
||||
invoices (graphql/query identity (venia/graphql-query {:venia/queries (->graphql query)}))]
|
||||
|
||||
(doto (list (:all-invoices (:data invoices))) clojure.pprint/pprint)))
|
||||
(list (:all-invoices (:data invoices)))))
|
||||
(GET "/payments/export" {:keys [query-params identity]}
|
||||
(assert-admin identity)
|
||||
(let [query [[:all_payments
|
||||
|
||||
@@ -17,3 +17,10 @@
|
||||
(conj xs x)))
|
||||
[]
|
||||
existing))
|
||||
|
||||
|
||||
(defn dollars-0? [amt]
|
||||
(< -0.001 amt 0.001))
|
||||
|
||||
(defn dollars= [amt1 amt2]
|
||||
(dollars-0? (- amt1 amt2) ))
|
||||
|
||||
Reference in New Issue
Block a user