public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { RptTaxesReportsammury rpt = new RptTaxesReportsammury(); rpt.Site = this.Site; return(rpt); }
private void PrintSummary() { string date1; string date2; date1 = DtpFrom.Value.ToString("dd/MM/yyyy"); date2 = DtpTo.Value.ToString("dd/MM/yyyy"); DataTable tblRpt = new DataTable(); tblRpt.Clear(); tblRpt = db.readData("select ISNULL( sum(Total_Order) , 0) as 'اجمالى فواتير المبيعات' ,ISNULL(sum (Total_Tax) ,0) as 'قيمه الضرائب مبيعات' ,ISNULL( Sum(Total_AfterTax) , 0 ) as 'السعر بعد الضرايب مبيعات' from Taxes_Report where Order_Type =N'فاتورة مبيعات' and Convert(date,Date ,105 ) between '" + date1 + "' and '" + date2 + "' ", ""); try { Frm_Print frm = new Frm_Print(); frm.crystalReportViewer1.RefreshReport(); RptTaxesReportsammury rpt = new RptTaxesReportsammury(); rpt.SetDatabaseLogon("", "", @".\SQLEXPRESS", "Sales_System"); rpt.SetDataSource(tblRpt); rpt.SetParameterValue("@FromSale", date1); rpt.SetParameterValue("@ToSale", date2); rpt.SetParameterValue("@FromBuy", date1); rpt.SetParameterValue("@ToBuy", date2); rpt.SetParameterValue("@FromReturnSale", date1); rpt.SetParameterValue("@ToReturnSale", date2); rpt.SetParameterValue("@FromReturnBuy", date1); rpt.SetParameterValue("@ToReturnBuy", date2); 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) { } }