add item instance code to order item
This commit is contained in:
@@ -90,7 +90,7 @@ class Order < ApplicationRecord
|
|||||||
# self.employee_name)
|
# self.employee_name)
|
||||||
# end
|
# end
|
||||||
|
|
||||||
OrderItem.processs_item(menu_item[:item_code], menu_item[:name], menu_item[:alt_name], menu_item[:account_id],
|
OrderItem.processs_item(menu_item[:item_code], item[:item_instance_code], menu_item[:name], menu_item[:alt_name], menu_item[:account_id],
|
||||||
item[:quantity],menu_item[:price], item[:options], set_order_items, self.id,
|
item[:quantity],menu_item[:price], item[:options], set_order_items, self.id,
|
||||||
self.employee_name)
|
self.employee_name)
|
||||||
|
|
||||||
|
|||||||
@@ -20,11 +20,12 @@ class OrderItem < ApplicationRecord
|
|||||||
# option_values : [],
|
# option_values : [],
|
||||||
# sub_order_items : [],
|
# sub_order_items : [],
|
||||||
# }
|
# }
|
||||||
def self.processs_item (item_code, menu_name, alt_name, account_id, qty,price, options, set_menu_items, order_id, item_order_by)
|
def self.processs_item (item_code, instance_code, menu_name, alt_name, account_id, qty,price, options, set_menu_items, order_id, item_order_by)
|
||||||
|
|
||||||
orderitem = OrderItem.create do |oitem|
|
orderitem = OrderItem.create do |oitem|
|
||||||
oitem.order_id = order_id
|
oitem.order_id = order_id
|
||||||
oitem.item_code = item_code
|
oitem.item_code = item_code
|
||||||
|
oitem.item_instance_code = instance_code
|
||||||
oitem.item_name = menu_name
|
oitem.item_name = menu_name
|
||||||
oitem.alt_name = alt_name
|
oitem.alt_name = alt_name
|
||||||
oitem.account_id = account_id
|
oitem.account_id = account_id
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ class CreateOrderItems < ActiveRecord::Migration[5.1]
|
|||||||
t.string :order_item_status, :null => false, :default => "new"
|
t.string :order_item_status, :null => false, :default => "new"
|
||||||
t.string :item_order_by #person who order this
|
t.string :item_order_by #person who order this
|
||||||
t.string :item_code, :null => false
|
t.string :item_code, :null => false
|
||||||
|
t.string :item_instance_code
|
||||||
t.string :item_name, :null => false
|
t.string :item_name, :null => false
|
||||||
t.string :alt_name, :null => false
|
t.string :alt_name, :null => false
|
||||||
t.integer :account_id, :limit => 8, :null => false, :default => 1
|
t.integer :account_id, :limit => 8, :null => false, :default => 1
|
||||||
|
|||||||
Reference in New Issue
Block a user