Class: Search::SalesCommissionPresenter

Inherits:
BasePresenter
  • Object
show all
Includes:
Presenters::Timeable
Defined in:
app/presenters/search/sales_commission_presenter.rb

Overview

Presents sales commission search results with HTML links and formatted currency.

Instance Attribute Summary

Attributes inherited from BasePresenter

#current_account, #options, #url_helper

Instance Method Summary collapse

Methods inherited from BasePresenter

#can?, #capture, #concat, #content_tag, #fa_icon, #h, #initialize, #link_to, #number_to_currency, #present, presents, #r, #safe_present, #simple_format, #u

Constructor Details

This class inherits a constructor from BasePresenter

Instance Method Details

#co_cm_bdString

Returns the combined commission/CM/BD amount formatted as currency.

Returns:

  • (String)

    the formatted co/cm/bd amount



63
64
65
# File 'app/presenters/search/sales_commission_presenter.rb', line 63

def co_cm_bd
  h.number_to_currency(r.co_cm_bd)
end

#cogsString

Returns the cost of goods sold formatted as currency.

Returns:

  • (String)

    the formatted COGS amount



49
50
51
# File 'app/presenters/search/sales_commission_presenter.rb', line 49

def cogs
  h.number_to_currency(r.cogs)
end

Returns a link to the commission record.

Returns:

  • (ActiveSupport::SafeBuffer)

    the commission link



21
22
23
# File 'app/presenters/search/sales_commission_presenter.rb', line 21

def commission_link
  h.link_to(r.commission_view, h.sales_commission_path(r.id))
end

#earned_commissionString

Returns the earned commission formatted as currency.

Returns:

  • (String)

    the formatted earned commission



77
78
79
# File 'app/presenters/search/sales_commission_presenter.rb', line 77

def earned_commission
  h.number_to_currency(r.earned_commission)
end

Returns a link to the employee.

Returns:

  • (ActiveSupport::SafeBuffer)

    the employee link



14
15
16
# File 'app/presenters/search/sales_commission_presenter.rb', line 14

def employee_link
  h.link_to(r.employee_name, h.employee_path(r.employee_id))
end

#net_baseString

Returns the net base amount formatted as currency.

Returns:

  • (String)

    the formatted net base amount



70
71
72
# File 'app/presenters/search/sales_commission_presenter.rb', line 70

def net_base
  h.number_to_currency(r.net_base)
end

#profitString

Returns the profit formatted as currency.

Returns:

  • (String)

    the formatted profit



56
57
58
# File 'app/presenters/search/sales_commission_presenter.rb', line 56

def profit
  h.number_to_currency(r.profit)
end

#review_dateString

Returns the formatted review date.

Returns:

  • (String)

    the review date



35
36
37
# File 'app/presenters/search/sales_commission_presenter.rb', line 35

def review_date
  h.render_date(r.review_date)
end

Returns a link to the reviewing employee.

Returns:

  • (ActiveSupport::SafeBuffer)

    the reviewer link



28
29
30
# File 'app/presenters/search/sales_commission_presenter.rb', line 28

def reviewer_link
  h.link_to(r.reviewer_name, h.employee_path(r.updater_id))
end

#salesString

Returns the sales amount formatted as currency.

Returns:

  • (String)

    the formatted sales amount



42
43
44
# File 'app/presenters/search/sales_commission_presenter.rb', line 42

def sales
  h.number_to_currency(r.sales)
end