S
ss028955
Hi,
I am having trouble creating query to produce Timeseet billing report with
the fields below.
SSR_Number (Custom Field), Application name (Custom field) , Project Name,
Department code (Custom Field), GL_Code (Custom Field), Capex Code (Custom
Field), Product Code (Custom Field), Actual Hours, Actual Amount, Estimated
Hrs, Estimated Amount , Timesheet Period
Additional Information:
The first query below is without Timesheet Period Name which is working
fine.But as soon as I link the query with timesheets table (Query 2 below) to
add timesheet period, the value just doubles up. Can someone help?
Query1: Query without timesheet.
SELECT TOP 100 PERCENT p.SSR_Number, p.Application_Name, p.ProjectName,
p.GL_Code, p.Project_Code, p.Property, p.Project_Status, p.Department,
CONVERT(varchar(7), abd.TimeByDay, 111) AS TimeByDay,
abd.AssignmentCost AS Estimated_Cost, abd.AssignmentWork AS Estimated_Hour,
abd.AssignmentActualCost AS Actual_Cost,
abd.AssignmentActualWork AS Actual_Hour
FROM dbo.MSP_EpmProject_UserView p INNER JOIN
dbo.MSP_EpmTask_UserView t ON p.ProjectUID =
t.ProjectUID INNER JOIN
dbo.MSP_EpmAssignment_UserView a ON p.ProjectUID =
a.ProjectUID AND t.TaskUID = a.TaskUID INNER JOIN
dbo.MSP_EpmAssignmentByDay_UserView abd ON
a.ProjectUID = abd.ProjectUID AND a.TaskUID = abd.TaskUID AND
a.AssignmentUID = abd.AssignmentUID
WHERE (t.TaskIsProjectSummary = 0)
ORDER BY p.ProjectName
Query 2: Modified Query with Timesheet Period Name: It is not returning
correct value
SELECT TOP 100 PERCENT p.SSR_Number, p.Application_Name, p.ProjectName,
p.GL_Code, p.Project_Code, p.Property, p.Project_Status, p.Department,
CONVERT(varchar(7), abd.TimeByDay, 111) AS TimeByDay,
abd.AssignmentCost AS Estimated_Cost, abd.AssignmentWork AS Estimated_Hour,
abd.AssignmentActualCost AS Actual_Cost,
abd.AssignmentActualWork AS Actual_Hour, dbo.MSP_TimesheetPeriod.PeriodName
FROM dbo.MSP_Timesheet INNER JOIN
dbo.MSP_TimesheetLine ON
dbo.MSP_Timesheet.TimesheetUID = dbo.MSP_TimesheetLine.TimesheetUID INNER JOIN
dbo.MSP_TimesheetProject ON
dbo.MSP_TimesheetLine.ProjectNameUID =
dbo.MSP_TimesheetProject.ProjectNameUID INNER JOIN
dbo.MSP_EpmProject_UserView p INNER JOIN
dbo.MSP_EpmTask_UserView t ON p.ProjectUID =
t.ProjectUID INNER JOIN
dbo.MSP_EpmAssignment_UserView a ON p.ProjectUID =
a.ProjectUID AND t.TaskUID = a.TaskUID INNER JOIN
dbo.MSP_EpmAssignmentByDay_UserView abd ON
a.ProjectUID = abd.ProjectUID AND a.TaskUID = abd.TaskUID AND
a.AssignmentUID = abd.AssignmentUID ON
dbo.MSP_TimesheetProject.ProjectUID = abd.ProjectUID INNER JOIN
dbo.MSP_TimesheetPeriod ON dbo.MSP_Timesheet.PeriodUID
= dbo.MSP_TimesheetPeriod.PeriodUID
WHERE (t.TaskIsProjectSummary = 0)
ORDER BY p.ProjectName
Thanks in Advance.
ss028955
I am having trouble creating query to produce Timeseet billing report with
the fields below.
SSR_Number (Custom Field), Application name (Custom field) , Project Name,
Department code (Custom Field), GL_Code (Custom Field), Capex Code (Custom
Field), Product Code (Custom Field), Actual Hours, Actual Amount, Estimated
Hrs, Estimated Amount , Timesheet Period
Additional Information:
The first query below is without Timesheet Period Name which is working
fine.But as soon as I link the query with timesheets table (Query 2 below) to
add timesheet period, the value just doubles up. Can someone help?
Query1: Query without timesheet.
SELECT TOP 100 PERCENT p.SSR_Number, p.Application_Name, p.ProjectName,
p.GL_Code, p.Project_Code, p.Property, p.Project_Status, p.Department,
CONVERT(varchar(7), abd.TimeByDay, 111) AS TimeByDay,
abd.AssignmentCost AS Estimated_Cost, abd.AssignmentWork AS Estimated_Hour,
abd.AssignmentActualCost AS Actual_Cost,
abd.AssignmentActualWork AS Actual_Hour
FROM dbo.MSP_EpmProject_UserView p INNER JOIN
dbo.MSP_EpmTask_UserView t ON p.ProjectUID =
t.ProjectUID INNER JOIN
dbo.MSP_EpmAssignment_UserView a ON p.ProjectUID =
a.ProjectUID AND t.TaskUID = a.TaskUID INNER JOIN
dbo.MSP_EpmAssignmentByDay_UserView abd ON
a.ProjectUID = abd.ProjectUID AND a.TaskUID = abd.TaskUID AND
a.AssignmentUID = abd.AssignmentUID
WHERE (t.TaskIsProjectSummary = 0)
ORDER BY p.ProjectName
Query 2: Modified Query with Timesheet Period Name: It is not returning
correct value
SELECT TOP 100 PERCENT p.SSR_Number, p.Application_Name, p.ProjectName,
p.GL_Code, p.Project_Code, p.Property, p.Project_Status, p.Department,
CONVERT(varchar(7), abd.TimeByDay, 111) AS TimeByDay,
abd.AssignmentCost AS Estimated_Cost, abd.AssignmentWork AS Estimated_Hour,
abd.AssignmentActualCost AS Actual_Cost,
abd.AssignmentActualWork AS Actual_Hour, dbo.MSP_TimesheetPeriod.PeriodName
FROM dbo.MSP_Timesheet INNER JOIN
dbo.MSP_TimesheetLine ON
dbo.MSP_Timesheet.TimesheetUID = dbo.MSP_TimesheetLine.TimesheetUID INNER JOIN
dbo.MSP_TimesheetProject ON
dbo.MSP_TimesheetLine.ProjectNameUID =
dbo.MSP_TimesheetProject.ProjectNameUID INNER JOIN
dbo.MSP_EpmProject_UserView p INNER JOIN
dbo.MSP_EpmTask_UserView t ON p.ProjectUID =
t.ProjectUID INNER JOIN
dbo.MSP_EpmAssignment_UserView a ON p.ProjectUID =
a.ProjectUID AND t.TaskUID = a.TaskUID INNER JOIN
dbo.MSP_EpmAssignmentByDay_UserView abd ON
a.ProjectUID = abd.ProjectUID AND a.TaskUID = abd.TaskUID AND
a.AssignmentUID = abd.AssignmentUID ON
dbo.MSP_TimesheetProject.ProjectUID = abd.ProjectUID INNER JOIN
dbo.MSP_TimesheetPeriod ON dbo.MSP_Timesheet.PeriodUID
= dbo.MSP_TimesheetPeriod.PeriodUID
WHERE (t.TaskIsProjectSummary = 0)
ORDER BY p.ProjectName
Thanks in Advance.
ss028955