Sha256: 210b9a06263f122d863cbedcecd89818c475c47e6769f9817c8df3968d9c2487

Contents?: true

Size: 864 Bytes

Versions: 35

Compression:

Stored size: 864 Bytes

Contents

class DiscountsReportsController < ArtfullyOseController
  def index
    @start_date = params[:start_date]
    @end_date = params[:end_date]
    @organization = current_user.current_organization
    @codes = Discount.unique_codes_for(current_user.current_organization)
    code = (params[:code]==Discount::ALL_DISCOUNTS_STRING ? nil : params[:code])
    @report = nil
    @report = DiscountsReport.new(@organization, code, @start_date, @end_date) unless params[:code].nil?
    @rows = @report.rows.paginate(:page => params[:page], :per_page => 100) unless @report.nil?

    respond_to do |format|
      format.html

      format.csv do
        @filename = [ @report.header, ".csv" ].join
        @csv_string = @report.rows.to_comma
        send_data @csv_string, :filename => @filename, :type => "text/csv", :disposition => "attachment"
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
artfully_ose-1.3.0.pre4 app/controllers/discounts_reports_controller.rb
artfully_ose-1.3.0.pre3 app/controllers/discounts_reports_controller.rb
artfully_ose-1.3.0.pre2 app/controllers/discounts_reports_controller.rb
artfully_ose-1.3.0.pre1 app/controllers/discounts_reports_controller.rb
artfully_ose-1.2.0 app/controllers/discounts_reports_controller.rb
artfully_ose-1.2.0.beta.1 app/controllers/discounts_reports_controller.rb
artfully_ose-1.2.0.alpha.2 app/controllers/discounts_reports_controller.rb
artfully_ose-1.2.0.alpha.1 app/controllers/discounts_reports_controller.rb
artfully_ose-1.2.0.pre.27 app/controllers/discounts_reports_controller.rb
artfully_ose-1.2.0.pre.26 app/controllers/discounts_reports_controller.rb
artfully_ose-1.2.0.pre.24 app/controllers/discounts_reports_controller.rb
artfully_ose-1.2.0.pre.23 app/controllers/discounts_reports_controller.rb
artfully_ose-1.2.0.pre.21 app/controllers/discounts_reports_controller.rb
artfully_ose-1.2.0.pre.20 app/controllers/discounts_reports_controller.rb
artfully_ose-1.2.0.pre.19 app/controllers/discounts_reports_controller.rb
artfully_ose-1.2.0.pre.18 app/controllers/discounts_reports_controller.rb
artfully_ose-1.2.0.pre.17 app/controllers/discounts_reports_controller.rb
artfully_ose-1.2.0.pre.16 app/controllers/discounts_reports_controller.rb
artfully_ose-1.2.0.pre.15 app/controllers/discounts_reports_controller.rb
artfully_ose-1.2.0.pre.12 app/controllers/discounts_reports_controller.rb