Dynamics Nav 2013-Check printing - Amounts in Words -Rep1401

gda75gda75 Member Posts: 11
edited 2013-10-30 in NAV Three Tier
Hi All

We are presently using the standard report 1401 which convert amounts into words for check printing. However, we are facing 2 issues which were raised by the client:-

1) When converting the amounts/figures into words. The standard parameters (1401) is not writing the wordings correctly i.e USD 377,758.62 is converted to THREE HUNDRED SEVENTY SEVEN THOUSAND SEVEN HUNDRED FIFTY EIGHT AND 62/100

when it should read:

THREE HUNDRED AND SEVENTY SEVEN THOUSAND, SEVEN HUNDRED AND FIFTY EIGHT AND SIXTY TWO CENTS
Presently on the code 1401, the word 'AND' only appears at the end before printing out the cents. Any idea how to solve this issue?


2) The amounts in words are printed on a pre-printed cheque with 2 lines on the cheque. Line one can write approx. 60 letters and the 2nd line 80 letters. How do you break the wording automatically on the 2nd line without splitting a word. e.g
Wrong
Line 1
THREE HUNDRED AND SEVENTY SEVEN THOUSAND,SEVEN HUN
on line 2
DRED AND FIFTY EIGHT AND SIXTY TWO CENTS

Right:

On line 1
THREE HUNDRED AND SEVENTY SEVEN THOUSAND, SEVEN
On line 2
HUNDRED AND FIFTY EIGHT AND SIXTY TWO CENTS

Pls advise.

