get working days in ax

Hi,

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);

if(line.RecId)
{
P = P+1;
}
}

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s