From 42bd65357f0062ff5157e57e1ba5a0b6a1ed640c Mon Sep 17 00:00:00 2001 From: Bryce Covert Date: Mon, 22 Nov 2021 21:31:42 -0800 Subject: [PATCH] Simple excel invoice fix --- src/clj/auto_ap/routes/invoices.clj | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/clj/auto_ap/routes/invoices.clj b/src/clj/auto_ap/routes/invoices.clj index cf3e5067..8b4ccb22 100644 --- a/src/clj/auto_ap/routes/invoices.clj +++ b/src/clj/auto_ap/routes/invoices.clj @@ -164,13 +164,13 @@ (:db/id (d-vendors/account-for-client-id vendor client-id))) :location default-location :amount total}]} - (:vendor/terms vendor) (assoc :invoice/due (coerce/to-date - (time/plus date (time/days (d-vendors/terms-for-client-id vendor client-id))))) - automatically-paid-when-due (assoc :invoice/scheduled-payment (coerce/to-date - (time/plus date (time/days (d-vendors/terms-for-client-id vendor client-id))))) - schedule-payment-dom (assoc :invoice/scheduled-payment (coerce/to-date - (next-dom date schedule-payment-dom) - ))) + (:vendor/terms vendor) (assoc :invoice/due (coerce/to-date + (time/plus date (time/days (d-vendors/terms-for-client-id vendor client-id))))) + automatically-paid-when-due (assoc :invoice/scheduled-payment (coerce/to-date + (time/plus date (time/days (d-vendors/terms-for-client-id vendor client-id))))) + schedule-payment-dom (assoc :invoice/scheduled-payment (coerce/to-date + (next-dom date schedule-payment-dom) + ))) payment (if (= :invoice-status/paid (:invoice/status invoice)) #:invoice-payment {:invoice (:db/id invoice) :amount (:invoice/total invoice) @@ -182,10 +182,9 @@ :status :payment-status/cleared :date (:invoice/date invoice)})} )] - [[:propose-invoice invoice] payment]))) - (filter identity) - (map remove-nils) - )) + [[:propose-invoice (remove-nils invoice)] + (some-> payment remove-nils)]))) + (filter identity))) (defn match-vendor [vendor-code forced-vendor]