Thank you, exactly. You're right.
We're using Project Server 2003
I'm tryed to get it from MSP_View tables
select proj.ProjectTitle, task.TaskName, res.ResourceName
from MSP_VIEW_PROJ_ASSN_TP_BY_DAY assnByDay
inner join MSP_VIEW_PROJ_PROJECTS_STD proj
on assnByDay.ProjectUniqueID = proj.ProjectUniqueID
inner join MSP_VIEW_PROJ_ASSN_STD assnStd
on assnByDay.AssignmentUniqueID = assnStd.AssignmentUniqueID
inner join MSP_WEB_PROJECTS webProj
on assnByDay.WPROJ_ID = webProj.WPROJ_ID
and proj.WPROJ_ID = webProj.WPROJ_ID
and assnStd.WPROJ_ID = webProj.WPROJ_ID
and assnStd.ProjectUniqueID = proj.ProjectUniqueID
inner join MSP_VIEW_PROJ_RES_STD res
on assnStd.ResourceEnterpriseUniqueID = res.ResourceEnterpriseUniqueID
and assnStd.ResourceUniqueID = res.ResourceUniqueID
and res.WPROJ_ID = webProj.WPROJ_ID
and res.ProjectUniqueID = proj.ProjectUniqueID
inner join MSP_VIEW_PROJ_TASKS_STD task
on assnStd.TaskUniqueID = task.TaskUniqueID
and task.WPROJ_ID = webProj.WPROJ_ID
and task.ProjectUniqueID = proj.ProjectUniqueID
where assnByDay.AssignmentTimeStart <= @FinalDate and
assnByDay.AssignmentTimeFinish >= @StartDate
order by ResourceName
but i'm can't find some projects
I'm tryed to get it from MSP_Web tables
declare @res_name as nvarchar(255)
declare @assn_id as int
declare @assnPM_id as int
declare @total_days as int
declare @td_value as int
declare @td_start as datetime
declare @ApprovalStatus as int
declare @ActualPendingValue as decimal(25,6)--ожидающие акцепта трудозатраты
declare @ActualApprovedValue as decimal(25,6)--акцептованные трудозатраты
declare @td_cur_date as datetime
declare @project_name as nvarchar(510)
declare @task_name as nvarchar(510)
declare @pm_name as nvarchar(255)
--возвращаемые запланированные данные
declare @ScheduledReturnValuesDataTable table(
TaskDate datetime,
Value decimal(25,9),
TaskName nvarchar(510),
ProjectName nvarchar(255),
ResourceName nvarchar(255),
PM nvarchar(255))
--возвращаемые отчетные данные
declare @ActualReturnValuesDataTable table(
TaskDate datetime,
PendingValue decimal(25,9),
AprrovedValue decimal(25,9),
TaskName nvarchar(510),
ProjectName nvarchar(255),
ResourceName nvarchar(255),
PM nvarchar(255))
declare td cursor for
select distinct
a.WASSN_ID,
a. WRES_ID_MGR,
w.WWORK_START,
r.RES_NAME,
datediff(day, WWORK_START, WWORK_FINISH)+1,
w.WWORK_VALUE,
w.WWORK_UPDATE_STATUS
from
dbo.MSP_WEB_WORK as w
inner join dbo.MSP_WEB_ASSIGNMENTS as a
on a.WASSN_ID = w.WASSN_ID
inner join dbo.MSP_WEB_RESOURCES as r
on a.WRES_ID = r.WRES_ID
inner join dbo.MSP_VIEW_PROJ_RES_ENT as e
on r.WRES_RBS_UID = e.ResourceEnterpriseOutlineCode30ID
where
w.WWORK_TYPE = @WorkType
and ( @StartDate <= WWORK_FINISH and @FinalDate >= WWORK_START)
and e.ResourceEnterpriseOutlineCode30ID <> -1
and e.ResourceEnterpriseOutlineCode30ID <> 310
and r.WRES_IS_ENABLED = 1
and r.WRES_CAN_LOGIN = 1
and SUBSTRING(e.ResourceEnterpriseText1, 0, 255) = @Department
order by WWORK_START
-- вытаÑкиваем данные из курÑора
open td
fetch next from td into @assn_id, @assnPM_id, @td_start, @res_name,
@total_days, @td_value, @ApprovalStatus
while @@fetch_status <> -1
begin
select @td_cur_date = @td_start
while @total_days > 0
begin
select @task_name =
( select TASK_NAME
from MSP_WEB_ASSIGNMENTS
where WASSN_ID = @assn_id )
select @project_name =
( select PROJ_NAME
from MSP_WEB_PROJECTS p, MSP_WEB_ASSIGNMENTS a
where a.WASSN_ID = @assn_id and a.WPROJ_ID = p.WPROJ_ID )
select @pm_name =
( select RES_NAME from dbo.MSP_WEB_RESOURCES where WRES_ID = @assnPM_id)
--еÑли запрашиваютÑÑ Ð·Ð°Ð¿Ð»Ð°Ð½Ð¸Ñ€Ð¾Ð²Ð°Ð½Ð½Ñ‹Ðµ данные
if @WorkType = 0
begin
insert @ScheduledReturnValuesDataTable values ( @td_cur_date, @td_value,
@task_name, @project_name, @res_name, @pm_name)
end
else--отчетные
begin
set @ActualPendingValue = 0
set @ActualApprovedValue = 0
if @ApprovalStatus = 0
begin
set @ActualApprovedValue = @td_value
end
else
set @ActualPendingValue = @td_value
insert @ActualReturnValuesDataTable values ( @td_cur_date,
@ActualPendingValue, @ActualApprovedValue,
@task_name, @project_name, @res_name, @pm_name)
end
select @td_cur_date = DATEADD(d, 1, @td_cur_date)
select @total_days = @total_days - 1
end
-- возвращаем Ñледующую Ñтроку из курÑора
fetch next from td into @assn_id, @assnPM_id, @td_start, @res_name,
@total_days, @td_value, @ApprovalStatus
end
close td
deallocate td
--еÑли запрашиваютÑÑ Ð·Ð°Ð¿Ð»Ð°Ð½Ð¸Ñ€Ð¾Ð²Ð°Ð½Ð½Ñ‹Ðµ данные
if @WorkType = 0
begin
select
ProjectName,
TaskName,
PM,
ResourceName,
TaskDate,
SUM(Value/60000) as Value
from
@ScheduledReturnValuesDataTable
group by ProjectName, TaskName, ResourceName, TaskDate, PM
order by ResourceName
end
else--отчетные
begin
select
ProjectName,
TaskName,
PM,
ResourceName,
TaskDate,
SUM(PendingValue/60000) as PendingValue,
SUM(AprrovedValue/60000) as AprrovedValue
from
@ActualReturnValuesDataTable
group by ProjectName, TaskName, ResourceName, TaskDate, PM
order by ResourceName
end
but i'm can't find some projects too