Discount added in Rebate
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user