Sha256: 8f7d75d84c6d74bee4dea4de318776207867775cf1a04fbcad79b37388d29527

Contents?: true

Size: 699 Bytes

Versions: 9

Compression:

Stored size: 699 Bytes

Contents

class Admin::ReportsController < Admin::BaseController
  before_filter :load_data  
  
  AVAILABLE_REPORTS = {
    :sales_total => {:name => "Sales Total", :description => "Sales Total For All Orders"}
  }

  def index
    @reports = AVAILABLE_REPORTS
  end
  
  def sales_total

    @search = Order.new_search(params[:search])
    #set order by to default or form result
    @search.order_by ||= :created_at
    @search.order_as ||= "DESC"
    
    @orders = @search.find(:all)    

    @item_total = @search.sum(:item_total)
    @ship_total = @search.sum(:ship_amount)
    @tax_total = @search.sum(:tax_amount)
    @sales_total = @search.sum(:total)
  end

  private 
  def load_data

  end  

end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
kdmny-spree-0.0.1 app/controllers/admin/reports_controller.rb
spree-0.8.4 app/controllers/admin/reports_controller.rb
spree-0.8.5 app/controllers/admin/reports_controller.rb
spree-0.7.0 app/controllers/admin/reports_controller.rb
spree-0.7.1 app/controllers/admin/reports_controller.rb
spree-0.8.0 app/controllers/admin/reports_controller.rb
spree-0.8.1 app/controllers/admin/reports_controller.rb
spree-0.8.2 app/controllers/admin/reports_controller.rb
spree-0.8.3 app/controllers/admin/reports_controller.rb