discuont updated for show

This commit is contained in:
Yan
2017-06-22 11:31:05 +06:30
parent bded56a696
commit b13b0afa6c
2 changed files with 11 additions and 10 deletions

View File

@@ -20,9 +20,9 @@ class Origami::DiscountsController < BaseOrigamiController
if Sale.exists?(sale_id)
sale = Sale.find(sale_id)
sale.total_discount = overall_discount.to_f
sale.total_amount = sub_total
sale.grand_total = (sub_total - overall_discount.to_f) + sale.total_tax;
sale.total_amount = sub_total.to_f
sale.grand_total = (sub_total.to_f - overall_discount.to_f) + sale.total_tax;
sale.save
if discount_items.length > 0
#save sale item for discount
discount_items.each do |di|
@@ -42,9 +42,7 @@ class Origami::DiscountsController < BaseOrigamiController
sale_item.price = di["price"]
sale_item.save
end
sale.save
end
end
end
end