private void PrintRoport(ReportForm.RptHander aReportName, System.Collections.ArrayList arrList, System.Data.DataTable dt, System.Data.DataTable dtDev, string sUser, DateTime sDate, DateTime eDate) { string sReportName = aReportName.ToString(); string startDate = sDate.ToString("yyyy-MM-dd HH:mm"); string endDate = eDate.ToString("yyyy-MM-dd HH:mm"); DevExpress.XtraReports.UI.XtraReport myXtraReport = null; DevExpress.XtraReports.UI.XtraReport NewsPaper = null; //是否為主從報表 foreach (string s in Enum.GetNames(typeof(ReportForm.CommClass.Father.HasMain))) { if (aReportName.ToString() == s) { myXtraReport = new ReportForm.clsReport(sReportName.ToString(), new VDReportHandler(), new VDReportMaim(), new VDReportMinor(), 4, arrList, dt, dtDev, sUser, startDate, endDate); myXtraReport.Print(@"\\xml\HPLaserJ"); //myXtraReport.ShowPreview(); break; } } //不是主從報表,但有設備重類 foreach (string s in Enum.GetNames(typeof(ReportForm.CommClass.Father.HasKind))) { if (aReportName.ToString() == s) { List<int> perList = new List<int>(); perList.AddRange(new int[] { 12, 12, 12, 40, 12, 12 }); myXtraReport = new ReportForm.clsReport(sReportName.ToString(), new HadKindHandler(perList), null, new HadKindMinor(perList), 3, arrList, dt, dtDev, sUser, startDate, endDate); //myXtraReport.ShowPreview(); myXtraReport.Print(@"\\xml\HPLaserJ"); break; } } //不是主從報表,也沒有有設備重類 foreach (string s in Enum.GetNames(typeof(ReportForm.CommClass.Father.NonKind))) { if (aReportName.ToString() == s) { ReportForm.clsReport report = new ReportForm.clsReport(sReportName.ToString(), new HadKindHandler(), null, new HadKindMinor(), 3, arrList, dt, null, sUser, startDate, endDate); report.IsShowTime = false; myXtraReport = report; //myXtraReport.ShowPreview(); myXtraReport.Print(@"\\xml\HPLaserJ"); //NewsPaper.Print(); break; } } //SHIN ADD 2010-11-05 if (aReportName.ToString() == "每日定時路況新聞稿") { NewsPaper = new ReportForm.clsNewsPaper(sReportName.ToString(), section, dtDev, DateTime.Now); NewsPaper.PrintingSystem.ShowPrintStatusDialog = false; //取消列印的訊息視窗 NewsPaper.PrintingSystem.ShowMarginsWarning = false; ExportDataTableToExcel(aReportName.ToString(), dt); //NewsPaper.ShowPreview(); //NewsPaper.Print(); NewsPaper.Print(@"\\xml\HPLaserJ"); } else if (aReportName.ToString() == "路段壅塞狀況一分鐘報表") { ExportDataTableToExcel(aReportName.ToString(), dt); } //75, 20, 20, 142 //timer.Change(3000, -1); //myXtraReport.Landscape = true; //myXtraReport.PaperKind = System.Drawing.Printing.PaperKind.Letter; //myXtraReport.PrintingSystem.ShowPrintStatusDialog = false; //取消列印的訊息視窗 //myXtraReport.PrintingSystem.ShowMarginsWarning = false; //myXtraReport.ShowPreviewDialog(); //string query = string.Format("SELECT * from Win32_Printer"); //ManagementObjectSearcher searcher = new ManagementObjectSearcher(query); //ManagementObjectCollection coll = searcher.Get(); //foreach (ManagementObject printer in coll) //{ // foreach (PropertyData property in printer.Properties) // { // Console.WriteLine(string.Format("{0}: {1}", property.Name, property.Value)); // } //} //myXtraReport.ShowPreview(); //myXtraReport.Print(@"\\testdb2\MainPrinter"); //myXtraReport.Print(@"\\xml\HPLaserJ"); }