Class: Crm::Report::CustomerPerformanceResultsPresenter
- Inherits:
-
BasePresenter
- Object
- BasePresenter
- Crm::Report::CustomerPerformanceResultsPresenter
- Defined in:
- app/presenters/crm/report/customer_performance_results_presenter.rb
Instance Method Summary collapse
Instance Method Details
#check_box ⇒ Object
28 29 30 31 |
# File 'app/presenters/crm/report/customer_performance_results_presenter.rb', line 28 def check_box return unless grouping == :customer_identity h.check_box_tag 'customer_ids[]', customer_id, false, { form: 'pin_customers' } end |
#group_link ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/presenters/crm/report/customer_performance_results_presenter.rb', line 4 def group_link case grouping when :customer_identity h.content_tag :td, h.link_to(customer_name, h.customer_path(customer_id)) when :state_code state = State.find_by(code: group_identifier) title = state.try(:name) || "Other" region = state.try(:region) || "Other" h.content_tag(:td, h.link_to(title, { action: :show, command: { grouping: :customer_identity, state_codes: [group_identifier] }})) + h.content_tag(:td, region) when :report_grouping h.content_tag :td, h.link_to(group_identifier, { action: :show, command: { grouping: :customer_identity, report_groupings: [group_identifier] }}) when :profile_name h.content_tag :td, h.link_to(group_identifier, { action: :show, command: { grouping: :customer_identity, profile_ids: [profile_ids] }}) when :buying_group_ids h.content_tag :td, h.link_to(group_identifier, { action: :show, command: { grouping: :customer_identity, buying_group_ids: [] }}) when :primary_sales_rep_id primary_rep = Employee.find(group_identifier) h.content_tag :td, h.link_to(primary_rep.full_name, { action: :show, command: { grouping: :customer_identity, primary_sales_rep_ids: [group_identifier] }}) else h.content_tag :td, group_identifier end end |
#sales_revenue_link(period_index) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'app/presenters/crm/report/customer_performance_results_presenter.rb', line 33 def sales_revenue_link(period_index) period_data = periods[period_index] = {:show_zero => true, :counter_class => ''} [:num_records] = period_data.sales_revenue [:format] = :currency [:query_params] = {} [:query_params][:gl_date_gteq] = period_data.period.first [:query_params][:gl_date_lteq] = period_data.period.last [:query_params][:customer_id_eq] = customer_id if customer_id.present? [:query_params][:buying_group_id_in] = if .present? [:query_params][:profile_id_in] = profile_ids if profile_ids.present? [:query_params][:company_id_in] = company_ids if company_ids.present? [:query_params][:state_code_in] = state_codes if state_codes.present? [:query_params][:report_grouping] = report_groupings if report_groupings.present? [:query_params][:primary_sales_rep_id_includes] = primary_sales_rep_ids if primary_sales_rep_ids.present? h.query_template_link(InvoiceSearch, nil, )[0] end |