6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'app/controllers/crm/reports/coupon_sales_report_controller.rb', line 6
def show
@report_command = ::Report::CouponSalesReport::CouponSalesReportCommand.new(coupon_sales_report_command_params)
@result = @report_command.execute
flash_report_command_errors
respond_to do |format|
format.html
format.turbo_stream
format.csv do
send_data @report_command.to_by_coupons_csv, filename: "coupons-#{Date.current}.csv" if params[:report] == 'coupons'
send_data @report_command.to_by_items_csv, filename: "items-#{Date.current}.csv" if params[:report] == 'items'
send_data @report_command.to_coupons_items_csv, filename: "coupons-items-#{Date.current}.csv" if params[:report] == 'coupons-items'
end
end
end
|