Promotion Product Bug Fix

This commit is contained in:
Phyo
2017-08-24 14:37:11 +06:30
parent 0118a178b2
commit 0670a6a05d
5 changed files with 36 additions and 59 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