影响Crystal Report中的特定记录

时间:2016-11-15 21:59:25

标签: c# visual-studio-2008 crystal-reports crystal-reports-xi

我有一个函数,在激活后,迭代它附加的Crystal Report,将其复制到pdf,然后每次识别一次将整个邮件发送到客户端字段

他们希望收到按ID分组的记录的pdf,针对报告中的每个ID,省略某些特定ID。我不知道如何将报告分解为较小的报告,或者如果可能的话首先从哪里开始。

1 个答案:

答案 0 :(得分:0)

我正在为个人用户创建每个Pdf并保存到我的Google驱动程序,并使用SendGrip Api发送电子邮件。

  • 我在网页内使用了此代码.Aspx - > aspx.cs文件。

        //0. Here i am getting list users as an Object:
        OpsManagementController OM = new OpsManagementController();
    
        //1. Getting Users List:
        var result = OM.UsersGetforInvoice();
    
        //2. Creating folder for Invoices:
        string folderName = @"D:\Google Drive\MonthlyInvoices";
        string fileName = ("Invoices_" + DateTime.Now.ToString("yyyy-MM-dd").ToString());
        string pathString = System.IO.Path.Combine(folderName, fileName);
        System.IO.Directory.CreateDirectory(pathString);
    
        string folderNameEmail = @"D:\Google Drive\MonthlyInvoices\Email";
        string fileNameEmail = ("Invoices_" + DateTime.Now.ToString("yyyy-MM-dd").ToString());
        string pathStringEmail = System.IO.Path.Combine(folderNameEmail, fileNameEmail);
        System.IO.Directory.CreateDirectory(pathStringEmail);
    
    
        //3. Generating invoices by user name:
    
        for (int i = 0; i < result.UserDetail.Count; i++)
        {
            var userId = result.UserDetail[i].UserID;
            var userEmail = result.UserDetail[i].Email;
            var userName = result.UserDetail[i].FullName;
            userName = userName.Replace(@"C\O", "CO");
            userName = userName.Replace(@"C/O", "CO");
    
            // Directories for reports:
            var invoicePath = "D:/Google Drive/MonthlyInvoices/" + fileName + "/" + userId + " " + userName + ".pdf";
            var invoicePath_email = "D:/Google Drive/MonthlyInvoices/Email/" + fileNameEmail + "/" + userId + " " + userName + ".pdf";
    
            report2.SetParameterValue("UserID", result.UserDetail[i].UserID);
    
            report2.ExportToDisk(ExportFormatType.PortableDocFormat, invoicePath);
    
             // using sendgrip Api :
            EmailUtils.SendEmail_Att(
                                new string[] { userEmail }, //TO : userEmail
                                new string[] { "email@gmail.com" }, //
                                invoiceSubject,
                                invoiceBody,
                                invoicePath_email
                                );
        }