/****** Object:  UserDefinedFunction [dbo].[ValueOfPAYAInFormdata]    Script Date: 21/08/2021 05:54:06 ب.ظ ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

-- =============================================
-- Author:		Azimi
-- Create date: 1396/05/05
-- Description:	
-- =============================================
CREATE FUNCTION [dbo].[ValueOfPAYAInFormdata] 
(
	@FormData nvarchar(1000)
)
RETURNS DECIMAL(28,5)
AS
BEGIN
	DECLARE @Result DECIMAL(28,5)

	DECLARE @Index as integer
	SET @Index = 1
	while @Index < 5
	begin
		--print @FormData
		set @FormData = Substring(@FormData,CHARINDEX(';',@FormData)+1, 1000)
		set @Index = @Index+1
	end
	SELECT @Result =CAST( REPLACE(LEFT(@FormData,CHARINDEX(';',@FormData)-1),'/','.') as decimal(28,5))

	RETURN @Result

END