Przeglądaj źródła

Merge branch 'apply_rubocop' of SML/pos-boutique into master

Jacque 7 lat temu
rodzic
commit
4b4881d587
1 zmienionych plików z 4 dodań i 4 usunięć
  1. 4 4
      app/models/pre_sale.rb

+ 4 - 4
app/models/pre_sale.rb

@@ -32,10 +32,6 @@ class PreSale < ActiveRecord::Base
     self.unit_price_w_discount = (unit_price - discount_per_unit).round(2)
     self.discount = (discount_per_unit * quantity).round(2)
     self.amount = (quantity * unit_price_w_discount)
-    self.tax = 0.0
-    if product.include_sale_tax?
-      self.tax = ((PosConfig.first.tax_percent / 100) * amount).round(2)
-    end
     haggle_discount =
       if haggle > 0
         haggle.round(2)
@@ -45,6 +41,10 @@ class PreSale < ActiveRecord::Base
         0
       end
     self.amount -= haggle_discount if haggle_discount.present?
+    self.tax = 0.0
+    if product.include_sale_tax?
+      self.tax = ((PosConfig.first.tax_percent / 100) * amount).round(2)
+    end
     self.total = amount + tax
     true
   end