0
我有一個函數,當它被激活時,通過它附加的水晶報表進行迭代,將其複製到pdf,然後將其整個郵寄給客戶端,每個標識字段。影響水晶報告中的特定記錄
他們希望收到一份由ID分組的記錄pdf,用於報告中的每個ID,省略一些特定的ID。我不知道如何將報告分解成更小的報告,或者如果可能的話,甚至從哪裏開始。
我有一個函數,當它被激活時,通過它附加的水晶報表進行迭代,將其複製到pdf,然後將其整個郵寄給客戶端,每個標識字段。影響水晶報告中的特定記錄
他們希望收到一份由ID分組的記錄pdf,用於報告中的每個ID,省略一些特定的ID。我不知道如何將報告分解成更小的報告,或者如果可能的話,甚至從哪裏開始。
我正在爲每個用戶創建每個Pdf並保存到我的Google Driver,並使用SendGrip Api發送電子郵件。
我用裏面page.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 protected]" }, //
invoiceSubject,
invoiceBody,
invoicePath_email
);
}