Forums » Development »
Redmine Reports
Added by Peter Drábik about 11 years ago
Hi dear, my english is bad.
I need help with creating weekly reports in redmine for my boss. I need report for him with collumns number, user, project, issue, comment, spent time for selected week, estimated time and total spent time including with spent time from previous week
Thanks for help me
Replies (13)
RE: Redmine Reports - Added by Martin Denizet (redmine.org team member) about 11 years ago
Hello Peter,
In my opinion, you have 2 options:- Create a plugin, which could be a problem if you have no experience with Ruby On Rails
- Use an external reporting tool. I had successes using BIRT
I went both ways. For me it depends on the load and the user experience you which to have.
For big loads I'd recommend BIRT (or similar) with scheduled PDF sent by email for example.
For integrated interactive experience, I'd go for a plugin.
Hope it helps!
RE: Redmine Reports - Added by Peter Drábik about 11 years ago
Thanks Martin,
I create a plugin with export to csv file. I have a problem with file encoding. Csv file is utf-8 and I need cp1250. I can encoding it after download, but it does not like my boss. Can you help me with this?
I found this on google, but it does not work:
respond_to do |format|
format.html { render :action => 'details', :layout => false if request.xhr? }
format.csv { send_data @timesheet.to_csv, :filename => 'report.csv', :type => 'text/csv, charset=windows-1250, header=present' }
end
Thanks for your help
RE: Redmine Reports - Added by Martin Denizet (redmine.org team member) about 11 years ago
You could try:
format.csv { send_data @timesheet.to_csv.encode('Windows-1250'), :disposition => 'attachment; filename=report.csv', :type => 'text/csv, charset=windows-1250, header=present' }
RE: Redmine Reports - Added by Peter Drábik about 11 years ago
I try it, but it doesnt work for me :(
RE: Redmine Reports - Added by Martin Denizet (redmine.org team member) about 11 years ago
What's the output?
RE: Redmine Reports - Added by Peter Drábik about 11 years ago
Internal error
An error occurred on the page you were trying to access.
If you continue to experience problems please contact your Redmine administrator for assistance.
If you are the Redmine administrator, check your log files for details about the error.
Back
This works fine, but output is in UTF8
respond_to do |format|
format.html { render :action => 'details', :layout => false if request.xhr? }
format.csv { send_data @timesheet.to_csv, :filename => 'timesheet.csv', :type => "text/csv" }
end
RE: Redmine Reports - Added by Peter Drábik about 11 years ago
I need help with this:
I have a code:
d e csv_header
csv_data = [
l(:label_date),
l(:jmeno),
l(:zakazka),
l(:ukol),
l(:popiska),
l(:field_hours),
l(:planik),
l(:vycerpane)
]
Redmine::Hook.call_hook(:plugin_timesheet_model_timesheet_csv_header, { :timesheet => self, :csv_data => csv_data})
return csv_data
end
def time_entry_to_csv(time_entry)
csv_data = [
time_entry.spent_on,
time_entry.user.name,
time_entry.project.name,
(time_entry.issue.subject if time_entry.issue),
time_entry.comments,
time_entry.hours,
time_entry.issue.estimated_hours,
time_entry.issue.spent_hours
]
Redmine::Hook.call_hook(:plugin_timesheet_model_timesheet_time_entry_to_csv, { :timesheet => self, :time_entry => time_entry, :csv_data => csv_data})
return csv_data
end@
I need to achieve this - when a comment is blank, so instead display the character "-"
Thanks for your help
RE: Redmine Reports - Added by Peter Drábik about 11 years ago
This works fine
def time_entry_to_csv(time_entry)
csv_data = [
time_entry.spent_on,
time_entry.user.name,
time_entry.project.name,
(time_entry.issue.subject if time_entry.issue),
if time_entry.comments == ""
puts = '-'
else time_entry.comments
end,
time_entry.hours,
time_entry.issue.estimated_hours,
time_entry.issue.spent_hours
]
RE: Redmine Reports - Added by Martin Denizet (redmine.org team member) about 11 years ago
Is your problem solved now?
RE: Redmine Reports - Added by Peter Drábik about 11 years ago
Yes, all works fine, but I still have a problem with the encoding output csv file
RE: Redmine Reports - Added by Martin Denizet (redmine.org team member) about 11 years ago
If you upload your plugin, I'll have a look.
RE: Redmine Reports - Added by Peter Drábik about 11 years ago
Ok, it's working.
My problem is solved now
RE: Redmine Reports - Added by Pavel Potcheptsov about 11 years ago
Please post your solution for reporting here.