Tuesday, November 11, 2025

Blob

 using Microsoft.WindowsAzure.Storage; 

Using Microsoft.WindowsAzure.Storage.Blob; 

using System.IO; 

final class FinancialReport 

{ 

    /// <summary> 

    /// Class entry point. The system will call this method when a designated menu  

    /// is selected or when execution starts and this class is set as the startup class. 

    /// </summary> 

    /// <param name = "_args">The specified arguments.</param> 

    public static void main(Args _args) 

    { 

        financialReportVersion financialReportVersion; 

        FinancialReports       financialReports; 

        PeriodEnd              periodEndDate; 

        str                    reportName; 

        str                    fileContent; 

        const str              fileName = 'FinancialReport.xlsx'; 

        reportName = "12 Month Rolling Single Column Income Statement - Default"; 

        periodEndDate = mkDate(31,12,2023); 

        CloudBlobClient cloudBlobClient; 

        CloudBlobContainer cloudBlobContainer; 

        CloudStorageAccount cloudStorageAccount; 

        CloudBlockBlob          CloudBlockBlob; 

        System.Byte[]           reportBytes = new System.Byte[0](); 

        cloudStorageAccount = CloudStorageAccount::Parse("DefaultEndpointsProtocol=https;AccountName=financialreport1;AccountKey=SqnPJgr09oY2ayWNgA31aBihbexyaP7ZNkUYqqZ2f1IXHh1iKT9axXmNtIQ8yeVQReCVEmpUmoF9+AStV81m8A==;EndpointSuffix=core.windows.net"); 

        // Example : 

        // ("DefaultEndpointsProtocol = https; 

        // AccountName = 'AccountName';AccountKey = 'AccountKey';EndpointSuffix=core.windows.net"); 

        cloudBlobClient = cloudStorageAccount.CreateCloudBlobClient(); 

        cloudBlobContainer = cloudBlobClient.GetContainerReference("inputreport"); 

        CloudBlockBlob      = cloudBlobContainer.GetBlockBlobReference(fileName); 

        //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::Excel,        encodingGB18030); 

        if (stream == null) 

        { 

            throw error(strfmt("Stream is empty for Report %1 period %2",            reportNameperiodEndDate)); 

        } 

       // System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); 

       // reportBytes = enc.GetBytes("YOUR XML STRING/TEXT or Data in file"); 

       // System.IO.MemoryStream stream = new System.IO.MemoryStream(reportBytes); 

        CloudBlockBlob.UploadFromStream(stream, null, null, null); 

         

       // System.IO.StreamReader sReader = new System.IO.StreamReader(stream) 

  

; 

        //fileContent = sReader.ReadToEnd(); 

        //File::SendStringAsFileToUser(fileContentfileName); 

    } 

  

} 

No comments:

Post a Comment