sales fixes.

This commit is contained in:
Bryce Covert
2020-09-09 22:51:17 -07:00
parent 179c2d13c6
commit 477654a8ae
2 changed files with 9 additions and 4 deletions

View File

@@ -78,12 +78,14 @@
(coerce/to-string (coerce/to-local-date-time (time/to-time-zone (coerce/to-date-time d) (time/time-zone-for-id "America/Los_Angeles")))))) (coerce/to-string (coerce/to-local-date-time (time/to-time-zone (coerce/to-date-time d) (time/time-zone-for-id "America/Los_Angeles"))))))
(update :total parsedouble) (update :total parsedouble)
(update :tax parsedouble) (update :tax parsedouble)
(update :discount parsedouble)
(update :tip parsedouble) (update :tip parsedouble)
(update :line-items (fn [lis] (update :line-items (fn [lis]
(map (map
(fn [li] (fn [li]
(-> li (-> li
(update :tax parsedouble) (update :tax parsedouble)
(update :discount parsedouble)
(update :total parsedouble))) (update :total parsedouble)))
lis))) lis)))
(update :charges (fn [charges] (update :charges (fn [charges]

View File

@@ -140,10 +140,13 @@
:client [:client/code client] :client [:client/code client]
:location loc :location loc
:external-id (str "square/order/" client "-" loc "-" (:id order)) :external-id (str "square/order/" client "-" loc "-" (:id order))
:total (-> order :net_amounts :total_money amount->money) :total (- (-> order :total_money amount->money)
:tax (-> order :net_amounts :tax_money amount->money) (or (some-> order :return_amounts :total_money amount->money) 0.0))
:tip (-> order :net_amounts :tip_money amount->money) :tax (- (-> order :total_tax_money amount->money)
:discount (-> order :net_amounts :discount_money amount->money) (or (some-> order :return_amounts :tax_money amount->money) 0.0))
:tip (- (-> order :net_amounts :tip_money amount->money)
(or (some-> order :return_amounts :tip_money amount->money) 0.0))
:discount (-> order :total_discount_money amount->money)
:charges (->> (:tenders order) :charges (->> (:tenders order)
(map (fn [t] (map (fn [t]
(remove-nils (remove-nils