Results 1 to 3 of 3

Thread: Problem with ToWords function

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    India
    Posts
    342

    Problem with ToWords function

    I using this piece of code in a formula field for diplaying the amount in words (In indian Currency).. its giving "Rupees One Crore one lakh negative fifty-three thousand six hundred fourty-four only" .. can anyone tell me y it is showing 'Negative' while using toWords??

    (NOTE : In Indian Currency 10 Lakhs = 1 Million
    and 10 Million = 1 Crore)


    //--------------------------------------------------------------------------
    whileprintingrecords;
    numbervar RmVal:=0;
    numbervar Amt:=0;
    numbervar pAmt:=0;
    stringvar InWords :="Rupees ";
    Amt := 10046356; //{V_CARGO_BILL.TOTAL_AMT};
    if Amt > 10000000 then
    RmVal := truncate(Amt/10000000);
    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 RmVal = 1 then
    InWords := InWords + " " + towords(RmVal,0) + " lakh"
    else if RmVal > 1 then
    InWords := InWords + " " + towords(RmVal,0) + " lakhs";
    Amt := Amt - Rmval * 100000;
    InWords := InWords + " " + towords(truncate(Amt),0);
    pAmt := (Amt - truncate(Amt)) * 100;
    if pAmt > 0 then
    InWords := InWords + " " + towords(pAmt,0) + " paisa only"
    else
    InWords := InWords + " only";
    InWords
    //---------------------------------------------------------------------------
    ksm

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    India
    Posts
    342
    Had anyone tried this formula?? .. any ideas plz
    ksm

  3. #3
    New Member
    Join Date
    Apr 2008
    Posts
    1

    Re: Problem with ToWords function

    whileprintingrecords;
    numbervar RmVal:=0;
    numbervar Amt:=0;
    numbervar pAmt:=0;
    stringvar InWords :="Rupees ";
    Amt := Sum ({ERP_ENQUIRY_PRODUCT.dPrice}, {ERP_QUOTATION.nQuotationID}); //10046356;

    if Amt >= 10000000 then RmVal := truncate(Amt/10000000);
    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;
    RmVal:=0;

    if Amt >= 100000 then RmVal := truncate(Amt/100000);
    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 truncate(Amt,0) > 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 + " only";

    InWords

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width