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

Copy Markup charges while posting purchase invoice using X++

 Copy Markup charges while posting purchase invoice using X++ Class: Important: Code logic is just for Reference.  New class => Duplicate...