promotion
This commit is contained in:
@@ -98,10 +98,8 @@ class Promotion < ApplicationRecord
|
|||||||
# same, promo_product = check_giveaway_product(promo, orderitem[0][0])
|
# same, promo_product = check_giveaway_product(promo, orderitem[0][0])
|
||||||
if promo.promo_type == Promotion::PROMO_TYPE1
|
if promo.promo_type == Promotion::PROMO_TYPE1
|
||||||
if same
|
if same
|
||||||
puts "Hello this is same"
|
|
||||||
give_promotion_same_product(orderitem[:qty], promo.min_qty, promo_product.min_qty, orderitem, sale_id,promo_product.item_code)
|
give_promotion_same_product(orderitem[:qty], promo.min_qty, promo_product.min_qty, orderitem, sale_id,promo_product.item_code)
|
||||||
else
|
else
|
||||||
puts "Hello this is not same"
|
|
||||||
give_promotion_second_product(orderitem[:qty], promo.min_qty, promo_product.item_code, orderitem, sale_id)
|
give_promotion_second_product(orderitem[:qty], promo.min_qty, promo_product.item_code, orderitem, sale_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -227,6 +225,7 @@ class Promotion < ApplicationRecord
|
|||||||
|
|
||||||
|
|
||||||
def self.update_existing_item(qty, item, sale_id, type, item_price,source)
|
def self.update_existing_item(qty, item, sale_id, type, item_price,source)
|
||||||
|
if qty >0
|
||||||
menu_category = MenuCategory.get_menu_category(item[:item_code]) #get menu category for menu items
|
menu_category = MenuCategory.get_menu_category(item[:item_code]) #get menu category for menu items
|
||||||
|
|
||||||
sale_item = SaleItem.new
|
sale_item = SaleItem.new
|
||||||
@@ -253,6 +252,7 @@ class Promotion < ApplicationRecord
|
|||||||
sale = Sale.find(sale_id)
|
sale = Sale.find(sale_id)
|
||||||
sale.compute_by_sale_items(sale.id, sale.sale_items, sale.total_discount,nil,source)
|
sale.compute_by_sale_items(sale.id, sale.sale_items, sale.total_discount,nil,source)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
def self.give_promotion_nett_off(same, promo_product, foc_min_qty, orderitem, sale_id)
|
def self.give_promotion_nett_off(same, promo_product, foc_min_qty, orderitem, sale_id)
|
||||||
|
|||||||
Reference in New Issue
Block a user