ALTER PROCEDURE [dbo].[RptHourly_ApproverStatus]
@BU varchar(10) = NULL ,
@Reviewer Varchar(60) = NULL,
@Approver Varchar(60) = NULL,
@perf_status varchar(30) =NULL ,
@Approval_Status varchar(40)=NULL
-- Add the parameters for the stored procedure here
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
SELECT dbo.ADP_Feed_0318.NodeID, dbo.ADP_Feed_0318.FirstName + ' ' + dbo.ADP_Feed_0318.LastName AS Employee,
ADP_Feed_0318_1.FirstName + ' ' + ADP_Feed_0318_1.LastName AS Reviewer,
CASE
WHEN (ADP_Feed_0318.Perf_Status = 2)THEN 'In Progress'
WHEN (ADP_Feed_0318.Perf_Status = 3) THEN 'Complete'
WHEN (ADP_Feed_0318.Perf_Status IS NULL)
THEN 'Not Started' ELSE 'Not Started' END Perf_Status,
ADP_Feed_0318_2.FirstName + ' ' + ADP_Feed_0318_2.LastName AS Approver,
CASE
WHEN (ADP_Feed_0318.Approval_Status = 2)THEN 'In Progress'
WHEN (ADP_Feed_0318.Approval_Status = 3) THEN 'Complete'
WHEN (ADP_Feed_0318.Approval_Status IS NULL)
THEN 'Not Started' ELSE 'Not Started' END Approval_Status,
dbo.ADP_Feed_0318.BU,
CONVERT(FLOAT,dbo.ADP_Feed_0318.Perf_Average) AS [CalculatedRating],
dbo.ADP_Feed_0318.Manager_Average AS [Overall Rating]
FROM dbo.ADP_Feed_0318
INNER JOIN
dbo.ADP_Feed_0318 AS ADP_Feed_0318_1
ON dbo.ADP_Feed_0318.MgrNodeID = ADP_Feed_0318_1.NodeID
INNER JOIN
dbo.ADP_Feed_0318 AS ADP_Feed_0318_2
ON ADP_Feed_0318_1.MgrNodeID = ADP_Feed_0318_2.NodeID
WHERE (dbo.ADP_Feed_0318.TYPE ='0')
AND (ADP_FEED_0318.BU= @BU )
OR (ADP_Feed_0318_2.FirstName + ' ' + ADP_Feed_0318_2.LastName = @Approver) --
OR (ADP_Feed_0318_1.FirstName + ' ' + ADP_Feed_0318_1.LastName = @Reviewer)OR (ADP_FEED_0318.Approval_Status = @Approval_status )
|