vinayak.v 0 Light Poster

hi... everybody...

i've designed one crystal report to display the total number in indian
currency format which works good...
following is my code.

numbervar RmVal:=0; 
numbervar Amt:=0; 
numbervar pAmt:=0; 
stringvar InWords :=" ";
numbervar totalAmt;
totalAmt:=Sum ({employee.salary});
Amt := totalAmt;


if Amt > 10000000 then RmVal := truncate(Amt/10000000); 
if Amt = 10000000 then RmVal := 1;

   if RmVal = 1 then 
        InWords := InWords + " " + towords(RmVal,0) + " crore" 
   else 
        if RmVal > 1 then InWords := InWords + " " + towords(RmVal,0) + " crores";


    Amt := Amt - Rmval * 10000000;



    if Amt > 100000 then RmVal := truncate(Amt/100000); 
    if Amt <= 100000 then RmVal := 1;
    

    if RmVal = 1 then 
        InWords := InWords + " " + towords(RmVal,0) + " lakh"
    Else
        If RmVal > 1 then InWords := InWords + " " + ToWords(RmVal,0) + " Lakhs";
 


        Amt := Amt - Rmval * 100000;
 

 



if Amt > 1000 then RmVal := truncate(Amt/1000);
if Amt = 1000 then Rmval := 1;

if RmVal =1 then 
Inwords := InWords + " " + towords(RmVal,0) + "Thousand"
Else
if RmVal > 1 then InWords := InWords + " " + towords(RmVal,0) + "thousand ";
Amt := Amt - RmVal * 1000;
        



if Amt > 0 then InWords := InWords + "  " + towords(truncate(Amt),0);

        pAmt := (Amt - truncate(Amt)) * 100;

        if pAmt > 0 then 
            InWords := InWords + " and " + towords(pAmt,0) + " paisa only" 
        else 
            InWords :=InWords + " rupees only";

        UPPERCASE(InWords)

if i give 2,13,45,000 display in words as (TWO CRORES THIRTEEN LAKHS FORTY-FIVETHOUSAND RUPEES ONLY ) which is correct...

but when i give 2,00,45,000 it will display wrong value
i.e(TWO CRORES ONE LAKH ONETHOUSAND RUPEES ONLY )

i want here to be printed as (TWO CRORES FORTY-FIVE THOUSAND RUPEES ONLY ) which i want...


please help me...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.