Options

Invoice number already exists.

JTProJTPro Member Posts: 169
Hello All,

I'm facing such a problem: When I want to insert new invoice, system is showing the error, that this number already exists. Of course it is not true.
I searched entire forum, and found nothing. I tried to increase the last used number in series no., but didn't help.

What can be wrong?

I need your help.

Best regards.
JTPro
Navision Application Version: 4.0SP1
Navision Database Version: 4.0

Comments

  • markborgesmarkborges Member Posts: 170
    JTPro,

    - Aren't you using the same Post Series No. for different document types?
    - Are you using some kind multiple-times payment?

    I had this problem when we developed the mulitple-times payment. Once again, I had this problem when somebody changed the Post Series No. on the invoice to the same number as the Invoice No.

    Check these out, this might help you!

    :wink:
    Marcelo Borges
    D365 Business Central Solutions Architect
    BC AL/NAV C/AL Developer
    BC Repositories.com
  • ara3nara3n Member Posts: 9,258
    turn on the debugger and put the code in here where it stops. My guess you have some kind of modification.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • JTProJTPro Member Posts: 169
    Hello,

    Thank you for your posts.

    ara3n:

    Debugger says nothing. I already tried it. Even if you put data directly to the table, the error message shows up. It drives me crazy ](*,) .

    I will check what markborges suggested. I hope it will be it.

    Best regards
    JTPro
    Navision Application Version: 4.0SP1
    Navision Database Version: 4.0
  • JTProJTPro Member Posts: 169
    Hello,

    Markborges, I just realized that I developed such functionality, that takes the number from the Series No. of Invoice and put it into the Posting No. field on Invoice. This is some kind of buffor. If an accounter is sure, that the invoice is ok, then it post it and the number of posted invoice is the one from Posting No. field. This is really strange, because it had been working for a long time. Maybe I miss something :-k

    Any help is apretiate appreciate.

    Best regards
    JTPro
    Navision Application Version: 4.0SP1
    Navision Database Version: 4.0
  • David_CoxDavid_Cox Member Posts: 509
    Hi
    Any changes made to Codeunit 80?
    Is this when you try to post an Order into an Invoice?

    If so there is a field in the Sales Header table "Posting No.", this is populated sometimes in the Posting Codeunit, then if there was an error the header is updated but not posted, the next invoice takes the same number, then when you try to invoice the order you get this message, as codeunit 80, does not get the next number if the header is already marked with a Posting Number.

    I do remember this being a problem on a Modified database but not on a standard.

    There is this code which only gets a new number if "Posting No." is blank.
    A few lines later it does a commit, if an error occurs after the header has been updated, although the number series should have been updated before the Commit.
    IF Invoice AND ("Posting No." = '') THEN BEGIN
    IF ("No. Series" <> '') OR
    ("Document Type" IN ["Document Type"::Order,"Document Type"::"Return Order"])
    THEN
    TESTFIELD("Posting No. Series");
    IF ("No. Series" <> "Posting No. Series") OR
    ("Document Type" IN ["Document Type"::Order,"Document Type"::"Return Order"])
    THEN BEGIN
    "Posting No." := NoSeriesMgt.GetNextNo("Posting No. Series","Posting Date",TRUE);
    ModifyHeader := TRUE;
    END;
    END;

    So if there are modifications you need to clear the "Posting No." in codeunit 80 to stop this error.
    Analyst Developer with over 17 years Navision, Contract Status - Busy
    Mobile: +44(0)7854 842801
    Email: david.cox@adeptris.com
    Twitter: https://twitter.com/Adeptris
    Website: http://www.adeptris.com
  • JTProJTPro Member Posts: 169
    Hi,

    I didn't touch codeunit 80.
    I made modification on Invoice form, that allows user to choose the series no. for later posting.

    It looks like that:
    IF ("Posting No." = '') THEN
    BEGIN
      InvoicePostingNoSelection := STRMENU(Text55000,2);
      IF InvoicePostingNoSelection <> 0 THEN
        BEGIN
         InvoiceMessageText[1] := 'S+FA';
         InvoiceMessageText[2] := 'S+FAV';
    
         PostingNoSeries := InvoiceMessageText[InvoicePostingNoSelection];
        // MESSAGE('Posting No Series: %1',PostingNoSeries);
         Rec."Posting No." := NoSeriesMgt.GetNextNo(PostingNoSeries,"Posting Date",TRUE);
       //  MESSAGE('Posting No: %1', Rec."Posting No.");
         MODIFY;
        END;
    END;
    

    It had been working for a long time. ](*,)

    Why me? Why me? :)

    Thanks a lot for your answers.

    Best regards.
    JTPro[/quote]
    Navision Application Version: 4.0SP1
    Navision Database Version: 4.0
  • markborgesmarkborges Member Posts: 170
    JTPro,

    Check all you Numbering fields under Sales & Receivables Setup (Numbering Tab), specially the "Invoice Nos." and "Posted Invoice Nos.". Check if they're not the same!

    :wink:
    Marcelo Borges
    D365 Business Central Solutions Architect
    BC AL/NAV C/AL Developer
    BC Repositories.com
  • JTProJTPro Member Posts: 169
    Hi,

    Checked, and everything looks fine. There are different Nos. for each type of document.

    Still nothing.

    Best regards
    JTPro
    Navision Application Version: 4.0SP1
    Navision Database Version: 4.0
  • JTProJTPro Member Posts: 169
    Hello guys,


    I found something. I decided to look more deeply, so I made a backup of a database (SQL2000 one), and created native database. After I made a restore, I tried to make invoice, and everything works fine?

    SQL? Now, this is really strange.

    Any idea?

    Best regards
    JTPro
    Navision Application Version: 4.0SP1
    Navision Database Version: 4.0
  • JTProJTPro Member Posts: 169
    Hello all,

    The mystary has been solved. There was something wrong with my sql database (no idea what was it :-k ). I created a new database, and restore the old one. Now, everything seems to be ok.

    Thanks a lot for your time.

    Best regards.
    JTPro
    Navision Application Version: 4.0SP1
    Navision Database Version: 4.0
  • markborgesmarkborges Member Posts: 170
    Glad to Help, and like Kriki says:

    "Let [Solved] be in your title"

    :wink:
    Marcelo Borges
    D365 Business Central Solutions Architect
    BC AL/NAV C/AL Developer
    BC Repositories.com
Sign In or Register to comment.