39 lines
2.7 KiB
Clojure
39 lines
2.7 KiB
Clojure
;; This buffer is for Clojure experiments and evaluation.
|
|
|
|
;; Press C-j to evaluate the last expression.
|
|
|
|
;; You can also press C-u C-j to evaluate the expression and pretty-print its result.
|
|
|
|
(require '[auto-ap.datomic :refer [conn]])
|
|
|
|
|
|
(clojure.pprint/pprint (for [[date-str location numeric-code total invoice-id expense-account-id]
|
|
[["2/24/2019" "MH" 50000 18452.93 17592189466511 17592189466512]
|
|
["3/6/2019" "HQ" 85100 1502.52 17592189253677 17592189253678]
|
|
["3/12/2019" "MH" 82100 4559.00 17592189226804 17592189226805]
|
|
["3/19/2019" "MH" 74800 1500.00 17592207148562 17592207148563]
|
|
["4/1/2019" "MH" 82100 4559.00 17592190913262 17592190913263]
|
|
["4/29/2019" "MH" 74100 0.00 17592194022072 17592194022073]
|
|
["5/1/2019" "MH" 82100 4599.00 17592201540199 17592201540200]
|
|
["6/11/2019" "MH" 82100 4599.00 17592201540193 17592201540194]
|
|
["11/20/2019" "MH" 82100 5014.89 17592215052851 17592215052852]
|
|
["11/22/2019" "MH" 50000 0.00 17592215522630 17592215522631]
|
|
["11/22/2019" "HQ" 75990 0.00 17592215653503 17592215653504]
|
|
["11/22/2019" "HQ" 75990 0.00 17592215653493 17592215653494]
|
|
["11/25/2019" "HQ" 75990 0.00 17592215653495 17592215653496]
|
|
["11/25/2019" "HQ" 75990 0.00 17592215653519 17592215653520]
|
|
["12/3/2019" "MH" 50000 2194.45 17592217089192 17592217089193]
|
|
["12/7/2019" "MH" 50000 42.20 17592217089189 17592217089190]
|
|
["1/12/2020" "MH" 50000 -727.25 17592220829257 17592220829258]
|
|
["3/19/2020" "MH" 50000 3689.78 17592228959014 17592228959015]]]
|
|
[{:db/id invoice-id
|
|
:invoice/total total
|
|
:invoice/date (clj-time.coerce/to-date (auto-ap.time/parse date-str auto-ap.time/normal-date))
|
|
:invoice/location location
|
|
:payment (d/query {:query {:find ['?p '?a]
|
|
:in '[$ ?invoice-id]
|
|
:where ['[?pi :invoice-payment/invoice ?invoice-id]
|
|
'[?pi :invoice-payment/payment ?p]
|
|
'[?pi :invoice-payment/amount ?a]]}
|
|
:args [(d/db conn) invoice-id]} )}]))
|