Module: ErpCommerce::Extensions::ActiveRecord::ActsAsPriceable::InstanceMethods
- Defined in:
- lib/erp_commerce/extensions/active_record/acts_as_priceable.rb
Defined Under Namespace
Classes: Helper
Instance Method Summary collapse
- #get_current_simple_amount_with_currency ⇒ Object
- #get_current_simple_plan ⇒ Object
- #get_default_price ⇒ Object
- #help ⇒ Object
Instance Method Details
#get_current_simple_amount_with_currency ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/erp_commerce/extensions/active_record/acts_as_priceable.rb', line 30 def get_current_simple_amount_with_currency amount = nil plan = get_current_simple_plan unless plan.nil? amount = help.number_to_currency(plan.money_amount, :unit => plan.currency.symbol) end amount end |
#get_current_simple_plan ⇒ Object
39 40 41 |
# File 'lib/erp_commerce/extensions/active_record/acts_as_priceable.rb', line 39 def get_current_simple_plan self.pricing_plans.where('is_simple_amount = ? and (from_date <= ? and thru_date >= ? or (from_date is null and thru_date is null))', true, Date.today, Date.today).first end |
#get_default_price ⇒ Object
26 27 28 |
# File 'lib/erp_commerce/extensions/active_record/acts_as_priceable.rb', line 26 def get_default_price self.pricing_plans.first.get_price end |
#help ⇒ Object
48 49 50 |
# File 'lib/erp_commerce/extensions/active_record/acts_as_priceable.rb', line 48 def help Helper.instance end |