Posts

Showing posts with the label Ledger Calendar Closed

Check if Invoice Date is in current Ledger Period using X++

public boolean AS_isInvoiceInCurrentLedgerPeriod(TransDate _transDate, TransDate _oldDate) {     FiscalCalendarPeriod         oldPeriod;     FiscalCalendarPeriod         newPeriod;     FiscalCalendarRecId          fiscalCalendarRecId = CompanyInfo::fiscalCalendarRecId();     LedgerFiscalCalendarPeriod   ledgerFiscalCalendarPeriod;     if (!FiscalCalendars::findYearEndClosingPeriodByDate(fiscalCalendarRecId, _transDate).RecId)     {         // The transaction date is not in a valid period.         return checkFailed("@GLS54501");     }     oldPeriod = FiscalCalendars::findPeriodByPeriodCodeDate(fiscalCalendarRecId, _oldDate);     newPeriod = FiscalCalendars::findPeriodByPeriodCodeDate(fiscalCalendarRecId, _transDate);     if (!newPeriod.RecId)...