Merge branch 'discount' of bitbucket.org:code2lab/sxrestaurant into crm

This commit is contained in:
Aung Myo
2017-06-22 09:34:45 +06:30
10 changed files with 599 additions and 122 deletions

View File

@@ -24,6 +24,7 @@ class MenuItem < ApplicationRecord
if (!mt_instance.nil?)
menu_item = MenuItem.find(mt_instance.menu_item_id)
menu_item_hash[:type] = menu_item.type
menu_item_hash[:account_id] = menu_item.account_id
menu_item_hash[:item_code] = menu_item.item_code
menu_item_hash[:item_instance_code] = mt_instance.item_instance_code
menu_item_hash[:name] = menu_item.name.to_s + " - " + mt_instance.item_instance_name.to_s

View File

@@ -82,7 +82,7 @@ class Order < ApplicationRecord
set_order_items
end
OrderItem.processs_item(menu_item[:item_code], menu_item[:name],
OrderItem.processs_item(menu_item[:item_code], menu_item[:name], menu_item[:account_id],
item[:quantity],menu_item[:price], item[:options], set_order_items, self.id,
self.employee_name)

View File

@@ -20,12 +20,13 @@ class OrderItem < ApplicationRecord
# option_values : [],
# sub_order_items : [],
# }
def self.processs_item (item_code, menu_name, qty,price, options, set_menu_items, order_id, item_order_by)
def self.processs_item (item_code, menu_name, account_id, qty,price, options, set_menu_items, order_id, item_order_by)
orderitem = OrderItem.create do |oitem|
oitem.order_id = order_id
oitem.item_code = item_code
oitem.item_name = menu_name
oitem.account_id = account_id
oitem.qty = qty
oitem.price = price
oitem.options = options

View File

@@ -141,6 +141,7 @@ class Sale < ApplicationRecord
#pull
sale_item.product_code = item.item_code
sale_item.product_name = item.item_name
sale_item.account_id = item.account_id
sale_item.remark = item.remark
sale_item.qty = item.qty