Showing posts with label REPORT. Show all posts
Showing posts with label REPORT. Show all posts

Tuesday, November 21, 2017

SAVE REPORT TO PDF FROM AX JOB CONTROLLER CLASS : VIKAS MEHTA HOW TO CALL A REPORT FROM JOB AND SAVE IT IN PDF

SAVE REPORT TO PDF FROM AX JOB CONTROLLER CLASS : VIKAS MEHTA
HOW TO CALL A REPORT FROM JOB AND SAVE IT IN PDF

public static void SaveReportToPDFFromController(Args _args)
{
    VIKSalesInvoiceFinanceController  salesInvoiceController;
    VIKSalesInvoiceFinanceContract    salesInvoiceContract;
    Args                    args = new Args();
    SrsReportRunImpl        srsReportRun;
    CustInvoiceJour         custInvoiceJour;
    SRSReportExecutionInfo  reportExecutionInfo;
    ReportName              reportName = "VIKSalesFinance.PrecisionDesign1";//PrecisionDesign1_backup
    #define.ReportName('VIKSalesFinance.PrecisionDesign1')
    ;
    //SRSReportExecutionInfo = new SRSReportExecutionInfo();d
    select firstOnly custInvoiceJour where custInvoiceJour.SalesId == "1234”;
    args.record(custInvoiceJour);

    salesInvoiceController = new VIKSalesInvoiceFinanceController();
    salesInvoiceController.parmReportName(reportName);

    reportExecutionInfo = salesInvoiceController.parmReportContract().parmReportExecutionInfo() as SrsPrintMgmtExecutionInfo;

    if (!reportExecutionInfo)
    {
       reportExecutionInfo = new SrsPrintMgmtExecutionInfo();
    }
    //reportExecutionInfo.parmOriginalDestinationFileName("c:\\SalesInvoice.pdf");
    salesInvoiceContract = salesInvoiceController.parmReportContract().parmRdpContract();
    salesInvoiceContract.parmReportCopyName('');
    salesInvoiceContract.parmTenderTypeId('21');
    salesInvoiceContract.parmInvoiceId(custInvoiceJour.InvoiceId);
    salesInvoiceContract.parmSalesId(custInvoiceJour.SalesId);

  //  salesInvoiceContract.
   // salesInvoiceContract.parmRecordId(custInvoiceJour.RecId); // Record id must be passed otherwise the report will be empty
   // salesInvoiceContract.parmInvoiceIdparm(custInvoiceJour.RecId); // Record id must be passed otherwise the report will be empty
    salesInvoiceController.parmArgs(args);
    salesInvoiceController.parmReportName(#ReportName);
    salesInvoiceController.parmDialogCaption("Sales Finance Invoice");
     args.parm(strFmt("Copy - 1"));

    srsReportRun = salesInvoiceController.parmReportRun() as SrsReportRunImpl;

    salesInvoiceController.parmReportRun(srsReportRun);
    salesInvoiceController.parmReportContract().parmReportExecutionInfo(reportExecutionInfo);
    salesInvoiceController.parmReportContract().parmPrintSettings().printMediumType(SRSPrintMediumType::File);
    salesInvoiceController.parmReportContract().parmPrintSettings().overwriteFile(true);
    salesInvoiceController.parmReportContract().parmPrintSettings().fileFormat(SRSReportFileFormat::PDF);
    salesInvoiceController.parmReportContract().parmPrintSettings().fileName("c:\\test123\\SREPORT.pdf");
    salesInvoiceController.runReport();
}

static void SaveReportToPDFFromController(Args _args)
{
    SalesInvoiceController  salesInvoiceController;
    SalesInvoiceContract    salesInvoiceContract;
    SRSPrintDestinationSettings     settings;
    Args                    args = new Args();
    SrsReportRunImpl        srsReportRun;
    CustInvoiceJour         custInvoiceJour;
    ReportName              reportName = "SalesInvoice.Report";
    ;

    select firstOnly custInvoiceJour where custInvoiceJour.invoiceid == "sid";
    args.record(custInvoiceJour);

    salesInvoiceController = new SalesInvoiceController();
    salesInvoiceController.parmReportName(reportName);

    salesInvoiceContract = salesInvoiceController.parmReportContract().parmRdpContract();
    salesInvoiceContract.parmRecordId(custInvoiceJour.RecId); // Record id must be passed otherwise the report will be empty
  //  salesInvoiceContract.parmCountryRegionISOCode(SysCountryRegionCode::countryInfo()); // comment this code if tested in pre release
    salesInvoiceController.parmArgs(args);

    srsReportRun = salesInvoiceController.parmReportRun() as SrsReportRunImpl;

     salesInvoiceController.parmReportName(ssrsReportStr(VIKSalesFinance, PrecisionDesign1));
    // Use execution mode appropriate to your situation
  //  salesInvoiceController.parmExecutionMode(SysOperationExecutionMode::ScheduledBatch);
    // Suppress report dialog
    salesInvoiceController.parmShowDialog(false);

    salesInvoiceController.parmReportRun(srsReportRun);
    salesInvoiceController.parmReportContract().parmPrintSettings().printMediumType(SRSPrintMediumType::File);
    salesInvoiceController.parmReportContract().parmPrintSettings().overwriteFile(true);
    salesInvoiceController.parmReportContract().parmPrintSettings().fileFormat(SRSReportFileFormat::PDF);
    salesInvoiceController.parmReportContract().parmPrintSettings().fileName("c:\\VIKAS\\sdc.pdf");


    settings = salesInvoiceController.parmReportContract().parmPrintSettings();
    settings.printMediumType(SRSPrintMediumType::File);
    settings.fileFormat(SRSReportFileFormat::PDF);
    settings.fileName(@'c:\\TEST\1234.pdf');

    salesInvoiceController.startOperation();
}



Thursday, June 8, 2017

CALL DIFFERENT REPORT DESIGN IN AX 2012 MICROSOFT DYNAMICS

AX 2012 SSRS REPORT DESIGN 
Go to main method in controller class and write below code to call the report.

   SSRSRPTController   controller; 
   controller = new SSRSRPTController(); 
   controller.parmArgs(args); 
   controller.parmReportName(ssrsReportStr(SALESREPORT, DESIGN1)); 
   controller.parmShowDialog(true); 

   controller.startOperation()  

Thursday, May 4, 2017

MICROSOFT DYNAMICS AX 2012 : SETUP DIFFERENT DATE FORMATS DD/MM/YY OR REGION SPECIFIC ON AX SSRS REPORT

SETUP DIFFERENT DATE FORMATS ON AX SSRS REPORT


Hi

If you want to setup a different Format Date on a SSRS report,

1- Modify date format for all date textbox present in the SSRS Report using the Format function, like =Format(Fields!TransDate.Value, "dd/MM/yyyy")

2- If you want follow the User Timezone, for all date textbox you can use ConvertUtcToAxUserTimeZoneForUser method, like =Microsoft.Dynamics.Framework.Reports.DataMethodUtility.ConvertUtcToAxUserTimeZoneForUser(Parameters!AX_CompanyName.Value, Parameters!AX_UserContext.Value, =Fields!TransDate.Value, "d", Parameters!AX_RenderingCulture.Value)

Saturday, October 15, 2016

CREATE A BATCH JOB IN AX 2012 AND SEND THE REPORT AS EMAIL ATTACHMENT VIA BATCH JOB SCHEDULER

STEPS TO CREATE A BATCH JOB IN AX 2012  AND SEND THE REPORT AS EMAIL ATTACHMENT THROUGH BATCH JOB.

This document covers the creation of batch job for Customers Report as an example.
Go to Accounts Receivable > Reports > Customer > Customers Report
Select the Customers range using select button in the customers report dialog box


Click on Destinations button to specify the print destination of the report
Various Print Destinations are available in Print Destination Settings
Print destination as screen is not allowed for a report runs as batch.
Select the E-mail and enter the email addresses as shown in the screen shot below. Select the File format from the different file format options available in the lookup.

Click OK after selecting Print Destination.
In the Customers Dialog box Click on Batch Tab.


Select the Batch processing check box.

Set the following options:
Task Description – Enter a description for the job.

Batch group - Assign the job to a batch group.
Batch groups are designed to enable you to run specific types of jobs on a specific batch server, or to run jobs on batch servers that are available at specific times. Batch groups are created by system administrators.
Private – Select this check box to restrict other users from processing your batch job. A private job can be run only by the user who submitted it, from the Set up batch processing form, and only on the computer where the user is logged on.

Click Recurrence to configure a batch job to recur on a specific schedule.


Time zone: Select the time zone.
Starting time: Enter the time that the batch job starts at.
Starting date:  Enter the date that the batch job starts at.
No end date: select this option to make the job run forever.
End after: Select this option to make the batch job stop after some occurrences.
Count:   Enter the specific number of recurrences.
End by:  Select this option to make the batch job stop at specific date
End date: Enter the last date of the job run.
Minutes:  select this option to make the job run for every specified number of minutes.
Enter the number of minutes in the Count Field.
Hours:  select this option to make the job run for every specified number of hours.
Enter the number of hours in the Count Field.
Days: select this option to make the job run for every specified number of days.
Enter the number of days in the Per field.
To run the batch job daily from Monday to Friday, click Every weekday
Weeks: select this option to make the job run for every fixed weekly intervals.
Enter the number of weeks in the Fixed weekly interval field, and then select the days on which you want the job to run.
For example, if you type 2 in the Fixed weekly interval field, and then select Monday and Wednesday, the batch job runs every two weeks on Monday and Wednesday.

Months:  select this option to make the job run for every fixed monthly intervals.
To set the day of the month and the frequency of the batch job, select Repeat a specific day by a fixed interval.
For example, if you enter 1 in the Day field and 3 in the Per field, the batch job runs on the first of the month for every three months.
To set a particular day of the week and the frequency of the batch job, select Repeat a specific weekday by a fixed interval.
For example, if you select Last in the Week field and Friday in the Weekdays field, and then enter 6 in the Per field, the batch job runs for every six months on the last Friday of the month.

Years:  select this option to make the job run for every year.
Select Repeat once a year or Repeat a specific weekday a year, and then set the starting date.
For example, if you select First in the Week field, Monday in the Weekdays field, and June in the Month field, the batch job runs for every year on the first Monday in June.



Click Alerts button.





Configure alerts for a batch job as shown in the following screen and Click OK.


Once the recurrence and alerts configuration is done click OK on the Customers Report dialog box.







The below message box pops up after the batch is created and added to queue.



Presetup’s needs to be done before sending the report as Email attachment

Friday, April 15, 2016

HOW TO DEBUG AX 2012 SSRS REPORT CODE BREAKPOINT SrsReportDataProviderPreProcess

HOW TO DEBUG AX 2012 SSRS REPORT 


1)   Open the DP class of the report.
2)  Extend SrsReportDataProviderPreProcess instead of SrsReportDataProviderBase
 in class declaration.
 Temp table properties should be

     (a) Table type : Regular instead of tempDB

     (b)  Created by : Yes

     (c) Created Transaction Id : Yes

Make sure  two checkboxes of user breakpoints and global breakpoints for debugging is enabled  in configuration .


Related Posts Plugin for WordPress, Blogger...