Search This Blog

Monday, April 21, 2014

How to Convert SSRS Report into PDF By using X++.

Hi Folks,

Here is the code to convert SSRS report into PDF.
But Before converting the report to PDF we need to send the parameter values to Contract class after that we need to convert the report.

//For Converting Report to PDF
public void makeCommissionReport()
{
    Args                            args;
    SrsReportRunInterface           reportRun;
    SrsReportDataContract           contract;
    SrsReportRunController          controller;
    CommByAgencyContract            commContract;
    SRSPrintDestinationSettings     printSettings;
    SRSReportExecutionInfo          executionInfo;
 
 

    SrsReportRunImpl                srsReportRun;

    ReportName                      reportname =  "CommissionReportAgency.report";
    filenameType    = '.pdf';
    generatedReportFilePath = filePath + file + filenameType;
    args = new Args();
   /* args.record(record);
    retailStoretable = args.record(record);
    generatedDocument = false;
   */
    /*select custTable where custTable.AccountNum == retailStoretable.DefaultCustAccount;
    storenum = retailStoretable.StoreNumber;
    num      = custTable.InvoiceAccount;
    */
    controller = new SrsReportRunController();
    controller.parmReportName(reportname);
    commContract = controller.parmReportContract().parmRdpContract();
    commContract.parmfromdate(dat);
    commContract.parmTodate(endDate);
    commContract.ReciD(recid);
    controller.parmArgs(args);
    srsReportRun = controller.parmReportRun() as SrsReportRunImpl;
    controller.parmReportRun(srsReportRun);

    controller.parmReportContract().parmPrintSettings().printMediumType(SRSPrintMediumType::File);
    controller.parmReportContract().parmPrintSettings().overwriteFile(true);
    controller.parmReportContract().parmPrintSettings().fileFormat(SRSReportFileFormat::PDF);
    controller.parmReportContract().parmPrintSettings().fileName(generatedReportFilePath);
    controller.runReport();
    //generatedDocument = true;
}

Thanks
Happy Daxing..!

How to Display SSRS Report into Enterprise Portal in Dynamica Axapta 2012 R2

Hi Folks,

How to Display SSRS Report into Enterprise Portal in Dynamica Axapta 2012 R2 .Its very Easy.

Please see the below steps.

Step1:

After Creating the SSRS in AX,we need to add that into output menuItem with proper label.
Here label is very important because it will connect between Ep and AX.

Step 2:

\Go to your EP page selct the place where you need to display the Report.There we need to add the web Part click on that we can see the option like "Dynamics Report Server Report".

Step 3:

It will display all the outPut MenuItems,Here we can see the label names for the menuitems. Select your menuitems .thats it.

Thanks
Happy Daxing..! 

How to Calculate the time for the particular query time in Dynamics Axapta

Hi Folks,

How to Calculate the query timings ,how much time its working.

Check the below code you can identify :)

static void DateSplit(Args _args)
{
  date fixDate,fromdate,todate;
  int i,j;
  int         day,month,years;
  utcDateTime         jobStart, JobEnd;
  int64               jobRuntime;
  ;
    jobStart = DateTimeUtil::utcNow();
  fixDate = 22\1\2014;//systemDateGet();
  day = dayOfMth(fixDate);
  month = mthOfYr(fixDate);
  years = year(fixDate);

  info(strFmt("%1",day));

    if(day <=15)
    {
        fromdate = mkDate(1,month,years);
        todate   = mkDate(15,month,years);
        info(strFmt("%1 %2",fromdate,todate));
    }
    else if(day <= 31)
    {
        fromdate = mkDate(16,month,years);
        todate   = mkDate(31,month,years);
        info(strFmt("%1 %2",fromdate,todate));
    }
     jobEnd = DateTimeUtil::utcNow();
    jobRuntime = DateTimeUtil::getDifference(JobEnd, jobStart);
    info(strFmt("JOB DONE IN %1 SECONDS", int642str(jobRuntime)));
}

OutPut:























Thanks
Happy Daxing..!

Sunday, April 20, 2014

Create new Numberseq in Ax2012

Hi Folks,

How to create the new numberseq with Out disturb the existing class In ax2012.

1) Create the new Class extends with NumberSeqApplicationModule

class Sample extends NumberSeqApplicationModule
{

}

2)  Override the Loadmodule method()

protected void loadModule()

{

NumberSeqDatatype datatype = NumberSeqDatatype::construct();

/* Setup application numbers */

datatype.parmDatatypeId(extendedtypenum(EDT));

datatype.parmReferenceHelp(literalstr("Sample"));

datatype.parmReferenceLabel(literalstr("Sample"));

datatype.parmWizardIsContinuous(true);

datatype.parmWizardIsManual(NoYes::No);

datatype.parmWizardIsChangeDownAllowed(NoYes::No);

datatype.parmWizardIsChangeUpAllowed(NoYes::No);

datatype.parmWizardHighest(999999);

datatype.parmSortField(1);

datatype.addParameterType(NumberSeqParameterType::DataArea, true, false);

this.create(datatype);

}
3) Select the numberseq for perticular form

public NumberSeqModule numberSeqModule()
{
    return NumberSeqModule::RetailParameters;
}

4) Goto Organisation and administration Module generate the numberseq in normal process.

Thanks
Happy Daxing..