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

SELECT
	*
FROM
	dbo.fn_GetLotDispositions()
UNION
SELECT
	*
FROM
	dbo.fn_GetMRBs()
UNION
SELECT
	*
FROM
	dbo.fn_GetECNs()
UNION
SELECT
	*
FROM
	dbo.fn_GetLTWorkRequests()
UNION
SELECT
	*
FROM
	dbo.fn_GetChangeControl()
UNION
SELECT
	*
FROM
	dbo.fn_GetPRs()
ORDER BY
	DocumentType,
	SubDoc,
	IssueID DESC
END
GO