Actions
Patch #224
closedGetting all the spent time in all issues for each month
Patch #224:
Getting all the spent time in all issues for each month
Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Description
Just adding this two functions to a controller and just adding a link to getxls
and you get an excel file with all issues for a particular month with all the spent time, projects, and user. Works
fine in Postgresql. You need spreadsheet-excel gem.
def getxls
gen_xls
send_file '/tmp/redmine_time.xls', :type => 'application/vnd.ms-excel', :filename => 'redmine.xls'
endquery = "
SELECT
DISTINCT ON (time_entries.issue_id)
time_entries.tmonth
, time_entries.tyear
, users.login
, projects.name as project_name
, issues.subject
, (
SELECT
SUM(hours) AS sp
FROM
time_entries AS te
WHERE
te.issue_id = time_entries.issue_id
AND te.tmonth = " + month.to_s + "
AND te.tyear = " + year.to_s + "
) AS total_hours
, time_entries.issue_id
FROM
time_entries
, issues
, users
, projects
WHERE
time_entries.issue_id = issues.id
AND
users.id = time_entries.user_id
AND
projects.id = time_entries.project_id
AND
time_entries.tmonth = " + month.to_s + "
AND
time_entries.tyear = " + year.to_s + ";
"
Actions