Wednesday, December 17, 2014

Amount in Words using XML/BI Publisher Tags

I once had a requirement to display the amount(number) to words(letters). And below is the approach i have followed.

We can convert the Amount into Words in two different ways:

1)Using the XML/BI Publisher Tag (Applicable only to R12).
2)Using the function IBY_AMOUNT_IN_WORDS.Get_Amount_In_Words(TOTAL_AMOUNTS1)

1) Using XML/BI Publisher Tag:

a)  

--> CASE_INIT_CAP, CASE_UPPER, and CASE_LOWER are available to display the text  in Initial Caps,Upper Case,Lower Case respectively.
--> DECIMAL_STYLE_FRACTION1(default), DECIMAL_STYLE_FRACTION2, and DECIMAL_STYLE_WORDS are available.
--> USD in the above tag can be replaced by the curreny code required as per the requirement.

b)  
[ Sorry, there was a problem writing the tag in my browser,so i have taken a snapshot of it and pasted here. ]

2)  Using IBY_AMOUNT_IN_WORDS.Get_Amount_In_Words(TOTAL_AMOUNTS1)

 Example :
declare
v1 VARCHAr2(2000);
begin
v1:=IBY_AMOUNT_IN_WORDS.Get_Amount_In_Words(p_amount =>101324546014);
dbms_output.put_line('amount: '||v1);
end; 

If you expect the Amount in Words to show as shown below

--> One Thousand Pounds and 14 Pence.
 --> One Hundred Euros and 1 Cent.
--> 1 Dollar and 99 Cents.
  
Refer the Oracle Document for setting the currency unit and sub_unit in the system. Click ME.

Challa. 

No comments:

Post a Comment