Fiscal calendar period dates and status
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 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))); } } }