boolean canRun = false; TransDate fromDate, toDate, prevDate; TransDate currentDate = DateTimeUtil::getSystemDate(DateTimeUtil::getUserPreferredTimeZone()); switch (Reporting.Schedule) { case ReportingSchedule::Daily : fromDate = currentDate - 1; toDate = currentDate - 1; canRun = true; break; case ReportingSchedule::Weekly : PreferredLocale preferredLocale = (new xSession()).PreferredLocale(); prevDate = HcmDateTimeUtil::calculateDateWithOffset(PeriodUnit::Day,7,false, currentDate); fromDate = DateTimeUtil::getStartOfWeekDate(preferredLocale, prevDate); toDate = DateTimeUtil::getEndOfWeekDate(preferredLocale, prevDate); canRun = dayOfWk(currentDate) == 1; //1 for monday break; case ReportingSchedule::Monthly : prevDate = prevMth(currentDate); fromDate = DateStartMth(prevDate); toDate = endmth(prevDate); canRun = dayOfMth(currentDate) == 1; //1 for first day of the month break; }
This blog is contains coding reference related to Microsoft AX 2012 and D365 finance and operations and Power platform
Showing posts with label backward. Show all posts
Showing posts with label backward. Show all posts
Tuesday, April 16, 2024
Calculate FromDate/ToDate based on Daily,Weelkly,Monthly in X++
Subscribe to:
Posts (Atom)