Wednesday, November 30, 2016

Getting Aging date by days,Month,year,Qr in ax 2012

//Getting Aging date by days,Month,year,Qr in ax 2012

TransDate startDate(TransDate initDate = systemDateGet())
{
    Futures                 futures;
    recId                   calendarRecId = CompanyInfo::fiscalCalendarRecId();
    ;
    switch(this.IntervalType)
    {
        case PerDayWeekMthQtYr::Period:
            return FiscalCalendars::findPeriodStartDateByDateWithIndex(calendarRecId,initDate,this.Qty+1);
        case PerDayWeekMthQtYr::Day :
            futures = new Futures(initDate,
                                 (this.Qty+1),
                                 PeriodUnit::Day);
            return futures.next();
        case PerDayWeekMthQtYr::Week:
            futures = new Futures(dateStartWk(initDate),
                                 (this.Qty   * 7 +7),
                                 PeriodUnit::Day);
            return futures.next();
        case PerDayWeekMthQtYr::Month:
            futures = new Futures(dateStartMth(initDate),
                                 (this.Qty+1),
                                 PeriodUnit::Month);
            return futures.next();
        case PerDayWeekMthQtYr::Quarter:
            futures = new Futures(dateStartQtr(initDate),
                                 (this.Qty * 3 +3),
                                 PeriodUnit::Month);
            return futures.next();
        case PerDayWeekMthQtYr::Year:
            futures = new Futures(dateStartYr(initDate),
                                 (this.Qty+1),
                                 PeriodUnit::Year);
            return futures.next();
        case PerDayWeekMthQtYr::Unlimited:
            return dateNull();
    }
    return dateNull();
}

No comments:

Post a Comment

Convert Call stack to readable format in D365FO X++

//Input --container _xppCallStack = xSession::xppCallStack();  Public static str POL_formatXppCallStack(container _xppCallStack, int _skipFr...