Discount added in Rebate
This commit is contained in:
@@ -40,6 +40,8 @@ class SaleItem < ApplicationRecord
|
|||||||
food_prices = food_prices + food_price
|
food_prices = food_prices + food_price
|
||||||
beverage_prices = beverage_prices + beverage_price
|
beverage_prices = beverage_prices + beverage_price
|
||||||
end
|
end
|
||||||
|
puts food_prices
|
||||||
|
puts beverage_prices
|
||||||
return food_prices, beverage_prices
|
return food_prices, beverage_prices
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -59,6 +61,17 @@ class SaleItem < ApplicationRecord
|
|||||||
return food_price, beverage_price
|
return food_price, beverage_price
|
||||||
end
|
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
|
private
|
||||||
def generate_custom_id
|
def generate_custom_id
|
||||||
self.sale_item_id = SeedGenerator.generate_id(self.class.name, "SLI")
|
self.sale_item_id = SeedGenerator.generate_id(self.class.name, "SLI")
|
||||||
|
|||||||
Reference in New Issue
Block a user