Automatically Change Posting Dates in General Ledger Setup

gadzilla1
Member Posts: 316
Hello all,
I was wondering if it was possible to change the field values of Allow Posting From and Allow Posting To to the date of the following business day automatically at 11pm every evening.
Currently we are manually changing this date in those fields every evening in the General Ledger Setup form.
If anyone has any ideas they would be greatly appreciated.
Thank you and have a great day. gad1
I was wondering if it was possible to change the field values of Allow Posting From and Allow Posting To to the date of the following business day automatically at 11pm every evening.
Currently we are manually changing this date in those fields every evening in the General Ledger Setup form.
If anyone has any ideas they would be greatly appreciated.
Thank you and have a great day. gad1
0
Comments
-
FYI
we change our date range monthly ie.7/1/2008 to 7/31/2008
you run a tight ship over there.
The simple code of
if "Posting Date" <> WORKDATE then "Posting Date" := Workdate;
on most of our posting fields. We have noticed a dramatic descrease (if any) posting date errors.0 -
Thanks Harry!
One clarification please...where do I insert that line of code. I'm looking forward to putting this in place and testing.
Have a great day - gad10 -
gadzilla1 wrote:Hello all,
I was wondering if it was possible to change the field values of Allow Posting From and Allow Posting To to the date of the following business day automatically at 11pm every evening.
Currently we are manually changing this date in those fields every evening in the General Ledger Setup form.
If anyone has any ideas they would be greatly appreciated.
Thank you and have a great day. gad1
You can setup the job scheduler to do so.Confessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book0 -
check this
http://www.mibuso.com/forum/viewtopic.php?t=25021
post 6 - add code to CU1
post 12 - add code to form
Post 13 - create a report & use job scheduler0 -
Thanks for the reply Alex. We will be purchasing job scheduler sometime in the future...is that what you are referring to?
For the short term I'd like to implement Harry's suggestion in test. Do you happen to know the optimal location to place the code?
Thanks! gad10 -
where do you want it to happen? everywhere? or specific forms like sales & purchase orders? Journals? Did you see the link listed above?0
-
Thanks for the reply Harry. I did nor see your reference to the link http://www.mibuso.com/forum/viewtopic.php?t=25021
prior to sending my last post.
I'd like to change those dates only from the General Ledger Setup form because that's where it's being manually changed now.0 -
well if you add code to CU1 it will be based on whomever logs in last, I would say a specific user but what if that user doesn't come in that day?
so...
Say someone changed there computer date to 3/12/2005 and they are the last one to log in then the date will be changed to that!
I like having a month range and having the field update when I enter the form. This way it's user specific.
If you wanted to go the CU1 route you could
first add a field to GlSetup table called Auto Update Posting Range.
Add it to the gl setup form. CHeck it! you can uncheck it to TURN IT OFF!
Then Add to LogInStart() around the lines
LogInDate := TODAY;
LogInTime := TIME;//Mod Start IF (GLSetup."Auto Update Posting Range") AND (GLSetup."Allow Posting From" <> TODAY) AND (GLSetup."Allow Posting To" <> TODAY) THEN BEGIN GLSetup."Allow Posting From" := TODAY; GLSetup."Allow Posting To" := TODAY; GLSetup.MODIFY; END; //mod end
**Caveat emptor!!** - Greg Brady0 -
you can use the Sheduler and NAS for automatic jobs. Search the forum for this or / and read the manuals
RegardsDo you make it right, it works too!0 -
gadzilla1 wrote:We will be purchasing job scheduler sometime in the future0
-
Thanks Harry - I will try your code example. Much appreciated!0
-
//Mod Start
IF (GLSetup."Allow Posting From" <> TODAY) AND
(GLSetup."Allow Posting To" <> TODAY)
THEN BEGIN
GLSetup."Allow Posting From" := TODAY;
GLSetup."Allow Posting To" := TODAY;
GLSetup.MODIFY;
END;
//mod end
If I use this code (so without creating and using the extra field in the GLSetup table) in a report, I loose all other settings in the GL Setup table exept the "Allow posting From" and "Allow posting To" values.
Does anyone have an idea why?Marion van der Valk0 -
did you GET the GLSetup table first?Confessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book0 -
No, I did not. I used only the code as suggested.
Should this make the difference?Marion van der Valk0 -
mvdvalk wrote:No, I did not. I used only the code as suggested.
Should this make the difference?
Yes it will. Since GLSetup is blank.Confessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book0 -
that sample code is just a addition to a section that has other coding already there in a CODEUNIT. I assume your REPORT does not have all that coding. The standard codeunit already calls upon the setup table that's why it hasn't been added again.
anyway try this.
add a variable to your report called GLSetup
type= Record
Subtype= General Ledger Setup
add a GLSETUP.GET; to the beginning of the code.0 -
Cool... Thanks for spelling it out Harry. Just assumed he knew...Confessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book0 -
No, I did not know (I am a she by the way).
Thanks, it works perfectly know.Marion van der Valk0 -
Thanks to everyone for the valuable assistance and dialogue.
Unless there are any objections I'll put 'SOLVED' in the title.
Have a great day - Chris
Ps. We're getting Job Scheduler after all!0 -
gadzilla1 wrote:Thanks to everyone for the valuable assistance and dialogue.
Unless there are any objections I'll put 'SOLVED' in the title.
Have a great day - Chris
Ps. We're getting Job Scheduler after all!
Altough It has been solved by recommendations here, I would like to tell a different approach.
Add two fields in User setup table:Allow Posting From Formula,Allow Posting To Formula.
Add this function In User Setup table.CalculateAllowedPostingDate() // 6GENCore1.0 Ayhan Özbay 03.03.2008 Task:80300 IF FORMAT("Allow Posting From Formula") <> '' THEN BEGIN "Allow Posting From" := CALCDATE("Allow Posting From Formula",TODAY); "Allow FA Posting From" := CALCDATE("Allow Posting From Formula",TODAY); END; IF FORMAT("Allow Posting To Formula") <> '' THEN BEGIN "Allow Posting To" := CALCDATE("Allow Posting To Formula",TODAY); "Allow FA Posting To" := CALCDATE("Allow Posting To Formula",TODAY); END;
Change codeunits (which check allowed posting dates). here are two example:
cu 11 Gen. Jnl.-Check Line :DateNotAllowed(PostingDate : Date) : Boolean IF (AllowPostingFrom = 0D) AND (AllowPostingTo = 0D) THEN BEGIN IF USERID <> '' THEN IF UserSetup.GET(USERID) THEN BEGIN // 6GENCore1.0 Ayhan Özbay 03.03.2008 Task:80300 UserSetup.CalculateAllowedPostingDate; AllowPostingFrom := UserSetup."Allow Posting From"; AllowPostingTo := UserSetup."Allow Posting To"; END; IF (AllowPostingFrom = 0D) AND (AllowPostingTo = 0D) THEN BEGIN GLSetup.GET; AllowPostingFrom := GLSetup."Allow Posting From"; AllowPostingTo := GLSetup."Allow Posting To"; END; IF AllowPostingTo = 0D THEN AllowPostingTo := 31129999D; END;
cu 21 Item Jnl.-Check Line:IF (AllowPostingFrom = 0D) AND (AllowPostingTo = 0D) THEN BEGIN InvtSetup.GET; GLSetup.GET; IF USERID <> '' THEN IF UserSetup.GET(USERID) THEN BEGIN // 6GENCore1.0 Ayhan Özbay 03.03.2008 Task:80300 UserSetup.CalculateAllowedPostingDate; AllowPostingFrom := UserSetup."Allow Posting From"; AllowPostingTo := UserSetup."Allow Posting To"; END; IF (AllowPostingFrom = 0D) AND (AllowPostingTo = 0D) THEN BEGIN AllowPostingFrom := GLSetup."Allow Posting From"; AllowPostingTo := GLSetup."Allow Posting To"; END; IF AllowPostingTo = 0D THEN AllowPostingTo := 31129999D; END;
in this way, you needn't job scheduler etc. Allowed posting dates are calculated on the fly by user based calculation formula..
hope this helps.0 -
In the line of the same question here, has anyone noticed that
Even if we have allowed posting range set in user setup table and current posting date is well within that range, NAV sometime doesn't allow it to post. I have seen this in some occasions where the NAV try to go back and forth in transaction table and tries to adjust the remaining quantities of lines with date beyond the filter set (a erroneous date of invoice in a future date).
I will try to simulate one and try my best post the scenario here soon."A bove maiore discit arare minor"-"From the old ox, the young one learns to plow."0 -
not that you asked, but just a word of warning the user setup table takes priority over the glsetup posting to and from dates. So when I need to accomplish the same thing I did it on the user table, that way you know you only have to do it once. I used the job schedular and a non-printing report to accomplish it.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions