on 11-28-2007 8:43 PM
is there a way to print the cash amount in more than one languague in the PLD?? For example, I need to be able to print the amount of a check (12 = doce or twelve )in Spanish and English but not in the same PLD. I can do these if a change the language in SBO but dont want to do these everytime i need to do these. Any idea?
do you mean amount in words ? it if yes, depends on local setting design. If not available you need to develop query scripts and formatted search query. I have made amount in words in Indonesian. I created UDF for it and define query FMS to run it.
Rgds,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All,
Amount in words could be solved by creating store procedure, functions or addons. If SP or functions, you do not need to create installer and ard file. just using FMS to run the SP or Functions. Here is the functions:
USE [MUTHA_FC]
GO
/****** Object: UserDefinedFunction [dbo].[FN_Terbilang] Script Date: 11/28/2007 02:52:42 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create Function [dbo].[FN_Terbilang](@s Varchar(50))
RETURNS varchar(1024)
AS
BEGIN
DECLARE @ANSWER varchar(1024)
DECLARE @a char(1),
@b char(1),
@c char(1),
@i int,
@j int,
@result VARCHAR(1024),
@orlen int --,@s Varchar(50)
SET @orlen=LEN(@s)
IF LEN(@s) % 3>0
BEGIN
SET @s=' '+ @S
END
IF LEN(@s) % 3>0
BEGIN
SET @s=' '+ @s
END
SET @i=1
SET @result=''
IF LEN(@s)=1 AND @s='0'
BEGIN
SET @result='zero'
END
WHILE @i<=LEN(@s)
BEGIN
SET @j=LEN(@s)-@i+1
SET @a=substring(@s,@j,1)
SET @b=substring(@s,@j-1,1)
SET @c=substring(@s,@j-2,1)
IF isnumeric(@a)=1
BEGIN
SET @result =
case
WHEN (@i-1=3) AND (@c@b@a<>'000') THEN (CASE WHEN (@a='1') and
(@b=0) THEN 'Seribu' ELSE 'ribu' END)
WHEN (@i-1=6) AND (@c@b@a<>'000')
THEN (CASE WHEN (@a='1') and (@b=0) THEN 'Satu juta' ELSE 'juta' END)
WHEN (@i-1=9) AND (@c@b@a<>'000') THEN
(CASE WHEN (@a='1') and (@b=0) THEN 'Satu milyar' ELSE 'milyar' END)
WHEN (@i-1=12) AND (@c@b@a<>'000') THEN
(CASE WHEN (@a='1') and (@b=0) THEN 'Satu trilyun' ELSE 'trilyun' END)
ELSE ''
END ' ' @result
IF @b!='1' OR @b=' '
BEGIN
IF SubString(@result,1,6)='Seribu' OR SubString(@result,1,11)='Satu milyar'
OR SubString(@result,1,9)='Satu juta'OR
SubString(@result,1,12)='Satu trilyun'
BEGIN
SET @orlen=10
END
ELSE
BEGIN
SET @result =
CASE @a
WHEN '1' THEN 'Satu'
WHEN '2' THEN 'Dua'
WHEN '3' THEN 'Tiga'
WHEN '4' THEN 'Empat'
WHEN '5' THEN 'Lima'
WHEN '6' THEN 'Enam'
WHEN '7' THEN 'Tujuh'
WHEN '8' THEN 'Delapan'
WHEN '9' THEN 'Sembilan'
ELSE ''
END' ' @result
END
END
IF (isnumeric(@b)=1 )AND (@b!='0')
BEGIN
IF @b='1'
BEGIN
SET @result=CASE @a
WHEN '0' THEN 'Sepuluh'
WHEN '1' THEN 'Sebelas'
WHEN '2' THEN 'Dua belas'
WHEN '3' THEN 'Tiga belas'
WHEN '4' THEN 'Empat belas'
WHEN '5' THEN 'Lima belas'
WHEN '6' THEN 'Enam belas'
WHEN '7' THEN 'Tujuh belas'
WHEN '8' THEN 'Delapan belas'
WHEN '9' THEN 'Sembilan belas'
ELSE ''
END' ' @result
END
ELSE
BEGIN
SET @result=CASE @b
WHEN '2' THEN 'Dua puluh'
WHEN '3' THEN 'Tiga puluh'
WHEN '4' THEN 'Empat puluh'
WHEN '5' THEN 'Lima puluh'
WHEN '6' THEN 'Enam puluh'
WHEN '7' THEN 'Tujuh puluh'
WHEN '8' THEN 'Delapan puluh'
WHEN '9' THEN 'Sembilan puluh'
ELSE ''
END' ' @result
END
END
END
IF (isnumeric(@c)=1)AND (@c!='0')
BEGIN
IF @c='1'
BEGIN
SET @result='Seratus'' ' @result
END
ELSE
BEGIN
SET @result =
CASE @c
--WHEN '1' THEN 'Satu'
WHEN '2' THEN 'Dua'
WHEN '3' THEN 'Tiga'
WHEN '4' THEN 'Empat'
WHEN '5' THEN 'Lima'
WHEN '6' THEN 'Enam'
WHEN '7' THEN 'Tujuh'
WHEN '8' THEN 'Delapan'
WHEN '9' THEN 'Sembilan'
ELSE ''
END' Ratus'' '+ @result
END
END
SET @i=@i+3
END
SET @result=LTRIM(RTRIM(@result))
SELECT @ANSWER=@result + ' rupiah' --OUTPUT
RETURN @ANSWER
END
In addition to previous functions :
USE [MUTHA_FC]
GO
/****** Object: UserDefinedFunction [dbo].[FN_Terbilang1] Script Date: 11/28/2007 02:52:21 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE Function [dbo].[FN_Terbilang1](@s Varchar(50))
RETURNS varchar(8000)
AS
BEGIN
DECLARE @ANSWER varchar(8000)
DECLARE @CommaPos int
DECLARE @Curr varchar(3)
set @CommaPos = patindex('%.%',@s)
set @Curr = left(@s,3)
if @CommaPos = 0
set @ANSWER = dbo.FN_Terbilang(@s)
else
begin
set @ANSWER = dbo.FN_Terbilang(left(@s, @CommaPos - 1))
set @s = right(@s, len(@s) - @CommaPos)
if cast(@s as int) > 0
begin
set @ANSWER = replace(@ANSWER,' rupiah','') + ' koma '
while right(@s,1) = '0'
begin
set @s = left(@s, len(@s) - 1)
end
while left(@s,1) = '0'
begin
set @ANSWER = @ANSWER + 'nol '
set @s = right(@s, len(@s) - 1)
end
set @ANSWER = @ANSWER + dbo.FN_Terbilang(@s)
end
end
set @ANSWER = rtrim(replace(@ANSWER, 'rupiah', '')) +
case @Curr
when 'IDR' then ' rupiah'
when 'USD' then ' US dollar'
when 'SGD' then ' Singapore Dollar'
else ''
end
RETURN @ANSWER
END
Here are the requirements but can't be fullfilled byt the above functions:
1. LC 233,990.0007 --> amount in words must be 133,990.00
2. LC 210,749.9999 --> amount in words must be 210,750.00
3. LC 9,080,000.0021 --> amount in words must be 9,080,000.00
LC are taken from doctotal field of AR invoice. I have tested the functions and giving some changes in the scripts but fails. Still can't overcome the 3rd requirement.
If you have some idea, pls share to me.
Rgds,
User | Count |
---|---|
100 | |
11 | |
11 | |
6 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.