Discount added in Rebate

This commit is contained in:
Phyo
2017-06-18 13:19:07 +06:30
parent 3a1fba2c6f
commit a204afda6a

View File

@@ -40,6 +40,8 @@ class SaleItem < ApplicationRecord
food_prices = food_prices + food_price
beverage_prices = beverage_prices + beverage_price
end
puts food_prices
puts beverage_prices
return food_prices, beverage_prices
end
@@ -59,6 +61,17 @@ class SaleItem < ApplicationRecord
return food_price, beverage_price
end
def self.get_overall_discount(sale_id)
price = 0.0
item=SaleItem.where("product_code=?", sale_id)
item.each do|i|
price += i.price
end
return price
end
private
def generate_custom_id
self.sale_item_id = SeedGenerator.generate_id(self.class.name, "SLI")