private void simpleButtonPrint_Click(object sender, EventArgs e) { string pathname = ""; string filePath = ""; DataTable GeneralInfo = new DataTable(); DataTable GridTableCheckbox = new DataTable(); GridTableCheckbox = ((DataTable)gridControlReciept.DataSource); XtraReport1 report1 = new XtraReport1(); report1.CreateDocument(); for (int i = 0; i < GridTableCheckbox.Rows.Count; i++) { if ((bool)(GridTableCheckbox.Rows[i]["checkbox"]) == true) { if (GridTableCheckbox.Rows[i]["rec_trans_type"].To<bool>()==true) { PrintDocuments.reciept_manual PrintReciept = new DXWindowsApplication2.PrintDocuments.reciept_manual(); GeneralInfo = BusinessLogicBridge.DataStore.getGeneralConfig(); filePath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); filePath = filePath + @"\" + GeneralInfo.Rows[0]["path_all_document"].ToString(); pathname = DXWindowsApplication2.MainForm.CombinePaths(filePath, "Reciept", GridTableCheckbox.Rows[i].Table.Rows[0]["rec_trans_number"].ToString() + ".pdf"); PrintReciept.loopGenDataRow(GridTableCheckbox.Rows[i]["rec_trans_id"].To<int>()); PrintReciept.CreateDocument(); //PrintReciept.ExportToPdf(pathname); //PrintReciept.ShowPreview(); report1.Pages.AddRange(PrintReciept.Pages); }else{ if (GridTableCheckbox.Rows[i]["rec_trans_category"].To<int>() == 1) { PrintDocuments.reciept_booking PrintReciept = new DXWindowsApplication2.PrintDocuments.reciept_booking(); GeneralInfo = BusinessLogicBridge.DataStore.getGeneralConfig(); filePath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); filePath = filePath + @"\" + GeneralInfo.Rows[0]["path_all_document"].ToString(); pathname = DXWindowsApplication2.MainForm.CombinePaths(filePath, "Reciept", GridTableCheckbox.Rows[i].Table.Rows[0]["rec_trans_number"].ToString() + ".pdf"); PrintReciept.loopGenDataRow(GridTableCheckbox.Rows[i]["rec_trans_id"].To<int>()); PrintReciept.CreateDocument(); //PrintReciept.ExportToPdf(pathname); //PrintReciept.ShowPreview(); report1.Pages.AddRange(PrintReciept.Pages); } else if (GridTableCheckbox.Rows[i]["rec_trans_category"].To<int>() == 2) { PrintDocuments.reciept_checkin PrintReciept = new DXWindowsApplication2.PrintDocuments.reciept_checkin(); GeneralInfo = BusinessLogicBridge.DataStore.getGeneralConfig(); filePath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); filePath = filePath + @"\" + GeneralInfo.Rows[0]["path_all_document"].ToString(); pathname = DXWindowsApplication2.MainForm.CombinePaths(filePath, "Reciept", GridTableCheckbox.Rows[i].Table.Rows[0]["rec_trans_number"].ToString() + ".pdf"); PrintReciept.loopGenDataRow(GridTableCheckbox.Rows[i]["rec_trans_id"].To<int>()); PrintReciept.CreateDocument(); //PrintReciept.ExportToPdf(pathname); //PrintReciept.ShowPreview(); report1.Pages.AddRange(PrintReciept.Pages); } else{ PrintDocuments.reciept PrintReciept = new DXWindowsApplication2.PrintDocuments.reciept(); GeneralInfo = BusinessLogicBridge.DataStore.getGeneralConfig(); filePath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); filePath = filePath + @"\" + GeneralInfo.Rows[0]["path_all_document"].ToString(); pathname = DXWindowsApplication2.MainForm.CombinePaths(filePath, "Reciept", GridTableCheckbox.Rows[i].Table.Rows[0]["rec_trans_number"].ToString() + ".pdf"); PrintReciept.loopGenDataRow(GridTableCheckbox.Rows[i]["rec_trans_id"].To<int>()); PrintReciept.CreateDocument(); //PrintReciept.ExportToPdf(pathname); //PrintReciept.ShowPreview(); report1.Pages.AddRange(PrintReciept.Pages); } } BusinessLogicBridge.DataStore.setRecieptPrint(GridTableCheckbox.Rows[i]["rec_trans_id"].To<int>()); } } report1.PrintingSystem.ContinuousPageNumbering = true; // Create a Print Tool and show the Print Preview form. ReportPrintTool printTool = new ReportPrintTool(report1); printTool.ShowPreviewDialog(); LoadListReciept(); }
private void bttPrint_Click(object sender, EventArgs e) { string pathname = ""; string filePath = ""; int _countCheckbox = 0; DataTable GeneralInfo = new DataTable(); DataTable GridTableCheckbox = new DataTable(); GridTableCheckbox = ((DataTable)gridControlInvoiceList.DataSource); XtraReport1 report1 = new XtraReport1(); report1.CreateDocument(); for (int i = 0; i < GridTableCheckbox.Rows.Count; i++) { if ((bool)(GridTableCheckbox.Rows[i]["checkbox"]) == true) { GeneralInfo = BusinessLogicBridge.DataStore.getGeneralConfig(); filePath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); filePath = filePath + @"\" + GeneralInfo.Rows[0]["path_all_document"].ToString(); pathname = DXWindowsApplication2.MainForm.CombinePaths(Environment.GetFolderPath(Environment.SpecialFolder.Personal), GeneralInfo.Rows[0]["path_all_document"].ToString(), "Invoice", GridTableCheckbox.Rows[i].Table.Rows[0]["inv_trans_number"].ToString() + ".pdf"); PrintDocuments.invoice PrintInvoice = new DXWindowsApplication2.PrintDocuments.invoice(); PrintInvoice.loopGenDataRow(GridTableCheckbox.Rows[i]["inv_trans_id"].To<int>()); //PrintInvoice.ExportToPdf(pathname); PrintInvoice.CreateDocument(); report1.Pages.AddRange(PrintInvoice.Pages); BusinessLogicBridge.DataStore.setInvoicePrint(GridTableCheckbox.Rows[i]["inv_trans_id"].To<int>()); _countCheckbox++; } } if (_countCheckbox <= 0) { MessageBox.Show("Please select item ..."); return; } report1.PrintingSystem.ContinuousPageNumbering = true; // Create a Print Tool and show the Print Preview form. ReportPrintTool printTool = new ReportPrintTool(report1); printTool.ShowPreviewDialog(); initLoadGridInvoice(); }