idea for cash flow linkage. makes invoices use uri parameters.

This commit is contained in:
Bryce Covert
2020-05-17 07:41:27 -07:00
parent a7a3966f1b
commit 700d78fc75
10 changed files with 117 additions and 39 deletions

View File

@@ -62,6 +62,16 @@
'[(<= ?date ?end-date)]]}
:args [(c/to-date (:end (:date-range args)))]})
(:start (:due-range args)) (merge-query {:query {:in '[?start-due]
:where ['[?e :invoice/due ?due]
'[(>= ?due ?start-due)]]}
:args [(c/to-date (:start (:due-range args)))]})
(:end (:due-range args)) (merge-query {:query {:in '[?end-due]
:where ['[?e :invoice/due ?due]
'[(<= ?due ?end-due)]]}
:args [(c/to-date (:end (:due-range args)))]})
(:import-status args)
(merge-query {:query {:in ['?import-status]
:where ['[?e :invoice/import-status ?import-status]]}

View File

@@ -394,6 +394,7 @@
:invoice_page {:type '(list :invoice_page)
:args {:import_status {:type 'String}
:date_range {:type :date_range}
:due_range {:type :date_range}
:status {:type :invoice_status}
:client_id {:type :id}
:vendor_id {:type :id}
@@ -871,11 +872,10 @@
true (merge-query {:query {:where ['[?i :invoice/client ?c]
'[?i :invoice/outstanding-balance ?outstanding-balance]
'[?i :invoice/total ?total]
'[?i :invoice/date ?date]
'[?i :invoice/due ?date]
'[(.toInstant ^java.util.Date ?date) ?d2]
'[(.between java.time.temporal.ChronoUnit/DAYS (java.time.Instant/now) ?d2 ) ?d3]
'[(+ 30 ?d3) ?d4]
'[(auto-ap.graphql/categorize ?d4) ?name]]}})
'[(auto-ap.graphql/categorize ?d3) ?name]]}})
true (d/query ))
result (group-by first result)]