Class: Search::VoucherPresenter
- Inherits:
-
BasePresenter
show all
- Includes:
- Presenters::Timeable
- Defined in:
- app/presenters/search/voucher_presenter.rb
Overview
Presenter: voucher presenter.
Instance Attribute Summary
#current_account, #options, #url_helper
Instance Method Summary
collapse
#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
#currency_symbol ⇒ Object
26
27
28
|
# File 'app/presenters/search/voucher_presenter.rb', line 26
def currency_symbol
Money::Currency.new('USD').symbol
end
|
#due_date ⇒ Object
46
47
48
|
# File 'app/presenters/search/voucher_presenter.rb', line 46
def due_date
h.render_date(r.due_date)
end
|
#gl_date ⇒ Object
42
43
44
|
# File 'app/presenters/search/voucher_presenter.rb', line 42
def gl_date
h.render_date(r.gl_date)
end
|
#invoice_date ⇒ Object
38
39
40
|
# File 'app/presenters/search/voucher_presenter.rb', line 38
def invoice_date
h.render_date(r.invoice_date)
end
|
#open_amount ⇒ Object
34
35
36
|
# File 'app/presenters/search/voucher_presenter.rb', line 34
def open_amount
h.number_to_currency(r.open_amount, unit: currency_symbol)
end
|
#payee_link ⇒ Object
50
51
52
53
54
|
# File 'app/presenters/search/voucher_presenter.rb', line 50
def payee_link
return unless r.has_columns?(:payee_name, :payee_id)
h.link_to(r.payee_name, h.polymorphic_path(r.payee))
end
|
#supplier_link ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'app/presenters/search/voucher_presenter.rb', line 12
def supplier_link
path = case r.supplier_type
when 'Supplier'
h.supplier_path(r.supplier_id)
when 'Employee'
h.employee_path(r.supplier_id)
when 'Contact'
h.contact_path(r.supplier_id)
when 'Customer'
h.customer_path(r.supplier_id)
end
h.link_to(r.supplier_name, path)
end
|
#total ⇒ Object
30
31
32
|
# File 'app/presenters/search/voucher_presenter.rb', line 30
def total
h.number_to_currency(r.total, unit: currency_symbol)
end
|
#voucher_link ⇒ Object
8
9
10
|
# File 'app/presenters/search/voucher_presenter.rb', line 8
def voucher_link
h.link_to(r.reference_number, h.voucher_path(r.id))
end
|