How to Convert Amount (Currency) in words directly on Crystal Report.
Just Simply copy paste below code in your Custom function.
ii) Right click on Formula Fields click on New give specific name. E.g. GetAmountInWords.
iv) Now Right click on 'Report Custom Function' click on New and give a specific
name and select Use Editor.
v) Function Editor window will. open just paste the Code given below
Function (numberVar Amount)
stringVar StrAmt1 :=ToText(Amount);
StrAmt1:=Replace(StrAmt1,',','');
stringVar StrAmt :=Mid(StrAmt1,1,InStr(StrAmt1,'.',1)-1);
stringVar StrAmtP :=Mid(StrAmt1,InStr(StrAmt1,'.',1)+1);
StringVar Array ArrIdx := MakeArray("5", "7","9", "11", "13", "15", "17", "19" );
numberVar Array HIdx := MakeArray(0,0,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10 );
StringVar Array HigherDigitMarathiNos := MakeArray( "", "", "शे", "हजार", "लाख", "करोड़", "अरब", "खरब", "नील" );
StringVar Array HundredMarathiDigit := MakeArray("", "एक", "दोन ", "तीन", "चार", "पाच ", "सहा", "सात", "आठ", "नऊ", "दहा",
"अकरा", "बारा", "तेरा", "चौदा", "पंधरा", "सोळा", "सतरा", "अठरा", "एकोणवीस", "वीस",
"एकवीस", "बावीस", "तेवीस", "चोवीस", "पंचवीस", "सव्वीस", "सत्तावीस", "अठ्ठावीस", "एकोणतीस","तीस",
"एकतीस", "बत्तीस", "तेहेतीस", "चौतीस", "पस्तीस", "छत्तीस", "सदतीस", "अडतीस", "एकोणचाळीस", "चाळीस",
"एक्केचाळीस", "बेचाळीस", "त्रेचाळीस", "चव्वेचाळीस", "पंचेचाळीस", "सेहेचाळीस", "सत्तेचाळीस", "अठ्ठेचाळीस", "एकोणपन्नास", " पन्नास",
"एक्कावन्न", "बावन्न", "त्रेपन्न", "चोपन्न", "पंचावन्न", "छप्पन्न", "सत्तावन्न", "अठ्ठावन्न", "एकोणसाठ", "साठ",
"एकसष्ठ", "बासष्ठ", "त्रेसष्ठ", "चौसष्ठ", "पासष्ठ", "सहासष्ठ", "सदुसष्ठ", "अडुसष्ठ", "एकोणसत्तर", "सत्तर",
"एक्काहत्तर", "बाहत्तर", "त्र्याहत्तर", "चौर्याहत्तर", "पंच्याहत्तर", "शहात्तर ", "सत्याहत्तर ", "अठ्ठ्याहत्तर ", "एकोण ऐंशी", "ऐंशी",
"एक्क्य़ाऐंशी", "ब्याऐंशी", "ञ्याऐंशी", "चौऱ्याऐंशी", "पंच्याऐंशी", "शहाऐंशी", "सत्त्याऐंशी", "अठ्ठ्याऐंशी", "एकोणनव्वद", "नव्वद",
"एक्क्याण्णव", "ब्याण्णव", "त्र्याण्णव", "चौऱ्याण्णव", " पंच्याण्णव", "शहाण्णव", "सत्त्याण्णव", "अठ्ठ्याण्णव", " नव्व्याण्णव","शंभर");
//stringVar strNo:=HundredMarathiDigit[ToNumber(StrAmt)+1];
stringVar result:="";
if StrAmt = "0" then result:= "शून्य"
else IF StrAmt = "0" then result:= "शंभर"
Else
(
stringVar retNos:="";
numberVar cnt1:=0;
for cnt1:= Length(StrAmt) to 1 step -1 do
(
numberVar stp := 1;
numberVar HStep := 2;
booleanVar is2Digit := false;
numberVar strE:=cnt1;
booleanVar isFound:=false;
numberVar cnt2:=0;
for cnt2:=1 to count(ArrIdx) step 1 do
(
if strE = ToNumber(ArrIdx[cnt2]) then
(
stp := 2;
isFound:=true;
cnt2:=count(ArrIdx)+1;
)
);
if cnt1 >=4 then
(
retNos:= retNos+ " "+ HundredMarathiDigit[ToNumber(Mid(StrAmt,(Length(StrAmt)+1)-cnt1,stp))+1]+
HigherDigitMarathiNos[HIdx[cnt1]];
if isFound=true then cnt1:= cnt1-1;
retNos:= retNos;
)
else if cnt1 =3 then
(
retNos:= retNos+ " "+ HundredMarathiDigit[ToNumber(Mid(StrAmt,(Length(StrAmt)+1)-cnt1,1))+1] +
HigherDigitMarathiNos[HIdx[cnt1]];
)
else
(
retNos:= retNos+ " "+ HundredMarathiDigit[ToNumber(Mid(StrAmt,(Length(StrAmt)+1)-cnt1,2))+1];
cnt1:= cnt1 -1;
retNos:= retNos;
)
);
if ToNumber(StrAmtP)>0 then
result:=TrimRight(retNos)+ " रूपये आणी "+ HundredMarathiDigit[ToNumber(ToNumber(StrAmtP))+1]+ " पैसे "
else
result:=TrimRight(retNos)+ " रूपये ";
)
vii) Right click on our formula function and call our custom function in it.
viii) Just drag the Field to your specific required Location that done...
i) {EMP.SAL} : This is a Database Field. Change as per your requirement.
Please note if you have Currency as Datatype in DB than Do use ToNumber() function
to convert it to number otherwise it will throw error of Number Required.
How To Convert Amount In Words Using Crystal Report? >>>>> Download Now
ReplyDelete>>>>> Download Full
How To Convert Amount In Words Using Crystal Report? >>>>> Download LINK
>>>>> Download Now
How To Convert Amount In Words Using Crystal Report? >>>>> Download Full
>>>>> Download LINK ma