Look up date and calendar in AX

Look up date and calendar in AX

void lookup()
{
ProjPeriodId    projPeriodId = DNGRMParameter::find().PeriodId;
ProjPeriodTo    projPeriodTo;
ProjControlPeriod  projControlPeriod = new ProjControlPeriod();
// projControlPeriod = element.args().caller().runbase();
//if (!projControlPeriod.parmPeriodic())
//{
//if (this.dateValue())
//{
//projPeriodTo = this.dateValue();
//}
//else
//{
//projPeriodTo = ProjPeriodLine::findPrevFromDate(projPeriodId, systemdateget()).PeriodTo;
//}
//}
//else
//{
if (this.dateValue())
{
projPeriodTo = this.dateValue();
}
else
{
projPeriodTo = ProjPeriodLine::findPrevFromDate(projPeriodId, systemdateget()).PeriodTo;
}
// }

ProjPeriodLine::lookupPeriodTo(this, projPeriodId, projPeriodTo);
}