Class: Search::OrderTextPresenter

Inherits:
OrderPresenter
  • Object
show all
Defined in:
app/presenters/search/order_text_presenter.rb

Overview

Presenter: order text presenter.

Delegated Instance Attributes collapse

Instance Method Summary collapse

Instance Method Details



18
19
20
21
22
# File 'app/presenters/search/order_text_presenter.rb', line 18

def contact_link
  return unless r.has_columns?(:contact_full_name, :contact_id)

  r.contact_full_name.to_s
end


6
7
8
9
10
# File 'app/presenters/search/order_text_presenter.rb', line 6

def customer_link
  return unless r.has_columns?(:customer_full_name, :customer_id)

  "#{r.customer_full_name} (CN#{r.customer_id})"
end

#estimated_costObject

Alias for R#estimated_cost

Returns:

  • (Object)

    R#estimated_cost

See Also:



32
# File 'app/presenters/search/order_text_presenter.rb', line 32

delegate :estimated_cost, to: :r

#gross_revenueObject



26
# File 'app/presenters/search/order_text_presenter.rb', line 26

def gross_revenue = r.line_total || 0.00

#msrpObject



30
# File 'app/presenters/search/order_text_presenter.rb', line 30

def msrp = r.line_total_msrp || 0.00

#notes_indicatorObject



24
# File 'app/presenters/search/order_text_presenter.rb', line 24

def notes_indicator = h.text_only(r.notes)


4
# File 'app/presenters/search/order_text_presenter.rb', line 4

def order_link = r.reference_number || "Cart id #{r.id}"

#revenue_consolidated_at_time_of_checkoutObject

order.revenue_consolidated_at_time_of_checkout should NEVER be nil, but hey it happens, very rarely, for no explicable reason, the fix is to set it to order.total



35
# File 'app/presenters/search/order_text_presenter.rb', line 35

def revenue_consolidated_at_time_of_checkout = r.revenue_consolidated_at_time_of_checkout || r.total


12
13
14
15
16
# File 'app/presenters/search/order_text_presenter.rb', line 12

def spiff_rep_link
  return unless r.has_columns?(:spiff_rep_full_name, :spiff_rep_id)

  r.spiff_rep_full_name.to_s
end

#total_revenueObject



28
# File 'app/presenters/search/order_text_presenter.rb', line 28

def total_revenue = r.total || 0.00