Class: Spree::SalesPerformanceReport::Result::Observation

Inherits:
Report::TimedObservation show all
Defined in:
app/reports/spree/sales_performance_report.rb

Instance Attribute Summary

Attributes inherited from Report::TimedObservation

#date, #hour, #reportable_keys

Instance Method Summary collapse

Methods inherited from Report::TimedObservation

#day_name, #describes?, #hour_name, #initialize, #month_name, #to_h

Methods inherited from Report::Observation

build_from_hash, build_from_list, #initialize, observation_fields, #to_h

Constructor Details

This class inherits a constructor from Spree::Report::TimedObservation

Instance Method Details

#cost_priceObject



13
14
15
# File 'app/reports/spree/sales_performance_report.rb', line 13

def cost_price
  @cost_price.to_f
end

#profit_lossObject



21
22
23
# File 'app/reports/spree/sales_performance_report.rb', line 21

def profit_loss
  @profit_loss.to_f
end

#profit_loss_percentObject



25
26
27
28
# File 'app/reports/spree/sales_performance_report.rb', line 25

def profit_loss_percent
  return (profit_loss * 100 / cost_price).round(2) unless cost_price.zero?
  0.0
end

#promotion_discountObject



30
31
32
# File 'app/reports/spree/sales_performance_report.rb', line 30

def promotion_discount
  @promotion_discount.to_f
end

#sale_priceObject



17
18
19
# File 'app/reports/spree/sales_performance_report.rb', line 17

def sale_price
  @sale_price.to_f
end