Hello experts!
I have a question about an error that I get often about the posting date; NAV 2009 SP1, spanish date format dd/mm/yy
Allow posting from: 01/05/16
Allow ponting to: 30/06/16
Purchase Invoice, posting date 09/05/16
that invoice is impossible to post because of this error
Codeunti 21
CheckAllowedPostingDate(ItemJnlLine : Record "Item Journal Line")
WITH ItemJnlLine DO BEGIN
:
:
IF ("Posting Date" < AllowPostingFrom) OR ("Posting Date" > AllowPostingTo) THEN
Break on error FIELDERROR("Posting Date"
END;
I think it's a failure of NAV and I need to solve
thank you for your help!
Answers
You mean to say even if you have the Posting Date in the defined range you are getting this error as 'Posting date is not in the defined range'. The Only issue for this may be the Date format I believe.
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/
but in other documents with the same date no problem, it is only in the purchase invoices
IF ("Posting Date" < AllowPostingFrom) OR ("Posting Date" > AllowPostingTo) THEN
FIELDERROR("Posting Date",Text001)
for this other
dia := DATE2DMY("Posting Date",1);
mes := DATE2DMY("Posting Date",2);
anio := DATE2DMY("Posting Date",3);
diafrom:=DATE2DMY(AllowPostingFrom,1);
mesfrom:= DATE2DMY(AllowPostingFrom,2);
aniofrom:= DATE2DMY(AllowPostingFrom,3);
diato:=DATE2DMY(AllowPostingTo,1);
mesto:= DATE2DMY(AllowPostingTo,2);
anioto:= DATE2DMY(AllowPostingTo,3);
IF ((dia<diafrom) AND (mes<mesfrom) AND (anio<aniofrom)) OR ((dia>diato) AND (mes>mesto) AND (anio>anioto)) THEN
FIELDERROR("Posting Date",Text001);
and it works without problem the codeunit 21, but returns this error in the codeunit 11
RunCheck(GenJnlLine,JnlLineDim)
WITH GenJnlLine DO BEGIN
:
:
IF DateNotAllowed("Posting Date") THEN
break in error FIELDERROR("Posting Date",Text001);
Don't think it is a bug in NAV.
I see 2 options (but I don't know everything):
1) When I look at the code in NAV2009 CU21, I see it, looking up UserSetup and GLSetup.
Where UserSetup is leading if it has data. How is your UserSetup ?
2) A user is working in NAV on a computer with wrong country (date) settings.
Good luck.
the User Setup and GLSetup have identical dates,
and that user can also post other documents with that date without problem.
I'll do the same with the CU11
You are in danger here!
is not the same as
diafrom = 1 (01/05/2016) then
for example: (dia<diafrom) is for you (day < 1) and that will never happen...
I know what happens, there is a posted invoice dated 30/12/2016 (Spanish format) and when you try to register the new invoice, at some point (although "date order" is off for that series), checks that the date "Allow Ponting to " in user setup table is the 30/12/2016 and if not given the error.
So finally I have not changed anything in the code, just when invoices are posted with that series is changed in the table "user setup" field value "Allow Posting to" register to 30/12/2016 and leaves without problem.
Thanks everyone for your help.