app/helpers/opportunities_helper.rb
# Generates the inline revenue message for the opportunity list table.
#----------------------------------------------------------------------------
Generates the inline revenue message for the opportunity list table.
Generates the inline revenue message for the opportunity list table .
def opportunity_revenue_message(opportunity, detailed = false)
    msg = []
    won_or_lost = %w[won lost].include?(opportunity.stage)
    msg << content_tag(:b, number_to_currency(opportunity.weighted_amount, precision: 0)) if opportunity.weighted_amount != 0
    unless won_or_lost
      if detailed
        msg << number_to_currency(opportunity.amount.to_f, precision: 0) if opportunity.amount.to_f != 0
        msg << t(:discount) + ' ' + number_to_currency(opportunity.discount, precision: 0) if opportunity.discount.to_f != 0
      end
      msg << t(:probability) + ' ' + opportunity.probability.to_s + '%' if opportunity.probability.to_i != 0
    end
    msg << opportunity_closes_on_message(opportunity, won_or_lost)
    msg.join(' | ').html_safe
  end
def opportunity_revenue_message ( opportunity , detailed = false ) msg = [ ] won_or_lost = %w[ won lost ] . include? ( opportunity . stage ) msg << content_tag ( :b , number_to_currency ( opportunity . weighted_amount , precision : 0 ) ) if opportunity . weighted_amount != 0 unless won_or_lost if detailed msg << number_to_currency ( opportunity . amount . to_f , precision : 0 ) if opportunity . amount . to_f != 0 msg << t ( :discount ) + ' ' + number_to_currency ( opportunity . discount , precision : 0 ) if opportunity . discount . to_f != 0 end msg << t ( :probability ) + ' ' + opportunity . probability . to_s + '%' if opportunity . probability . to_i != 0 end msg << opportunity_closes_on_message ( opportunity , won_or_lost ) msg . join ( ' | ' ) . html_safe end
Generates the inline revenue message for the opportunity list table.
Generates the inline revenue message for the opportunity list table .
opportunity
detailed