Weekday(TODAY) Code

chualt

New Member
Obvously, I am fairly new to Progress and am trying to write code for the following. I have an accounting period called period.cur-per with dates of 01/01/05 to 01/30/05. I have a $20,000.00 amount called tot-budget and a daily sales amount of $1525 called day-sales that I want to average by the number of Buisness days (only) that have passed in the period.

day-sales / (number of business days passed as of TODAY in this period)


This is so I can get a Month to Date average of the months sales.


Any help with this code would be greatly appreciated.
Thanks.
chuck.altman@mindspring.com
 
Business days

The number of business days is simple to work out. There are 7 days in a week, there are 5 business days in a week. Simple mathematical formula here needs to be applied. First calculate the number of days. This can then be applied to your logic procedure to calculate the number of business days. First impressions have a user defined function that will apply logic. Divide by 5, and then with the remainder tidy up to give the num,ber of working days.
Regards
 

MrGinge

New Member
assuming saturday and sunday are non-working, try this to get the number of working days.

assign tdays = today - start-date
do i = 0 to tdays:
if weekday(start-date + i) > 2 then wdays = wdays + 1.
end.
 
Top