Remove code-duplication of artice price calculation
This commit is contained in:
parent
b35357d4b3
commit
2d4891bf1d
3 changed files with 16 additions and 23 deletions
14
app/models/concerns/price_calculation.rb
Normal file
14
app/models/concerns/price_calculation.rb
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
module PriceCalculation
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
# Gross price = net price + deposit + tax.
|
||||
# @return [Number] Gross price.
|
||||
def gross_price
|
||||
((price + deposit) * (tax / 100 + 1)).round(2)
|
||||
end
|
||||
|
||||
# @return [Number] Price for the foodcoop-member.
|
||||
def fc_price
|
||||
(gross_price * (FoodsoftConfig[:price_markup] / 100 + 1)).round(2)
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue