﻿USE [FabApprovalSystem]
GO
	/****** Object:  UserDefinedFunction [dbo].[fnGetLotCount_Fab]    Script Date: 11/21/2024 11:31:55 AM ******/
SET
	ANSI_NULLS ON
GO
SET
	QUOTED_IDENTIFIER ON
GO
	-- =============================================
	-- Author:		<Author,,Name>
	-- Create date: <Create Date, ,>
	-- Description:	<Description, ,>
	-- =============================================
	CREATE FUNCTION [dbo].[fnGetLotCount_Fab] (
		-- Add the parameters for the function here
		@IssueID INT
	) RETURNS FLOAT AS BEGIN DECLARE @FabCount INT -- Declare the return variable here
SET
	@FabCount = 0
SET
	@FabCount = (
		SELECT
			COUNT(*)
		FROM
			Lot L
		WHERE
			L.IssueID = @IssueID
			AND L.Location NOT IN ('6300', '6400 ', '6600', 'QDB')
	) -- Return the result of the function
	RETURN @FabCount
END
GO