# numeral to txt conversion indian rupee

Hi all

i amconverting numeral to txt …

and i have written methood but in this it is printing like for 5478999 it is printing “five lakhs four hundreds Seventy eight thousands nine hundreds and Ninety nine Only”

but i want it like “fifty four lakh seventy eight thousand nine hundred ninty nine only”

help me

below is the code which i have written

static TempStr ltnumeralsToTxt_IND(real _num)

{

int numOfPennies = (decRound(frac(_num), 2) * 100) mod 100;

real test = _num - frac(_num);

int64 numOfTenths;

str 20 ones[19], tenths[9], hundreds, thousands, lakhs, crores, arabs;

int64 temp;

str 200 returntxt;

int64 testLoc;

//number to text

real modOperator(real a1, real a2)

{

int tmpi;

real tmp1, tmp2;

tmp1 = a1 / a2;

tmpi = real2int(tmp1);

tmp2 = tmpi;

return (tmp1 - tmp2)*a2;

}

real checkPower(real _test, int64 _power)

{

int64 numOfPower;

if (_test >= _power)

{

testLoc = real2double(_test);

numOfPower = testLoc div _power;

if (numOfPower >= 100)

{

temp = numOfPower div 100;

returntxt = returntxt + ’ ’ + ones[temp] + ’ ’ + hundreds;

numOfPower = numOfPower mod 100;

}

if (numOfPower >= 20)

{

temp = numOfPower div 10;

returntxt = returntxt + ’ ’ + tenths[temp];

numOfPower = numOfPower mod 10;

}

if (numOfPower >= 1)

{

returntxt = returntxt + ’ ’ + ones[numOfPower]; //LT

numOfPower = numOfPower mod 10;

}

switch(_power)

{

case 1000000000000 :

returntxt = returntxt + ’ ’ + arabs;

_test = modOperator(_test, 1000000000000.00);

break;

case 1000000000 :

returntxt = returntxt + ’ ’ + crores;

_test = modOperator(_test, 1000000000);

break;

case 1000000 :

returntxt = returntxt + ’ ’ + lakhs;

_test = modOperator(_test, 1000000);

break;

case 1000 :

returntxt = returntxt + ’ ’ + thousands;

_test = modOperator(_test, 1000);

break;

case 100 :

returntxt = returntxt + ’ ’ + hundreds;

_test = modOperator(_test, 100);

break;

}

}

return _test;

}

ones[1] = “one”;

ones[2] = “two”;

ones[3] = “three”;

ones[4] = “four”;

ones[5] = “five”;

ones[6] = “six”;

ones[7] = “seven”;

ones[8] = “eight”;

ones[9] = “nine”;

ones[10] = “ten”;

ones[11] = “@SYS26633”;

ones[12] = “@SYS26634”;

ones[13] = “@SYS26635”;

ones[14] = “@SYS26636”;

ones[15] = “@SYS26637”;

ones[16] = “@SYS26638”;

ones[17] = “@SYS26639”;

ones[18] = “@SYS26640”;

ones[19] = “@SYS26641”;

tenths[1] = “@SYS26642”;

tenths[2] = “@SYS26643”;

tenths[3] = “@SYS26644”;

tenths[4] = “@SYS26645”;

tenths[5] = “@SYS26646”;

tenths[6] = “@SYS26647”;

tenths[7] = “@SYS26648”;

tenths[8] = “@SYS26649”;

tenths[9] = “@SYS26650”;

hundreds = “hundreds”;

thousands = “thousands”;

Lakhs = “lakhs”;

crores = “crores”;

arabs = “arabs”;

test = checkPower(test, 10000000000);

test = checkPower(test, 100000000);

test = checkPower(test, 1000000);

test = checkPower(test, 1000);

test = checkPower(test, 100);

if (test >= 20)

{

testLoc = real2double(test);

numOfTenths = testLoc div 10;

returntxt = returntxt + ’ and ’ + tenths[numofTenths]; //

numOfTenths = numOfTenths mod 10;

test = real2int(test) mod 10;

}

/*

//aniCode

if (test >= 20)

{

testLoc = real2double(test);

numOfTenths = testLoc div 10;

if (returntxt != ‘’)

{

returntxt = returntxt + ’ and ’ + tenths[numofTenths]; //

}

else

{

returntxt = tenths[numofTenths]; //

}

numOfTenths = numOfTenths mod 10;

test = real2int(test) mod 10;

}

//EndAniCode

*/

if (test >= 1)

{

numOfTenths = real2int(test);

returntxt = returntxt + ’ ’ + ones[numOfTenths];

}

if (numOfPennies)

{

// returntxt = ‘***’ + returntxt + ’ ’ + “@SYS5534” + ’ ’ + num2str(numOfPennies,0,0,0,0) + ‘/100’;

returntxt = returntxt + ’ ’ + “@SYS5534” + ’ ’ ;

if(numOfPennies>=20)

{

numOfTenths=numOfPennies div 10;

numOfPennies = numOfPennies mod 10;

returntxt = returntxt + ’ ’ + tenths[numofTenths];

}

if (numOfPennies >= 1)

{

numOfTenths = real2int(numOfPennies);

returntxt = returntxt + ’ ’ + ones[numOfTenths];

}

returntxt = returntxt + ’ Paise Only’;

}

else

{

returntxt = returntxt + ’ Only’ ; //

}

return returntxt;

}

The standard cheque report on AP >> Payment Journals prints the numbers/amount to text on cheque printing report. You can have a look at that and copy the logic rather than rewriting.

Hope this helps.

all reports are in other formats not in indian format.

i want to print it in indian currency format.

in global method i made changes in "numeral to txt " method.

now u check ti in job it is working fine … but didnt giving me correct indian currency format