Report generation. Download csv

This commit is contained in:
German Galia
2019-06-12 10:17:31 +02:00
parent 139b2720d8
commit 9d1ca3bfd4
63 changed files with 1528 additions and 40 deletions

View File

@@ -1,5 +1,6 @@
module Budgets
class ExecutionsController < ApplicationController
include DownloadSettingsHelper
before_action :load_budget
load_and_authorize_resource :budget
@@ -8,6 +9,19 @@ module Budgets
authorize! :read_executions, @budget
@statuses = Milestone::Status.all
@investments_by_heading = investments_by_heading_ordered_alphabetically.to_h
downloadables = []
investments_by_heading_ordered_alphabetically
.map { |heading| downloadables.concat heading[1] }
respond_to do |format|
format.html
format.csv { send_data to_csv(downloadables,
Budget::Investment,
1),
type: "text/csv",
disposition: "attachment",
filename: "budget_investment_milestones.csv" }
end
end
private