Merge branch 'august_spring' of bitbucket.org:code2lab/sxrestaurant into august_spring
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
class Commissioner < ApplicationRecord
|
||||
belongs_to :employee, foreign_key: 'emp_id'
|
||||
belongs_to :commission, foreign_key: 'commission_type'
|
||||
has_many :in_juties
|
||||
scope :active, -> { where(is_active: true) }
|
||||
end
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
class DiningFacility < ApplicationRecord
|
||||
belongs_to :zone
|
||||
has_many :dining_charges
|
||||
has_many :in_juties
|
||||
|
||||
TABLE_TYPE = "Table"
|
||||
ROOM_TYPE = "Room"
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
class InJuty < ApplicationRecord
|
||||
belongs_to :dining_facility, foreign_key: 'dinning_id'
|
||||
belongs_to :commissioner, foreign_key: 'commissioner_ids'
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@ class Promotion < ApplicationRecord
|
||||
|
||||
has_many :promotion_products
|
||||
|
||||
accepts_nested_attributes_for :promotion_products , :allow_destroy => true
|
||||
accepts_nested_attributes_for :promotion_products , :allow_destroy => true , update_only: true
|
||||
|
||||
PROMO_TYPE1 = "Quantity"
|
||||
PROMO_TYPE2 = "Net_off" # 3000 => - 500 => 2500 [total]
|
||||
@@ -204,6 +204,6 @@ class Promotion < ApplicationRecord
|
||||
end
|
||||
|
||||
def self.calculate_discount(total, discount)
|
||||
self (total.to_i * discount.to_i) / 100
|
||||
return (total.to_i * discount.to_i) / 100
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
class PromotionProduct < ApplicationRecord
|
||||
validates_presence_of :item_code
|
||||
belongs_to :promotion
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user