filtering on ledger page.
This commit is contained in:
@@ -88,7 +88,7 @@
|
||||
(defn get-balance-sheet [context args value]
|
||||
(let [args (assoc args :id (:id context))
|
||||
[results] (l/get-graphql {:client-id (:client_id args)
|
||||
:to-date (coerce/to-date (:date args))
|
||||
:date-range {:end (coerce/to-date (:date args))}
|
||||
:count Integer/MAX_VALUE})
|
||||
|
||||
|
||||
@@ -105,12 +105,12 @@
|
||||
pnl (fn [from-date to-date]
|
||||
(println "FROM" from-date to-date)
|
||||
(let [[starting-results] (l/get-graphql {:client-id (:client_id args)
|
||||
:to-date (-> from-date
|
||||
(time/minus (time/seconds 1))
|
||||
coerce/to-date)
|
||||
:date-range {:end (-> from-date
|
||||
(time/minus (time/seconds 1))
|
||||
coerce/to-date)}
|
||||
:count Integer/MAX_VALUE})
|
||||
[ending-results] (l/get-graphql {:client-id (:client_id args)
|
||||
:to-date (coerce/to-date to-date)
|
||||
:date-range {:end (coerce/to-date to-date)}
|
||||
:count Integer/MAX_VALUE})
|
||||
starting-accounts (by :id (roll-up starting-results))
|
||||
ending-accounts (by :id (roll-up ending-results))]
|
||||
@@ -122,10 +122,10 @@
|
||||
[]
|
||||
ending-accounts)))]
|
||||
(->graphql
|
||||
{:balance-sheet-accounts (pnl (coerce/to-date-time (:from_date args))
|
||||
(coerce/to-date-time (:to_date args)))
|
||||
:comparable-balance-sheet-accounts (pnl (time/minus (coerce/to-date-time (:from_date args)) (time/years 1))
|
||||
(time/minus (coerce/to-date-time (:to_date args)) (time/years 1)))})))
|
||||
{:balance-sheet-accounts (pnl (coerce/to-date-time (:start (:date_range args)))
|
||||
(coerce/to-date-time (:end (:date_range args))))
|
||||
:comparable-balance-sheet-accounts (pnl (time/minus (coerce/to-date-time (:start (:date_range args))) (time/years 1))
|
||||
(time/minus (coerce/to-date-time (:end (:date_range args))) (time/years 1)))})))
|
||||
|
||||
#_(get-profit-and-loss nil {:client_id [:client/code "CBC"]
|
||||
:from_date "2018-01-01"
|
||||
|
||||
Reference in New Issue
Block a user