Home

Tuesday, May 27, 2014

Open report o button click Ax 2009 which take record from the form

1-Write following code on form button clicked Event
void clicked()
{
    Args args;
    ReportRun reportRun;
    ;
    //breakpoint;
    args = new Args();
    args.name(Reportstr(RejectionStatusLine));
    args.parm(RejectionLine.ProdId);
    args.record(RejectionLine);
    args.parmObject( args );
    reportRun = classfactory.reportRunClass(args);
    reportRun.init();
    reportRun.run();

}
=====================================================================
2-Write following code in Report
public class ReportRun extends ObjectRun
{
    companyInfo companyInfo;
   Rejection  rejection;
}
---------------------------------------------------------------------------------------------------------
public void init()
{
      S3Rejection S3Rejection;
      ;
//    element.initFromArgs(element.args());
//
//   // info(rejection.ProdId);
//    this.query().dataSourceNo(1).addRange(fieldnum(S3Rejection,prodid)).value(rejection.ProdId);
//    super();
      if( element.args())
    {
       S3Rejection.prodid =  element.args().parm();
       S3RejectionLine = element.args().record();

      // info(strfmt('date requested:%1,date confirmed:%2',dateRequested,dateConfirmed));
       this.query().dataSourceNo(1).addRange(fieldnum(S3RejectionLine,prodId)).value(S3RejectionLine.ProdId);
   }

}
---------------------------------------------------------------------------------------------------------
void initFromArgs(Args args)
{

    if (args && args.dataset())
    {
        switch(args.dataset())
        {
            case tablenum(S3Rejection) :
                rejection = args.record();
                break;
        }
    }
}
------------------------------------------------------------------------------------------------------
//BP Deviation documented
display GiroNum  companyGiro()
{
    return companyInfo.Giro;
}

//BP Deviation documented
display Bitmap companyLogo()
{
    return FormLetter::companyLogo();
}


//BP Deviation documented
display Phone emailID()
{
    return companyInfo::find().Email;
}

//BP Deviation documented
display Name companyName()
{
    return CompanyInfo::find().Name;
}


//BP Deviation documented
display Addressing  companyAddress()
{;
    return  CompanyInfo::find().Address;
}

//BP Deviation documented
display  Phone  companyPhone()
{
    return CompanyInfo::find().Phone;
}

//BP Deviation documented
display TeleFax  companyTelefax()
{
    return CompanyInfo::find().TeleFax;
}

display public str ABC_TodaysDate()
{
    return date2Str(today(), 123, DateDay::Digits2, DateSeparator::Slash, DateMonth::Digits2, DateSeparator::Slash, DateYear::Digits4);
}

display int pages()
{
    return  element.pagesTotal();
}

//BP Deviation documented
display timeOfDay startTime()
{
    return element.startTime();
}


//BP Deviation documented
display str 20 pageNum()
{
    return strfmt(element.design().lookupLabel(literalstr("%1 of")), element.page());
}

No comments:

Post a Comment