Tons of small fixes

This commit is contained in:
Bryce Covert
2020-07-27 21:28:02 -07:00
parent 3737cfa628
commit fdc1d3e9e4
26 changed files with 428 additions and 178 deletions

View File

@@ -145,6 +145,7 @@
:code {:type 'String}
:terms {:type 'Int}
:hidden {:type 'Boolean}
:automatically_paid_when_due {:type '(list :client)}
:terms_overrides {:type '(list :terms_override)}
:account_overrides {:type '(list :vendor_account_override)}
@@ -305,7 +306,8 @@
:client_id {:type 'Int}
:payments {:type '(list :invoice_payment)}
:vendor {:type :vendor}
:client {:type :client}}}
:client {:type :client}
:automatically_paid_when_due {:type 'Boolean}}}
@@ -496,6 +498,7 @@
:amount_lte {:type :money}
:amount_gte {:type :money}
:check_number_like {:type 'String}
:invoice_number {:type 'String}
:start {:type 'Int}
:sort {:type '(list :sort_item)}}
@@ -608,6 +611,7 @@
:terms {:type 'Int}
:terms_overrides {:type '(list :add_terms_override)}
:code {:type 'String}
:automatically_paid_when_due {:type '(list :id)}
:hidden {:type 'Boolean}
:print_as {:type 'String}
@@ -630,6 +634,7 @@
:invoice_number {:type 'String}
:expense_accounts {:type '(list :edit_expense_account)}
:location {:type :iso_date}
:automatically_paid_when_due {:type 'Boolean}
:date {:type :iso_date}
:due {:type :iso_date}
:client_id {:type :id}
@@ -642,6 +647,7 @@
:invoice_number {:type 'String}
:expense_accounts {:type '(list :edit_expense_account)}
:date {:type :iso_date}
:automatically_paid_when_due {:type 'Boolean}
:due {:type :iso_date}
:total {:type 'Float}}}
:edit_transaction
@@ -971,7 +977,7 @@
'[?i :invoice/due ?due]
'[(<= ?due ?due-before)]
'[?i :invoice/outstanding-balance ?outstanding]]}
:args [(d/db (d/connect uri)) client_id (coerce/to-date (t/plus (time/local-now) (t/days 31)))]})
:args [(d/db (d/connect uri)) client_id (coerce/to-date (t/plus (time/local-now) (t/days 180)))]})
outstanding-checks (reduce
+
0.0
@@ -983,7 +989,7 @@
'(or
[?p :payment/type :payment-type/debit]
[?p :payment/type :payment-type/check])]}
:args [(d/db (d/connect uri)) client_id (coerce/to-date (t/plus (time/local-now) (t/days 31)))]})))
:args [(d/db (d/connect uri)) client_id (coerce/to-date (t/plus (time/local-now) (t/days 180)))]})))
recent-fulfillments (d/query {:query {:find '[?f ?d]
:in '[$ ?client ?min-date]
:where ['[?t :transaction/forecast-match ?f]
@@ -993,7 +999,7 @@
:args [(d/db (d/connect uri)) client_id (coerce/to-date (t/plus (time/local-now) (t/months -2)))]})
forecasted-transactions (for [{:forecasted-transaction/keys [amount identifier day-of-month]
:db/keys [id]} forecasted-transactions
month (range -1 2)
month (range -1 7)
:let [next (t/plus (t/local-date (t/year (time/local-now))
(t/month (time/local-now))
day-of-month )
@@ -1018,7 +1024,7 @@
(or week-a-credits 0)
(or week-b-credits 0))
:date (coerce/to-date-time date)})
(take 5 (time/day-of-week-seq 1)))
(take (* 7 4) (time/day-of-week-seq 1)))
(filter #(>= (:amount %) 0) forecasted-transactions))
:upcoming_debits (into (mapv
(fn [date]
@@ -1026,7 +1032,7 @@
(or week-a-debits 0)
(or week-b-debits 0)))
:date (coerce/to-date-time date)})
(take 5 (time/day-of-week-seq 1)))
(take (* 7 4) (time/day-of-week-seq 1)))
(filter #(< (:amount %) 0) forecasted-transactions))
})))