long shot attempt to get report looking better
This commit is contained in:
@@ -520,25 +520,39 @@
|
||||
:per_page Integer/MAX_VALUE}}
|
||||
nil)
|
||||
:journal_entries
|
||||
(map (fn [je]
|
||||
(update je :line_items
|
||||
(fn [jels]
|
||||
(into []
|
||||
(filter (fn [jel]
|
||||
(when-let [account (account-lookup (:id (:account jel)))]
|
||||
(and
|
||||
(<= (get-in l-reports/ranges [category 0])
|
||||
(:numeric_code account)
|
||||
(get-in l-reports/ranges [category 1]))
|
||||
(= location (:location jel)))))
|
||||
jels ))))))
|
||||
(group-by #(account-lookup (get-in % [:line_items 0 :account :id]))))]
|
||||
(mapcat (fn [je]
|
||||
(->> (je :line_items)
|
||||
(filter (fn [jel]
|
||||
(when-let [account (account-lookup (:id (:account jel)))]
|
||||
(and
|
||||
(<= (get-in l-reports/ranges [category 0])
|
||||
(:numeric_code account)
|
||||
(get-in l-reports/ranges [category 1]))
|
||||
(= location (:location jel)))))
|
||||
)
|
||||
(map (fn [jel ]
|
||||
{:date (:date je)
|
||||
:debit (:debit jel)
|
||||
:credit (:credit jel)
|
||||
:description (or (:name (:vendor je))
|
||||
(:alternate_description je))
|
||||
:account (:account jel)
|
||||
:location (:location jel)})))))
|
||||
(group-by #(account-lookup (get-in % [:account :id]))))]
|
||||
[account journal-entries] journal-entries]
|
||||
{:category category
|
||||
:client_id client-id
|
||||
:location location
|
||||
:account account
|
||||
:journal_entries journal-entries})})
|
||||
:journal_entries (reduce
|
||||
(fn [[acc last-je] je]
|
||||
(let [next-je (assoc je :running_balance
|
||||
(- (+ (:running_balance last-je 0.0)
|
||||
(Double/parseDouble (:debit je 0.0)))
|
||||
(Double/parseDouble (:credit je 0.0))))]
|
||||
[(conj acc next-je) next-je]))
|
||||
[]
|
||||
journal-entries)})})
|
||||
|
||||
|
||||
|
||||
@@ -596,6 +610,16 @@
|
||||
:date {:type 'String}
|
||||
:line_items {:type '(list :journal_entry_line)}}}
|
||||
|
||||
:journal_detail_report_row
|
||||
{:fields {:client {:type :client}
|
||||
:description {:type 'String}
|
||||
:date {:type 'String}
|
||||
:account {:type :account}
|
||||
:location {:type 'String}
|
||||
:debit {:type 'String}
|
||||
:credit {:type 'String}
|
||||
:running_balance {:type :money}}}
|
||||
|
||||
:ledger_page
|
||||
{:fields {:journal_entries {:type '(list :journal_entry)}
|
||||
:count {:type 'Int}
|
||||
@@ -619,7 +643,7 @@
|
||||
:account {:type :account}
|
||||
:client_id {:type :id}
|
||||
:location {:type 'String}
|
||||
:journal_entries {:type '(list :journal_entry)}}}
|
||||
:journal_entries {:type '(list :journal_detail_report_row)}}}
|
||||
:journal_detail_report
|
||||
{:fields {:categories {:type '(list :journal_detail_report_category)}}}})
|
||||
|
||||
|
||||
@@ -575,14 +575,12 @@
|
||||
(map
|
||||
(fn [je]
|
||||
[{:value (user-friendly-date (:date je))}
|
||||
{:value (or (:description je)
|
||||
(:name (:vendor je))
|
||||
"")}
|
||||
{:value (get-in je [:line-items 0 :debit])
|
||||
{:value (:description je "")}
|
||||
{:value (get je :debit)
|
||||
:format :dollar}
|
||||
{:value (get-in je [:line-items 0 :credit])
|
||||
{:value (get je :credit)
|
||||
:format :dollar}
|
||||
{:value (get-in je [:line-items 0 :running-balance])
|
||||
{:value (get je :running-balance)
|
||||
:format :dollar}])
|
||||
(:journal-entries category))))
|
||||
|
||||
|
||||
@@ -49,20 +49,10 @@
|
||||
:categories [:sales
|
||||
:cogs
|
||||
:payroll]}
|
||||
[[:categories [[:journal-entries [:id
|
||||
:source
|
||||
:original-entity
|
||||
:note
|
||||
:amount
|
||||
:alternate-description
|
||||
[:vendor
|
||||
[:name :id]]
|
||||
[:client
|
||||
[:name :id]]
|
||||
[:line-items
|
||||
[:id :debit :credit :location :running-balance
|
||||
[:account [:id :name]]]]
|
||||
:date]]
|
||||
[[:categories [[:journal-entries [:description
|
||||
:date
|
||||
:debit :credit :location :running-balance
|
||||
[:account [:id :name]]]]
|
||||
:category
|
||||
:client-id
|
||||
:location
|
||||
|
||||
Reference in New Issue
Block a user