Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calculate days to advance and skip weekend
Message
From
06/12/2017 19:57:44
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01656173
Message ID:
01656195
Views:
50
>>>
>>>I will try your approach. Although I don't like it ;) I have been thinking about it all day and you come up with a very simple formula :) Thank you!
>>
>>Assuming it works ;)
>>
>>My view? I think that sometimes we have to put some distance to a problem to get it solved. That is, sometimes what helps me is to stop thinking about a problem...
>
>I agree with you. My best solutions are either in my sleep or while I am taking a walk.

Hum. I think it's better, now.
m.RealDaysToAdvance = m.DaysToAdvance + INT((m.TodayDow + m.DaysToAdvance - 1) / 5) * 2
And a small program to give us a visual clue.
LOCAL DaysToAdvance AS Integer
LOCAL RealDaysToAdvance AS Integer
LOCAL Advanced AS Integer
LOCAL DisplayDays AS Integer

CLEAR

LOCAL TodayDow AS Integer

m.TodayDow = 1

FOR m.DaysToAdvance = 1 TO 20

	? m.DaysToAdvance

	m.RealDaysToAdvance = m.DaysToAdvance + INT((m.TodayDow + m.DaysToAdvance - 1) / 5) * 2

	?? " - >", m.RealDaysToAdvance
	? "."

	m.Advanced = 0

	FOR m.DisplayDays = 1 TO m.RealDaysToAdvance

		IF (m.TodayDow + m.DisplayDays) % 7 = 6 OR (m.TodayDow + m.DisplayDays) % 7 = 0
			?? "|"
		ELSE
			?? "+"
			m.Advanced = m.Advanced + 1
		ENDIF

	ENDFOR

	?? "", m.Advanced

ENDFOR
----------------------------------
António Tavares Lopes
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform