Class: ODDB::Html::View::Drugs::Ajax::ExplainPrice

Inherits:
HtmlGrid::Composite
  • Object
show all
Defined in:
lib/oddb/html/view/drugs/ajax/explain_price.rb

Constant Summary collapse

COMPONENTS =
{
  [0,0] => :price_db,
  [0,1] => :tax_sub,
  [0,2] => :tax_add,
  [0,3] => :price_local,
}
CSS_MAP =
{
  [1,0,1,3] => 'price',
  [0,3]     => 'sum',
  [1,3]     => 'price sum',
}
LABELS =
true
LEGACY_INTERFACE =
false

Instance Method Summary collapse

Instance Method Details

#_price_db(price) ⇒ Object



34
35
36
# File 'lib/oddb/html/view/drugs/ajax/explain_price.rb', line 34

def _price_db(price)
  price * @lookandfeel.currency_factor
end

#_price_local(price) ⇒ Object



28
29
30
# File 'lib/oddb/html/view/drugs/ajax/explain_price.rb', line 28

def _price_local(price)
  price * @lookandfeel.price_factor
end

#_tax_add(price) ⇒ Object



40
41
42
43
# File 'lib/oddb/html/view/drugs/ajax/explain_price.rb', line 40

def _tax_add(price)
  factor = @lookandfeel.tax_factor_add
  _price_local(price) / (1.0 + factor) * factor
end

#_tax_sub(price) ⇒ Object



47
48
49
50
# File 'lib/oddb/html/view/drugs/ajax/explain_price.rb', line 47

def _tax_sub(price)
  factor = @lookandfeel.tax_factor_sub
  _price_db(price) / (1.0 + factor) * factor
end

#_value(key, price) ⇒ Object



51
52
53
54
55
# File 'lib/oddb/html/view/drugs/ajax/explain_price.rb', line 51

def _value(key, price)
  value = HtmlGrid::Value.new(key, price, @session, self)
  value.value = price
  value
end

#price_db(price) ⇒ Object



31
32
33
# File 'lib/oddb/html/view/drugs/ajax/explain_price.rb', line 31

def price_db(price)
  _value :price_db, _price_db(price)
end

#price_local(price) ⇒ Object



25
26
27
# File 'lib/oddb/html/view/drugs/ajax/explain_price.rb', line 25

def price_local(price)
  _value :price_local, _price_local(price)
end

#tax_add(price) ⇒ Object



37
38
39
# File 'lib/oddb/html/view/drugs/ajax/explain_price.rb', line 37

def tax_add(price)
  _value :tax_add, ['+', _tax_add(price)]
end

#tax_sub(price) ⇒ Object



44
45
46
# File 'lib/oddb/html/view/drugs/ajax/explain_price.rb', line 44

def tax_sub(price)
  _value :tax_sub, ['-', _tax_sub(price)]
end