Per calcolare il numero di giorni lavorativi in base al calendario in un intervallo di date possiamo usare questo Job:
static void LILCalcWorkingDays(Args _args)
{
WorkCalendarSched workCalendarSched;
FromDate fromDate;
ToDate toDate;
counter workDays,
totaldays;
CalendarId calendarId = "BaseCal";
;
toDate = mkDate(7,7,2022);
workCalendarSched = new workCalendarSched();
//giorni lavorativi dal 7/6/2022 al 7/7/2022
for(fromDate = toDate - 30; fromDate < toDate; fromDate++)
{
if(workCalendarSched.isdateopen(calendarId,fromDate))
{
workDays++;
}
totaldays++;
}
info(strfmt("Total days: %1 - Total working days: %2",totaldays,workDays));
}