Class: Crm::Reports::CouponSalesReportController
- Inherits:
-
CrmController
- Object
- CrmController
- Crm::Reports::CouponSalesReportController
- Includes:
- Controllers::ReportCommandFlashable
- Defined in:
- app/controllers/crm/reports/coupon_sales_report_controller.rb
Overview
Controller: coupon sales report.
Instance Method Summary collapse
Instance Method Details
#show ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/crm/reports/coupon_sales_report_controller.rb', line 8 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 |