﻿USE [FabApprovalSystem]
GO
	/****** Object:  StoredProcedure [dbo].[GetLotDispositionItemForRead_05012017]    Script Date: 11/21/2024 11:29:04 AM ******/
SET
	ANSI_NULLS ON
GO
SET
	QUOTED_IDENTIFIER ON
GO
	-- =============================================
	-- Author:		<Author,,Name>
	-- Create date: <Create Date,,>
	-- Description:	<Description,,>
	-- =============================================
	CREATE PROCEDURE [dbo].[GetLotDispositionItemForRead_05012017] @IssueID INT,
	@UserID INT,
	@IsITAR INT OUTPUT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	DECLARE @RHRowCount INT DECLARE @ITARRowCount INT -- find if there are any Radhard parts
SELECT
	@RHRowCount = COUNT(*)
FROM
	dbo.fnGetLot_RH(@IssueID) IF (@RHRowCount > 0) BEGIN -- get the ITAR accessibility
SELECT
	@ITARRowCount = COUNT(*)
FROM
	dbo.fnIsUserITARCompliant(@UserID) IF (@ITARRowCount > 0)
SET
	@IsITAR = 1
	ELSE
SET
	@IsITAR = 0
END
SELECT
	LD.*,
	U.FirstName + ' ' + U.LastName AS OriginatorName
FROM
	LotDisposition LD
	LEFT JOIN Users U ON LD.OriginatorID = U.UserID
WHERE
	IssueID = @IssueID
SELECT
	DepartmentID
FROM
	LotDispoDepartment
WHERE
	IssueID = @IssueID
END
GO