﻿USE [FabApprovalSystem]
GO
	/****** Object:  StoredProcedure [dbo].[GetTaskListByUser]    Script Date: 11/21/2024 11:29:04 AM ******/
SET
	ANSI_NULLS ON
GO
SET
	QUOTED_IDENTIFIER ON
GO
	CREATE PROCEDURE [dbo].[GetTaskListByUser] @UserID INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
SET
	NOCOUNT ON;

--List of documents waiting on the user for approval/rejection
SELECT
	*
FROM
	dbo.fn_GetLotDispositionsByUser(@UserID)
UNION
SELECT
	*
FROM
	dbo.fn_GetMRBByUser(@UserID)
UNION
SELECT
	*
FROM
	fn_GetECNsByUser(@UserID)
UNION
SELECT
	*
FROM
	fn_GetLTWorkRequestsByUser(@UserID)
UNION
SELECT
	*
FROM
	fn_Get8DCAByUser(@UserID)
UNION
SELECT
	*
FROM
	fn_Get8DAuditByUser(@UserID)
UNION
SELECT
	*
from
	fn_GetPRsByUser(@UserID)
UNION
SELECT
	*
from
	fn_Get8DCASectionByUser(@UserID)
UNION
SELECT
	*
from
	fn_GetExpiredTECNByOriginator(@UserID, 360)
ORDER BY
	DocumentType,
	IssueID DESC
END
GO