Alexa.com 190746 (World) - 4615 (TR)
0 Üye ve 1 Ziyaretçi konuyu incelemekte.
( WRNUM(1,(ROUND([Net Toplam]*100)/100),1)+" Türk Lirası "+WRNUM(1,(ROUND([Net Toplam]*100)/100),2) +" "+ " Kuruş" )
CREATE function dbo.fnc_ParayiYaziyaCevir (@num AS numeric(38,2), @isMoney as bit)returns varchar(255)ASBEGINDECLARE @Split tinyintDECLARE @iSplit tinyintDECLARE @sNum varchar(20)DECLARE @NumSet varchar(3)DECLARE @Char char(1)DECLARE @NumText varchar(255)DECLARE @SetText varchar(100)DECLARE @HunText varchar(100)DECLARE @CharText varchar(50)DECLARE @Match bitDECLARE @Point tinyintDECLARE @Cents varchar(2)DECLARE @CentText varchar(100)DECLARE @NumStrings TABLE (Num int, NumStr varchar(20))INSERT INTO @NumStringsSELECT 1, 'Bir'UNION SELECT 2, 'İki'UNION SELECT 3, 'Üç'UNION SELECT 4, 'Dört'UNION SELECT 5, 'Beş'UNION SELECT 6, 'Altı'UNION SELECT 7, 'Yedi'UNION SELECT 8, 'Sekiz'UNION SELECT 9, 'Dokuz'UNION SELECT 10, 'On'UNION SELECT 11, 'Onbir'UNION SELECT 12, 'Oniki'UNION SELECT 13, 'Onüç'UNION SELECT 14, 'Ondört'UNION SELECT 15, 'Onbeş'UNION SELECT 16, 'Onaltı'UNION SELECT 17, 'Onyedi'UNION SELECT 18, 'Onsekiz'UNION SELECT 19, 'Ondokuz'UNION SELECT 20, 'Yirmi'UNION SELECT 30, 'Otuz'UNION SELECT 40, 'Kırk'UNION SELECT 50, 'Elli'UNION SELECT 60, 'Altmış'UNION SELECT 70, 'Yetmiş'UNION SELECT 80, 'Seksen'UNION SELECT 90, 'Doksan'SET @sNum = cast(@num as varchar(20))SET @Point = charindex('.', @sNum)IF @Point > 0BEGINSET @Cents = substring(@sNum, @Point + 1, 2)SET @sNum = left(@sNum, @Point-1)IF @isMoney = 1BEGIN SET @Match = (select count(*) FROM @NumStrings WHERE Num = @Cents)IF @Match <> 0BEGINSET @CentText = (select NumStr FROM @NumStrings WHERE Num = @Cents)ENDELSEBEGINSET @CentText = isnull((select NumStr FROM @NumStrings WHERE Num = left(@Cents, 1) + '0'),'') + (select NumStr from @NumStrings where Num = right(@Cents, 1))ENDENDELSEBEGINSET @CentText = isnull((select NumStr FROM @NumStrings WHERE Num = left(@Cents, 1)),'') + isnull((select NumStr from @NumStrings where Num = right(@Cents, 1)),'')ENDENDIF @CentText IS NULLSET @CentText = ''SET @Split = ((len(@sNum)-1) / 3) + 1SET @iSplit = 0SET @NumText = ''WHILE @iSplit < @SplitBEGINSET @CharText = ''SET @HunText = ''SET @SetText = ''SET @NumSet = right(left(@sNum, len(@sNum) - @iSplit * 3), 3)IF len(@Numset) = 3 BEGINSET @Char = left(@NumSet, 1)if @Char='1' SET @HunText = 'Yüz'ELSESET @HunText = isnull((select NumStr FROM @NumStrings WHERE Num = @Char) + 'Yüz', '')SET @SetText = @HunTextENDSET @Match = (select count(*) FROM @NumStrings WHERE Num = right(@NumSet, 2))IF @Match <> 0BEGINSET @CharText = (select NumStr FROM @NumStrings WHERE Num = right(@NumSet, 2))ENDELSEBEGINSET @CharText = isnull((select NumStr FROM @NumStrings WHERE Num = left(right(@NumSet, 2), 1) + '0'),'') + (select NumStr from @NumStrings where Num = right(@NumSet, 1))ENDIF @CharText IS NULL SET @CharText = ''IF @SetText IS NULL set @SetText = ''IF @HunText <> '' AND @CharText <> ''SET @SetText = @SetText + ''IF @HunText = '' AND @CharText <> '' and @iSplit = 0 and @Split > 1 and @CentText = ''SET @SetText = '' + @SetTextSET @SetText = @SetText + @CharTextif @iSplit = 1 AND @SetText='Bir' BEGIN SET @SetText=''SET @SetText = @SetText + CASE @iSplitWHEN 0 THEN ''WHEN 1 THEN 'Bin'WHEN 2 THEN 'Milyon'WHEN 3 THEN 'Milyar'WHEN 4 THEN 'Trilyon'WHEN 5 THEN 'Katrilyon'END + CASE WHEN len(@NumText) > 0 THEN '' ELSE '' endENDELSEBEGINIF @SetText <> ''SET @SetText = @SetText + CASE @iSplitWHEN 0 THEN ''WHEN 1 THEN 'Bin'WHEN 2 THEN 'Milyon'WHEN 3 THEN 'Milyar'WHEN 4 THEN 'Trilyon'WHEN 5 THEN 'Katrilyon'END + CASE WHEN len(@NumText) > 0 THEN '' ELSE '' endENDSET @NumText = @SetText + @NumTextSET @iSplit = @iSplit + 1ENDIF @isMoney = 1 AND @NumText <> '' and rtrim(ltrim(@NumText)) <> 'Bir'SET @NumText = @NumText + ' Türk Lirası'IF @isMoney = 1 AND rtrim(ltrim(@NumText)) = 'Bir'SET @NumText = @NumText + ' Türk Lirası'IF @isMoney = 1 AND @CentText <> '' and rtrim(ltrim(@CentText)) <> 'Bir'SET @CentText = @CentText + ' Kuruş'IF @isMoney = 1 AND rtrim(ltrim(@CentText)) = 'Bir'SET @CentText = @CentText + ' Kuruş'IF @isMoney = 0 AND @CentText <> ''SET @CentText = ' Point' + @CentTextIF @isMoney = 1 AND @NumText <> '' and @CentText <> ''SET @CentText = ' ' + @CentTextSET @NumText = @NumText + @CentTextIF left(@sNum, 1) = '-'SET @NumText = 'virgül' + @NumTextRETURN @NumTextEND
_SQLINFO("DBO.fnc_ParayiYaziyaCevir(NETTOTAL,1)","LG_001_01_INVOICE","LOGICALREF='"+ STR(R23.logicalRef)+"'")
( WRNUM(1,(ROUND([Net Toplam]*100)/100),1)+" Türk Lirası "+IF((ROUND([Net Toplam])-[Net Toplam])<>0,WRNUM(1,[Net Toplam],2) +" "+ " Kuruş",""))