Browse Source

Fixed tax in pre sale

Jacqueline Maldonado 7 years ago
parent
commit
fbaed93a29
1 changed files with 4 additions and 4 deletions
  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