AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 30.04.2020, 12:12   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
dynamicsaxinsight: Generate financial report in X++
Источник: https://dynamicsaxinsight.wordpress....l-report-in-x/
==============

Purpose

The purpose of this blog post is to demonstrate how can we generate a financial report in X++ and download it as a file.

Product

Dynamics 365 Finance.

Description

Please find the code snippet below which can be used to generate a financial report in X++. The code generates the report in XML format. The same code can be used to export the report in Excel and XPS file formats. Once generated the code allows the user to download the generated report.

public static void main(Args _args){ financialReportVersion financialReportVersion; FinancialReports financialReports; PeriodEnd periodEndDate; str reportName; str fileContent; const str fileName = 'FinancialReport.xml'; reportName = "12 Month Rolling Single Column Income Statement - Default"; periodEndDate = FiscalCalendarYear::findYearByCalendarDate( Ledger::fiscalCalendar(CompanyInfo::find().RecId), systemDateGet()).EndDate; select firstonly financialReportVersion order by recid desc join financialReports where financialReports.DesignId==financialReportVersion.DesignId && financialReports.reportName == reportName; FinancialReportingIReportExport reportExporter = new FinancialReportingReportExport(); System.Text.Encoding encodingGB18030 = System.Text.Encoding::GetEncoding("utf-8"); if (!financialReports.DesignId) { throw error(strfmt("Design not found for Report %1", reportName)); } System.IO.Stream stream = reportExporter.GenerateAndExportReport( financialReports.DesignId, curExt(), periodEndDate, FinancialReportingReportExportFormat::Xml, encodingGB18030); if (stream == null) { throw error(strfmt("Stream is empty for Report %1 period %2", reportName, periodEndDate)); } System.IO.StreamReader sReader = new System.IO.StreamReader(stream); fileContent = sReader.ReadToEnd(); File::SendStringAsFileToUser(fileContent, fileName);}

Источник: https://dynamicsaxinsight.wordpress....l-report-in-x/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
NAV Team: Report Execution Insights Blog bot Dynamics CRM: Blogs 0 30.10.2014 15:02
ax-erp: Walkthrough: Creating a Report Bound to a Report Data Provider Class (X++ Business Logic) [AX 2012] Blog bot DAX Blogs 0 20.09.2012 11:11
emeadaxsupport: New Content for Microsoft Dynamics AX 2012 : October 2011 Blog bot DAX Blogs 0 27.10.2011 17:11
Khue Trinh: Setting up a link between a financial dimension and the site inventory dimension Blog bot DAX Blogs 0 27.09.2010 13:05
wiki.dynamicsbook: Changes Made in Navision Attain 3.60 Blog bot Dynamics CRM: Blogs 0 02.09.2008 13:23

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 00:05.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.