Vendor Invoice Number problem

mkpjsrmkpjsr Member Posts: 587
hi experts,

In our case "vendor Invoice No." is mandatory in order to post purchase invoice. Now the problem is, suppose a vendor supplied me an item having invoice number 100 in the financial year 2009-2010 and the same vendor is going to supply me some item having invoice number 100 in the financial year 2010-2011.

If i am entering this into the purchase invoice, its giving an error that the invoice no is duplicate.
how can we resolve this issue. Because as the financial year ends all the vendors start sending their items with the same invoice numbers, i.e

2009-2010---> Invoice No range : 1--1000
2010-2011---> Invoice No range : 1--1000

can anybody guide me.

Comments

  • vijay_gvijay_g Member Posts: 884
    As far i know in this case you have to customize the code which has been checking the duplicate invoice no. has written in PostVend() function in CU12. you need to add code(add a filter for posting date) for current finiancial year.
  • AndwianAndwian Member Posts: 627
    Just add the year prefix for your internal use. So:
    2009-2010---> Invoice No range : 10/1--10/1000
    2010-2011---> Invoice No range : 11/1--11/1000
    Regards,
    Andwian
  • mkpjsrmkpjsr Member Posts: 587
    Andwian wrote:
    Just add the year prefix for your internal use. So:
    2009-2010---> Invoice No range : 10/1--10/1000
    2010-2011---> Invoice No range : 11/1--11/1000


    That is ok, but this functionality should be there within navision. It should have a check of Invoice No and Posting Date and if posting date is different then it should allow users from doing the entry.
  • mkpjsrmkpjsr Member Posts: 587
    vijay_g wrote:
    As far i know in this case you have to customize the code which has been checking the duplicate invoice no. has written in PostVend() function in CU12. you need to add code(add a filter for posting date) for current finiancial year.

    that means we need to do this type of customization for all similar issues.
  • mkpjsrmkpjsr Member Posts: 587
    vijay_g wrote:
    As far i know in this case you have to customize the code which has been checking the duplicate invoice no. has written in PostVend() function in CU12. you need to add code(add a filter for posting date) for current finiancial year.

    Hi Thanx for the reply,

    i found the following code under CU12:
          IF PurchSetup."Ext. Doc. No. Mandatory" OR
             (CVLedgEntryBuf."External Document No." <> '')
          THEN BEGIN
            // Test vendor number
            TESTFIELD("External Document No.");
            OldVendLedgEntry.RESET;
            IF NOT RECORDLEVELLOCKING THEN
              OldVendLedgEntry.SETCURRENTKEY("External Document No.");
            OldVendLedgEntry.SETRANGE("External Document No.",CVLedgEntryBuf."External Document No.");
            OldVendLedgEntry.SETRANGE("Document Type",CVLedgEntryBuf."Document Type");
            OldVendLedgEntry.SETRANGE("Vendor No.",CVLedgEntryBuf."CV No.");
            IF NOT OldVendLedgEntry.ISEMPTY THEN
              ERROR(
                Text003,
                CVLedgEntryBuf."Document Type",CVLedgEntryBuf."External Document No.");
          END;
    

    Now, where should i put the filter for Posting Date,,,
  • vijay_gvijay_g Member Posts: 884
    mkpjsr wrote:
    that means we need to do this type of customization for all similar issues.

    you should have think about such kind of issue before locking your problem on this forum as you know very well it's not in standard(even similer issue has disscussed much more time here).
    you must have know about as Andwian has suggested or you know we should always avoid to any type of customization until or unless you have alternative way to do this.
  • SavatageSavatage Member Posts: 7,142
    That is ok, but this functionality should be there within navision. It should have a check of Invoice No and Posting Date and if posting date is different then it should allow users from doing the entry.
    Because as the financial year ends all the vendors start sending their items with the same invoice numbers

    Personally I don't think any vendor should do this. And since it's not a standard practice there is no default nav functionality other that simply adding the year to the beginning of the Invoice #.

    2009-abc123
    2010-abc123
    2011-abc123

    to give you the same invoice number regardless that it's a new year makes no sence to me.
    It's easier to just keep going with the numbers 1..999999999.
    Why Invoice numbers need to be descriptive in that way is a waste of time IMHO :?
  • rsaritzkyrsaritzky Member Posts: 469
    mkpjsr wrote:
    Now, where should i put the filter for Posting Date,,,

    This particular customization is a little tricky, because the check for External Document No. happens both in Codeunit 90 and Codeunit 12 in 2 different "phases" of the posting process.

    You might want to consider a "hybrid" of other suggestions, which have been to manually enter some sort of prefix to make the invoice number unique. What you might consider is customizing that part, i.e. add a "year" prefix to the External Document No. field, so if the user enters 12345 into the field, it ends up as 2011-12345.

    Here's an example of the kind of code you could use which is only a couple of lines of code. Put this in the ONVALIDATE trigger of the "Vendor Invoice No." field in the Purchase Header table:
    IF xRec."Vendor Invoice No." = '' THEN
      "Vendor Invoice No." := COPYSTR(FORMAT(DATE2DMY(TODAY,3)) + '-' + "Vendor Invoice No.", 1, 20);
    

    The "IF xRec..." part of the code avoids duplicate prefixing if you EDIT the Vendor invoice no. The COPYSTR command makes sure the resulting string isn't longer than what the field allows.

    It's not perfect - you have to consider all the options. If your External document no.'s are never longer than 15, then you're OK as is. Otherwise, it will truncate the last digit. You could use alternative versions of the code to trim the front rather than the back of the number, or just use 2 digits for the year, or ????

    Hope this gives you some ideas
    Ron
  • mkpjsrmkpjsr Member Posts: 587
    Savatage wrote:

    Personally I don't think any vendor should do this. And since it's not a standard practice there is no default nav functionality other that simply adding the year to the beginning of the Invoice #.

    2009-abc123
    2010-abc123
    2011-abc123

    to give you the same invoice number regardless that it's a new year makes no sence to me.
    It's easier to just keep going with the numbers 1..999999999.
    Why Invoice numbers need to be descriptive in that way is a waste of time IMHO :?

    In India, I think 90 out of 100 vendors are doing this..
  • raveendran.sraveendran.s Member Posts: 119
    mkpjsr wrote:
    Savatage wrote:

    In India, I think 90 out of 100 vendors are doing this..

    Please don't give any generic statements like this. India there are lot of companies using ERP. Whomsover is still using the old accounting s/w or manual billing is having this issue.
    --
    Regards,
    Raveendran.BS
Sign In or Register to comment.