Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calculate days to advance and skip weekend
Message
 
 
To
06/12/2017 19:57:44
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01656173
Message ID:
01656198
Views:
40
>>>>
>>>>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
>
Thank you very much, Antonio. I will try this code tomorrow.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform