Sales order logging incorrect dates  Topic is solved

Discussions relating to Jiwa 7 plugin development, and the Jiwa 7 API.

Re: Sales order logging incorrect dates

Postby perry » Fri Jan 22, 2016 11:25 am

Thanks Mike!
For now, I will use
Code: Select all
JiwaApplication.Manager.Instance.Database.SysDateTime  = Now

We always use System.Timers.Timer in our services, however, we use "timer.Enabled = False" to pause, not sure if that makes any difference.

Regarding calling events, I cant remember the reason why I'm manually calling those events (code was done back 7.0.4x), maybe it wasn't triggering my other business plugin code. Anyway, I will remove related codes.

Thanks again for your reply
Perry Ma
S. Programmer
Lonicera Pty Ltd
http://www.lonicera.com.au
perry
Frequent Contributor
Frequent Contributor
 
Posts: 173
Joined: Mon Oct 27, 2008 2:26 pm
Topics Solved: 15

Re: Sales order logging incorrect dates

Postby Mike.Sheen » Fri Jan 22, 2016 7:22 pm

Build 7.00.150.00 has addressed this issue now.

I removed the timers from JiwaApplication.Manager and JiwaODBC.database which were responsible for managing the SysDateTime and ServerDateTime, so this should eliminate the problem.

The technique for returning SysDateTime is now quite simple and elegant (note that we have the burden of catering for when the user changes their operating date, hence the dateadd/diff):

Code: Select all
Public Property SysDateTime() As Date
        Get
            Return DateAdd(DateInterval.Second, _OperatingDateDifferenceInSeconds, Now)
        End Get
        Set(ByVal Value As Date)
                _OperatingDateDifferenceInSeconds = DateDiff(DateInterval.Second, Now, Value)
            RaiseEvent SysDateTimeChanged()
        End Set
    End Property


No more nasty timers not firing and causing erroneous dates when running as a service :)
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2583
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 807

Previous

Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 4 guests