Fixes two types of bugs.
This commit is contained in:
@@ -6,18 +6,27 @@
|
||||
(require '[auto-ap.utils :refer [dollars=]])
|
||||
|
||||
(defn get-bad-ones []
|
||||
(->> (d/query {:query {:find ['?je '?a '(sum ?debit) '(sum ?credit)]
|
||||
:with ['?jel]
|
||||
:in '[$]
|
||||
:where ['[?je :journal-entry/amount ?a]
|
||||
'[?je :journal-entry/line-items ?jel]
|
||||
'[(get-else $ ?jel :journal-entry-line/debit 0.0) ?debit]
|
||||
'[(get-else $ ?jel :journal-entry-line/credit 0.0) ?credit]]
|
||||
}
|
||||
:args [(d/db auto-ap.datomic/conn)]})
|
||||
(filter (fn [[_ a d c]]
|
||||
(or (not (dollars= a d))
|
||||
(not (dollars= a c)))))
|
||||
|
||||
|
||||
(->> (->> (d/q '[:find ?c
|
||||
:in $
|
||||
:where [?c :client/code]]
|
||||
(d/db auto-ap.datomic/conn))
|
||||
(map first))
|
||||
(mapcat #(->> (d/query {:query {:find ['?je '?a '(sum ?debit) '(sum ?credit)]
|
||||
:with ['?jel]
|
||||
:in '[$ ?c]
|
||||
:where ['[?je :journal-entry/client ?c]
|
||||
'[?je :journal-entry/amount ?a]
|
||||
'[?je :journal-entry/line-items ?jel]
|
||||
'[(get-else $ ?jel :journal-entry-line/debit 0.0) ?debit]
|
||||
'[(get-else $ ?jel :journal-entry-line/credit 0.0) ?credit]]
|
||||
}
|
||||
:args [(d/db auto-ap.datomic/conn) %]})
|
||||
(filter (fn [[_ a d c]]
|
||||
(or (not (dollars= a d))
|
||||
(not (dollars= a c)))))))
|
||||
|
||||
#_(count)
|
||||
#_(take 3)))
|
||||
|
||||
@@ -32,7 +41,7 @@
|
||||
je))))
|
||||
(filter (fn [invoice?]
|
||||
(:invoice/total invoice?)))
|
||||
(map (fn [invoice]
|
||||
#_(map (fn [invoice]
|
||||
{:total (:invoice/total invoice)
|
||||
:client-code (:client/code (:invoice/client invoice))
|
||||
:invoice-number (:invoice/invoice-number invoice)
|
||||
|
||||
Reference in New Issue
Block a user