带有来自 Rapport 的 PDF 文件的模板通知生成器

问题描述 投票:0回答:1

在正常操作中,我想在发送的电子邮件中自动生成 PDF。

当我使用下面的代码时,没有生成附件。我想要 PDF。

          TemplateNotificationGenerator sender = TemplateNotificationGenerator.Create(une_attestation, notification.NotificationID.Value);                        
          sender.MailAccountId = (notification.NFrom.HasValue) ? notification.NFrom.Value : PX.Data.EP.MailAccountManager.DefaultMailAccountID;  
          sender.RefNoteID = un_client.NoteID; 
          sender.LinkToEntity  = true;  
          sender.BAccountID = une_attestation.Atclt;   
     
          sender.RefNoteID = une_attestation.NoteID;
          if ((currentFilter.Usremail!=null) && (currentFilter.Usremail!=""))
            {
              sender.To = currentFilter.Usremail; //un_contact.EMail  
            }

是否可以在不自动生成文档的情况下执行此操作?

acumatica
1个回答
0
投票

我添加此代码以在电子邮件中添加报告。

    Dictionary<String, String> parameters = new Dictionary<String,String>();
    parameters["attestationnum"] = edispace(une_attestation.Atnum);
    PXReportSettings settings = new PXReportSettings("SOPRATTT");
    PX.Reports.Controls.Report report = 
    pg.ReportLoader.CheckIfNull(nameof(ReportLoader)).LoadReport("SOPRATTT",null); pg.ReportLoader.InitDefaultReportParameters(report, parameters);
    PX.Reports.Data.ReportNode reportNode pg.ReportDataBinder.CheckIfNull(nameof(ReportDataBinder)).ProcessReportDataBinding(report);
    byte[] data =PX.Reports.Mail.Message.GenerateReport(reportNode,RenderType.FilterPdf).First();                                
    sender.AddAttachment("fiscale.pdf", data);
© www.soinside.com 2019 - 2024. All rights reserved.