Supports vendors not loading

This commit is contained in:
2022-04-11 17:26:03 -07:00
parent e4da1376f8
commit 2e4e693bc6
19 changed files with 412 additions and 657 deletions

View File

@@ -294,11 +294,17 @@
:sales_order_total {:type :money}
:sales_order_tax {:type :money}}}
:vendor_page {:fields {:vendors {:type '(list :vendor)}
:count {:type 'Int}
:total {:type 'Int}
:start {:type 'Int}
:end {:type 'Int}}}
:reminder_page {:fields {:reminders {:type '(list :reminder)}
:count {:type 'Int}
:total {:type 'Int}
:start {:type 'Int}
:end {:type 'Int}}}
:count {:type 'Int}
:total {:type 'Int}
:start {:type 'Int}
:end {:type 'Int}}}
:check_result {:fields {:invoices {:type '(list :invoice)}
:pdf_url {:type 'String}}}
@@ -398,9 +404,13 @@
:vendor {:type '(list :vendor)
:vendor {:type :vendor_page
:args {:name_like {:type 'String}
:start {:type 'Int}
:per_page {:type 'Int}
:sort {:type '(list :sort_item)}}
:resolve :get-vendor}
:user {:type '(list :user)
:user {:type '(list :user)
:resolve :get-user}
:vendor_by_id {:type :vendor
:args {:id {:type :id}}
@@ -708,7 +718,7 @@
'[(get-else $ ?je :journal-entry-line/debit 0.0) ?debit]
'[(get-else $ ?je :journal-entry-line/credit 0.0) ?credit]]}
:args [(d/db (d/connect uri)) client_id]}))
bills-due-soon (d/query {:query {:find '[?due ?outstanding ?invoice-number ?vendor-id]
bills-due-soon (d/query {:query {:find '[?due ?outstanding ?invoice-number ?vendor-id ?vendor-name]
:in '[$ ?client ?due-before]
:where ['[?i :invoice/client ?client]
'[?i :invoice/status :invoice-status/unpaid]
@@ -716,7 +726,8 @@
'[(<= ?due ?due-before)]
'[?i :invoice/outstanding-balance ?outstanding]
'[?i :invoice/invoice-number ?invoice-number]
'[?i :invoice/vendor ?vendor-id]]}
'[?i :invoice/vendor ?vendor-id]
'[?vendor-id :vendor/name ?vendor-name]]}
:args [(d/db (d/connect uri)) client_id (coerce/to-date (t/plus (time/local-now) (t/days 180)))]})
outstanding-checks (reduce
+
@@ -754,10 +765,10 @@
{:beginning_balance total-cash
:outstanding_payments outstanding-checks
:invoices_due_soon (mapv (fn [[due outstanding invoice-number vendor-id]]
:invoices_due_soon (mapv (fn [[due outstanding invoice-number vendor-id vendor-name]]
{:due (coerce/to-date-time due)
:invoice_number invoice-number
:vendor {:id vendor-id}
:vendor {:id vendor-id :name vendor-name}
:outstanding_balance outstanding})
bills-due-soon)
:upcoming_credits (into (mapv