Comments

  • ara3nara3n Member Posts: 9,256
    please report it to MS.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • aseigleaseigle Member Posts: 207
    gda75 wrote:
    1) When converting the amounts/figures into words. The standard parameters (1401) is not writing the wordings correctly i.e USD 377,758.62 is converted to THREE HUNDRED SEVENTY SEVEN THOUSAND SEVEN HUNDRED FIFTY EIGHT AND 62/100

    when it should read:

    THREE HUNDRED AND SEVENTY SEVEN THOUSAND, SEVEN HUNDRED AND FIFTY EIGHT AND SIXTY TWO CENTS
    Presently on the code 1401, the word 'AND' only appears at the end before printing out the cents. Any idea how to solve this issue?

    I disagree with you. I believe it is written correctly. If I were to handwrite a check for that amount (which I certainly wish I could)
    It would read: Three hundred seventy seven thousand seven hundred fifty eight dollars and 62/100

    the word thousand means anything to the left is grouped together, until you get to millions or billions.
  • mansoormansoor Member Posts: 7
    Hi
    in your first Question ,
    input = 12345.67
    output = " TWELVE THOUSAND THREE HUNDRED AND FORTY FIVE AND CENTS SIXTY SEVEN "

    find attached code unit , you can user FormatNoText() function

    ex: FormatNoText(OutText,12345.67,'USD');

    u5r5qvyhmpbf.jpg
    Reg,
    Mansoor
  • mansoormansoor Member Posts: 7
    i cannot attache fob or txt file , find object text format.

    ===================code start ====================
    OBJECT Codeunit 50099 Amount to Word
    {
    OBJECT-PROPERTIES
    {
    Date=04/12/15;
    Time=10:08:27;
    Modified=Yes;
    Version List=TA;
    }
    PROPERTIES
    {
    OnRun=BEGIN
    FormatNoText(OutText,12345.67,'USD');
    MESSAGE(OutText[1]+OutText[2]+OutText[3]);
    END;

    }
    CODE
    {
    VAR
    OnesText@1000000038 : ARRAY [20] OF Text[30];
    TensText@1000000037 : ARRAY [20] OF Text[30];
    ExponentText@1000000036 : ARRAY [5] OF Text[30];
    Text000@1000000042 : TextConst 'ENU=Document No cannot be Blank';
    Text070@1000000035 : TextConst 'ENU=ZERO';
    Text071@1000000034 : TextConst 'ENU=HUNDRED';
    Text072@1000000033 : TextConst 'ENU=AND';
    Text073@1000000032 : TextConst 'ENU=%1 results in a written number that is too long.';
    Text074@1000000031 : TextConst 'ENU=ONE';
    Text075@1000000030 : TextConst 'ENU=TWO';
    Text076@1000000029 : TextConst 'ENU=THREE';
    Text077@1000000028 : TextConst 'ENU=FOUR';
    Text078@1000000027 : TextConst 'ENU=FIVE';
    Text079@1000000026 : TextConst 'ENU=SIX';
    Text080@1000000025 : TextConst 'ENU=SEVEN';
    Text081@1000000024 : TextConst 'ENU=EIGHT';
    Text082@1000000023 : TextConst 'ENU=NINE';
    Text083@1000000022 : TextConst 'ENU=TEN';
    Text084@1000000021 : TextConst 'ENU=ELEVEN';
    Text085@1000000020 : TextConst 'ENU=TWELVE';
    Text086@1000000019 : TextConst 'ENU=THIRTEEN';
    Text087@1000000018 : TextConst 'ENU=FOURTEEN';
    Text088@1000000017 : TextConst 'ENU=FIFTEEN';
    Text089@1000000016 : TextConst 'ENU=SIXTEEN';
    Text090@1000000015 : TextConst 'ENU=SEVENTEEN';
    Text091@1000000014 : TextConst 'ENU=EIGHTEEN';
    Text092@1000000013 : TextConst 'ENU=NINETEEN';
    Text093@1000000012 : TextConst 'ENU=TWENTY';
    Text094@1000000011 : TextConst 'ENU=THIRTY';
    Text095@1000000010 : TextConst 'ENU=FORTY';
    Text096@1000000009 : TextConst 'ENU=FIFTY';
    Text097@1000000008 : TextConst 'ENU=SIXTY';
    Text098@1000000007 : TextConst 'ENU=SEVENTY';
    Text099@1000000006 : TextConst 'ENU=EIGHTY';
    Text100@1000000005 : TextConst 'ENU=NINETY';
    Text101@1000000004 : TextConst 'ENU=THOUSAND';
    Text102@1000000003 : TextConst 'ENU=MILLION';
    Text103@1000000002 : TextConst 'ENU=BILLION';
    Text104@1000000001 : TextConst 'ENU=ONLY';
    OutText@1000000000 : ARRAY [3] OF Text[30];

    PROCEDURE GetInventroy@1000000001(pLoc@1000000000 : Code[20];pItem@1000000001 : Code[20]) ILEQty : Decimal;
    VAR
    ILE@1000000002 : Record 32;
    BEGIN
    ILE.RESET;
    ILE.SETCURRENTKEY("Item No.","Entry Type","Variant Code","Drop Shipment","Location Code","Posting Date");
    ILE.SETRANGE("Location Code",pLoc);
    ILE.SETRANGE("Item No.",pItem);
    ILE.CALCSUMS(Quantity);
    ILEQty := ILE.Quantity;
    END;

    PROCEDURE FormatNoText@1000000000(VAR NoText@1000000002 : ARRAY [3] OF Text[60];No@1000000001 : Decimal;CurrencyCode@1000000000 : Code[10]);
    VAR
    PrintExponent@1000000009 : Boolean;
    Ones@1000000008 : Integer;
    Tens@1000000007 : Integer;
    Hundreds@1000000006 : Integer;
    Exponent@1000000005 : Integer;
    NoTextIndex@1000000004 : Integer;
    Cents@1000000003 : Integer;
    BEGIN
    InitTextVariable;
    CLEAR(NoText);
    NoTextIndex := 1;
    NoText[1] := '';

    IF No < 1 THEN
    AddToNoText(NoText,NoTextIndex,PrintExponent,Text070)
    ELSE BEGIN
    FOR Exponent := 4 DOWNTO 1 DO BEGIN
    PrintExponent := FALSE;
    Ones := No DIV POWER(1000,Exponent - 1);
    Hundreds := Ones DIV 100;
    Tens := (Ones MOD 100) DIV 10;
    Ones := Ones MOD 10;
    IF Hundreds > 0 THEN BEGIN
    AddToNoText(NoText,NoTextIndex,PrintExponent,OnesText[Hundreds]);
    AddToNoText(NoText,NoTextIndex,PrintExponent,Text071);
    IF (Tens > 0) OR (Ones > 0) THEN
    AddToNoText(NoText,NoTextIndex,PrintExponent,Text072);
    END;
    IF Tens >= 2 THEN BEGIN
    AddToNoText(NoText,NoTextIndex,PrintExponent,TensText[Tens]);
    IF Ones > 0 THEN
    AddToNoText(NoText,NoTextIndex,PrintExponent,OnesText[Ones]);
    END ELSE
    IF (Tens * 10 + Ones) > 0 THEN
    AddToNoText(NoText,NoTextIndex,PrintExponent,OnesText[Tens * 10 + Ones]);
    IF PrintExponent AND (Exponent > 1) THEN
    AddToNoText(NoText,NoTextIndex,PrintExponent,ExponentText[Exponent]);
    No := No - (Hundreds * 100 + Tens * 10 + Ones) * POWER(1000,Exponent - 1);
    END;
    Cents := No * 100;
    END;
    //PWCLK3.70 - Start
    IF Cents = 0 THEN
    AddToNoText(NoText,NoTextIndex,PrintExponent,'')
    ELSE IF Cents<=20 THEN
    AddToNoText(NoText,NoTextIndex,PrintExponent,'AND CENTS '+ OnesText[Cents]+ '')
    ELSE
    BEGIN
    AddToNoText(NoText,NoTextIndex,PrintExponent,Text072 + ' CENTS ');
    AddToNoText(NoText,NoTextIndex,PrintExponent,TensText[(Cents MOD 100) DIV 10]);
    IF Cents MOD 10 <> 0 THEN
    AddToNoText(NoText,NoTextIndex,PrintExponent,OnesText[Cents MOD 10]+ '')
    ELSE AddToNoText(NoText,NoTextIndex,PrintExponent,'');
    END;
    END;

    PROCEDURE AddToNoText@1000000002(VAR NoText@1000000003 : ARRAY [3] OF Text[60];VAR NoTextIndex@1000000002 : Integer;VAR PrintExponent@1000000001 : Boolean;AddText@1000000000 : Text[30]);
    BEGIN
    PrintExponent := TRUE;

    WHILE STRLEN(NoText[NoTextIndex] + ' ' + AddText) > MAXSTRLEN(NoText[1]) DO BEGIN
    NoTextIndex := NoTextIndex + 1;
    IF NoTextIndex > ARRAYLEN(NoText) THEN
    ERROR(Text073,AddText);
    END;

    NoText[NoTextIndex] := DELCHR(NoText[NoTextIndex] + ' ' + AddText,'<');
    END;

    PROCEDURE InitTextVariable@1000000003();
    BEGIN
    OnesText[1] := Text074;
    OnesText[2] := Text075;
    OnesText[3] := Text076;
    OnesText[4] := Text077;
    OnesText[5] := Text078;
    OnesText[6] := Text079;
    OnesText[7] := Text080;
    OnesText[8] := Text081;
    OnesText[9] := Text082;
    OnesText[10] := Text083;
    OnesText[11] := Text084;
    OnesText[12] := Text085;
    OnesText[13] := Text086;
    OnesText[14] := Text087;
    OnesText[15] := Text088;
    OnesText[16] := Text089;
    OnesText[17] := Text090;
    OnesText[18] := Text091;
    OnesText[19] := Text092;

    TensText[1] := '';
    TensText[2] := Text093;
    TensText[3] := Text094;
    TensText[4] := Text095;
    TensText[5] := Text096;
    TensText[6] := Text097;
    TensText[7] := Text098;
    TensText[8] := Text099;
    TensText[9] := Text100;

    ExponentText[1] := '';
    ExponentText[2] := Text101;
    ExponentText[3] := Text102;
    ExponentText[4] := Text103;
    END;

    BEGIN
    {
    Mansoor - FormatNoText 01122015 - to Generate Amount to Word
    Mansoor -AddToNoText 01122015 - to Generate Amount to Word
    Mansoor -InitTextVariable 01122015 - to Generate Amount to Word
    }
    END.
    }
    }






    Reg,
    Mansoor
Sign In or Register to comment.