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.2.0.pre.11 app/controllers/discounts_reports_controller.rb
artfully_ose-1.2.0.pre.10 app/controllers/discounts_reports_controller.rb
artfully_ose-1.2.0.pre.9 app/controllers/discounts_reports_controller.rb
artfully_ose-1.2.0.pre.8 app/controllers/discounts_reports_controller.rb
artfully_ose-1.2.0.pre.7 app/controllers/discounts_reports_controller.rb
artfully_ose-1.2.0.pre.6 app/controllers/discounts_reports_controller.rb
artfully_ose-1.2.0.pre.5 app/controllers/discounts_reports_controller.rb
artfully_ose-1.2.0.pre.4 app/controllers/discounts_reports_controller.rb
artfully_ose-1.2.0.pre.3 app/controllers/discounts_reports_controller.rb
artfully_ose-1.2.0.pre.2 app/controllers/discounts_reports_controller.rb
artfully_ose-1.2.0.pre.1 app/controllers/discounts_reports_controller.rb
artfully_ose-1.2.0.pre app/controllers/discounts_reports_controller.rb
artfully_ose-1.1.0 app/controllers/discounts_reports_controller.rb
artfully_ose-1.1.0.rc2 app/controllers/discounts_reports_controller.rb
artfully_ose-1.1.0.rc1 app/controllers/discounts_reports_controller.rb