public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { RptCustomerMoney rpt = new RptCustomerMoney(); rpt.Site = this.Site; return(rpt); }
private void PrintOneCustomer() { string name = Convert.ToString(cbxCustomer.Text); DataTable tblRpt = new DataTable(); tblRpt.Clear(); tblRpt = db.readData("SELECT [Order_ID] as 'رقم الفاتورة',[Cus_Name] as 'العميل',[Price] as 'المبلغ المستحق',[Order_Date] as 'تاريخ الفاتورة',[Reminder_Date] as 'تاريخ الاستحقاق' FROM [dbo].[Customer_Money] where Cus_Name=N'" + name + "'", ""); try { Frm_Print frm = new Frm_Print(); frm.crystalReportViewer1.RefreshReport(); RptCustomerMoney rpt = new RptCustomerMoney(); rpt.SetDatabaseLogon("", "", @".\SQLEXPRESS", "Sales_System"); rpt.SetDataSource(tblRpt); rpt.SetParameterValue("Name", name); frm.crystalReportViewer1.ReportSource = rpt; System.Drawing.Printing.PrintDocument printDocument = new System.Drawing.Printing.PrintDocument(); rpt.PrintOptions.PrinterName = printDocument.PrinterSettings.PrinterName; //rpt.PrintToPrinter(1, true, 0, 0); frm.ShowDialog(); } catch (Exception) { } }