This commit is contained in:
2023-05-08 20:56:02 -07:00
3 changed files with 43 additions and 38 deletions

View File

@@ -164,7 +164,7 @@
[[:cell {:colspan 12} [:spacer]]]
[[:cell {:colspan 12} [:spacer]]]
[[:cell {:colspan 5}]
[[:cell {:colspan 3}]
[:cell {:align :right :colspan 2}
"Check:\n"
"Vendor:\n"
@@ -174,7 +174,7 @@
"Amount:\n"
"Date:\n"]
[:cell {:colspan 5}
[:cell {:colspan 7}
[:paragraph check]
[:paragraph vendor-name]
[:paragraph (:client/name client)]

View File

@@ -65,19 +65,22 @@
(defmethod extract-invoice-details :general-produce
[k input-stream clients]
(log/info ::parsing-general-produce :key k)
(let [missing-client-hints (atom #{})]
(try
(->> (read-csv input-stream)
(drop 1)
(filter (fn [[_ _ _ _ _ _ _ _ _ _ _ break-flag]]
#_(filter (fn [[_ _ _ _ _ _ _ _ _ _ _ break-flag]]
(= "Y" break-flag)))
(map (fn [[_ location-hint invoice-number ship-date invoice-total ]]
(let [matching-client (and location-hint
(parse/exact-match clients location-hint))
location (parse/best-location-match matching-client location-hint location-hint )
vendor (d/pull (d/db conn) '[:vendor/default-account] :vendor/general-produce)]
(when-not matching-client
(when-not (and matching-client
(not (@missing-client-hints location-hint)))
(log/warn ::missing-client
:client-hint location-hint))
:client-hint location-hint)
(swap! missing-client-hints conj location-hint))
{:invoice/location location
:invoice/date (coerce/to-date (atime/parse ship-date atime/normal-date))
:invoice/invoice-number invoice-number
@@ -98,7 +101,7 @@
(catch Exception e
(log/error ::cant-import-general-produce
:error e)
[])))
[]))))
(defmethod extract-invoice-details :unknown
[k input-stream clients]
@@ -247,6 +250,7 @@
(->> (extract-invoice-details k
is
clients)
(set)
(map (fn [i]
(log/info ::importing-invoice
:invoice i)

View File

@@ -631,7 +631,7 @@
(defn cash-drawer-shifts
([client l]
(cash-drawer-shifts client l (time/plus (time/now) (time/days -14)) (time/now)))
(cash-drawer-shifts client l (time/plus (time/now) (time/days -75)) (time/now)))
([client l start end]
(de/chain (manifold-api-call {:url (str "https://connect.squareup.com/v2/cash-drawers/shifts"
"?"
@@ -639,7 +639,8 @@
(url/map->query
{:location_id (:square-location/square-id l)
:begin_time (->square-date start)
:end_time (->square-date end)}))
:end_time (->square-date end)
:limit 1000}))
:method :get
:headers (client-base-headers client "2023-04-19")