promotion by order_id
This commit is contained in:
@@ -11,6 +11,7 @@ class Promotion < ApplicationRecord
|
||||
PROMO_TYPE4 = "Percentage"
|
||||
|
||||
def self.promo_activate(saleObj)
|
||||
array_same =[]
|
||||
current_day = Time.now.strftime("%Y-%m-%d")
|
||||
current_time = Time.now.strftime('%H:%M:%S')
|
||||
day = Date.today.wday
|
||||
@@ -18,7 +19,6 @@ class Promotion < ApplicationRecord
|
||||
puts "promoList - " + promoList.size.to_s
|
||||
if promoList.size > 0
|
||||
itemList = combine_item(saleObj)
|
||||
puts itemList.to_json
|
||||
is_promo_day(promoList,day, itemList, saleObj.sale_id)
|
||||
end
|
||||
end
|
||||
@@ -31,6 +31,7 @@ class Promotion < ApplicationRecord
|
||||
def self.combine_item(saleObj)
|
||||
# order_id = saleObj.sale_orders[0][0].order_id
|
||||
# itemList = OrderItem.where("order_id = ?", order_id).group(:item_instance_code).sum(:qty)
|
||||
# array_same =[]
|
||||
itemList = []
|
||||
saleObj.sale_orders.each do |so|
|
||||
itemList << OrderItem.where("order_id = ?",so.order_id).group(["item_instance_code", "order_id"]).sum(:qty)
|
||||
|
||||
@@ -80,12 +80,13 @@ class Sale < ApplicationRecord
|
||||
end
|
||||
booking.sale_id = sale_id
|
||||
saleObj = Sale.find(sale_id)
|
||||
# order = booking.booking_orders.take.order
|
||||
link_order_sale(order.order_id)
|
||||
end
|
||||
# InventoryJob.perform_now(self.id)
|
||||
InventoryDefinition.calculate_product_count(saleObj)
|
||||
|
||||
order = booking.booking_orders.take.order
|
||||
link_order_sale(order.id)
|
||||
|
||||
|
||||
# dining charges
|
||||
charges = DiningCharge.where('dining_facility_id=?',booking.dining_facility_id).take
|
||||
|
||||
Reference in New Issue
Block a user