Merge branch 'august_spring' of bitbucket.org:code2lab/sxrestaurant

This commit is contained in:
Yan
2017-08-24 15:28:56 +06:30
10 changed files with 225 additions and 206 deletions

View File

@@ -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

View File

@@ -1,3 +1,4 @@
class PromotionProduct < ApplicationRecord
validates_presence_of :item_code
belongs_to :promotion
end