Class: Search::InvoiceSummaryPresenter
- Inherits:
-
BasePresenter
- Object
- SimpleDelegator
- BasePresenter
- Search::InvoiceSummaryPresenter
- Defined in:
- app/presenters/search/invoice_summary_presenter.rb
Overview
Footer summary presenter for the CRM invoice advanced search.
Aggregates line totals and consolidated amounts across a collection of
invoice search results.
Instance Attribute Summary
Attributes inherited from BasePresenter
#current_account, #options, #url_helper
Instance Method Summary collapse
-
#profit_consolidated ⇒ String
Sum of consolidated profit formatted in USD.
-
#revenue ⇒ String
Sum of invoice line totals formatted as currency.
-
#revenue_consolidated ⇒ String
Sum of consolidated revenue formatted in USD.
-
#total ⇒ String
Sum of invoice grand totals formatted as currency.
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
#profit_consolidated ⇒ String
Sum of consolidated profit formatted in USD.
34 35 36 |
# File 'app/presenters/search/invoice_summary_presenter.rb', line 34 def profit_consolidated h.number_to_currency results.to_a.sum { |i| i.profit_consolidated || 0.00 }, unit: 'USD$ ' end |
#revenue ⇒ String
Sum of invoice line totals formatted as currency.
13 14 15 |
# File 'app/presenters/search/invoice_summary_presenter.rb', line 13 def revenue h.number_to_currency(results.to_a.sum { |i| i.line_total || 0.00 }) end |
#revenue_consolidated ⇒ String
Sum of consolidated revenue formatted in USD.
27 28 29 |
# File 'app/presenters/search/invoice_summary_presenter.rb', line 27 def revenue_consolidated h.number_to_currency results.to_a.sum { |i| i.revenue_consolidated || 0.00 }, unit: 'USD$ ' end |
#total ⇒ String
Sum of invoice grand totals formatted as currency.
20 21 22 |
# File 'app/presenters/search/invoice_summary_presenter.rb', line 20 def total h.number_to_currency(results.to_a.sum { |i| i.total || 0.00 }) end |