merge with august_spring

This commit is contained in:
Yan
2017-09-06 18:32:45 +06:30
50 changed files with 1761 additions and 986 deletions

View File

@@ -1,4 +1,4 @@
class InJuty < ApplicationRecord
class InDuty < ApplicationRecord
belongs_to :dining_facility, foreign_key: 'dinning_id'
belongs_to :commissioner, foreign_key: 'commissioner_ids'
end

View File

@@ -6,14 +6,24 @@ class MenuItemInstance < ApplicationRecord
# before_create :generate_menu_item_instance_code
def self.findParentCategory(item)
if item.menu_category_id
return item.menu_category_id
if item.menu_category_id
item.menu_category_id
else
parentitem = MenuItem.find(item.menu_item_id)
findParentCategory(parentitem)
end
end
def self.get_item_name(item_code)
menu_item = MenuItemInstance.find_by_item_instance_code(item_code)
if menu_item.nil?
item_name = Product.find_by_item_code(item_code).name
else
item_name = menu_item.menu_item.name + ' - ' + menu_item.item_instance_name
end
item_name
end
# private
# def generate_menu_item_instance_code

View File

@@ -1,5 +1,5 @@
class Promotion < ApplicationRecord
validates_presence_of :promo_code,:promo_start_date,:promo_end_date,:promo_start_hour,:promo_end_hour,:promo_day,:promo_type,:original_product,:min_qty
validates_presence_of :promo_code,:promo_start_date,:promo_end_date,:promo_start_hour,:promo_end_hour,:promo_type,:original_product,:min_qty
has_many :promotion_products

View File

@@ -2,7 +2,7 @@ class StockCheck < ApplicationRecord
has_many :stock_check_items
def create(user, eason, item_list)
def create(user, reason, item_list)
self.reason = reason
self.check_by = user.id
self.check_start = Time.now