Financial calendars can be created and accessed from General ledger > Setup > Financial calendars.
Fiscal calendar periods status (Open, On hold and Closed) can be changed from General ledger > Setup > Ledger > button.
Following job can be used to get Start and End date of current Fiscal year
Fiscal calendar periods status (Open, On hold and Closed) can be changed from General ledger > Setup > Ledger > button.
Following job can be used to get Start and End date of current Fiscal year
static void
fiscalCalendarDates(Args _args)
{
PeriodStart periodStartDate;
PeriodEnd periodEndDate;
periodStartDate =
FiscalCalendarYear::findYearByCalendarDate(CompanyInfo::fiscalCalendarRecId(), systemDateGet()).StartDate;
periodEndDate =
FiscalCalendarYear::findYearByCalendarDate(CompanyInfo::fiscalCalendarRecId(), systemDateGet()).EndDate;
info(strFmt("%1",
periodStartDate));
info(strFmt("%1",
periodEndDate));
periodStartDate = FiscalCalendars::findFirstDayofYear(Ledger::find(Ledger::current()).FiscalCalendar,
systemDateGet());
periodEndDate =
FiscalCalendars::findLastDayofYear(Ledger::find(Ledger::current()).FiscalCalendar,
systemDateGet());
info(strFmt("%1",
periodStartDate));
info(strFmt("%1",
periodEndDate));
}
Following job can be used to get the period status (Open, On hold and Closed)
static void
checkFiscalCalendarPeriod(Args _args)
{
TransDate transDate
= systemDateGet();
RecId
calendarRecId;
FiscalCalendarPeriod
fiscalCalendarPeriod;
calendarRecId = Ledger::fiscalCalendar(CompanyInfo::find().RecId);
fiscalCalendarPeriod =
FiscalCalendars::findPeriodByPeriodCodeDate(calendarRecId, transDate,
FiscalPeriodType::Operating);
if (transDate)
{
if (! fiscalCalendarPeriod)
{
checkFailed(strFmt("@SYS17614",date2StrUsr(transDate,
DateFlags::FormatAll)));
}
if
(fiscalCalendarPeriod.currentLedgerPeriodStatus() != FiscalPeriodStatus::Open)
{
checkFailed(strFmt("@SYS17615", date2StrUsr(transDate,
DateFlags::FormatAll)));
}
}
}
Very helpful for us and gained more knowledge from it. We are very greatful and thanks a lot.
ReplyDeleteMicrosoft Dynamics AX Training | Microsoft Dynamics CRM Online Training
Glad to know it helped you.
ReplyDeletenice post thanks given such helpful information more about MS Dynamics AX Microsoft Dynamics Online Tutorial
ReplyDeleteGreat.
ReplyDeleteAnyone that have tried to get the "mandatory" account/dimension set information from code ?