get working days in ax


Below is the sample code to get the working days based on the start date and end date.

to get it based on each legal entity wise in ax 2012, we need to setup the working days template in : YEU/Organization administration/Common/Calendars/working time templates and setup the same for each company in  YEU/Organization administration/Common/Calendars/Period templates

//Holiday list

select count(RecId) from leaveData
where leaveData.HolidayDate <= Mzk_LeaveHistory.StartDate
&& leaveData.HolidayDate >= Mzk_LeaveHistory.EndDate;
countrecid = any2int(leaveData.RecId);

//Working days
for(i=sdate; i<= edate; i++)
select count(RecId) from line
where line.dataAreaId == curext()
&& line.WeekDay == dayOfWk(i);

P = P+1;


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s