public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            RptTaxesReport rpt = new RptTaxesReport();

            rpt.Site = this.Site;
            return(rpt);
        }
        private void PrintAll()
        {
            string date1;
            string date2;

            date1 = DtpFrom.Value.ToString("dd/MM/yyyy");
            date2 = DtpTo.Value.ToString("dd/MM/yyyy");

            DataTable tblRpt = new DataTable();
            string    sale = "فاتورة مبيعات", buy = "فاتورة مشتريات", returnSale = "مرتجعات مبيعات", returnBuy = "مرتجعات مشتريات";

            if (checkSale.Checked == true)
            {
                sale = "فاتورة مبيعات";
            }
            else
            {
                sale = "";
            }
            if (checkBuy.Checked == true)
            {
                buy = "فاتورة مشتريات";
            }
            else
            {
                buy = "";
            }
            if (checkSaleReturn.Checked == true)
            {
                returnSale = "مرتجعات مبيعات";
            }
            else
            {
                returnSale = "";
            }
            if (checkBuyReturn.Checked == true)
            {
                returnBuy = "مرتجعات مشتريات";
            }
            else
            {
                returnBuy = "";
            }
            tblRpt.Clear();
            tblRpt = db.readData("SELECT [Order_ID] as 'رقم العملية',[Order_Num] as 'رقم الفاتورة',[Order_Type] as 'نوع العملية',[Tax_Type] as 'نوع الضريبة',[Sup_Name] as 'اسم المورد',[Cust_Name] as 'اسم العميل',[Total_Order] as 'اجمالى الفاتورة قبل الضريبة',[Total_Tax] as 'اجمالى الضريبة',[Total_AfterTax] as 'اجمالى الفاتورة بعد الضريبة',[Date] as 'التاريخ' FROM [dbo].[Taxes_Report] where Order_Type in (N'" + sale + "' ,N'" + buy + "' ,N'" + returnSale + "' ,N'" + returnBuy + "') and Convert(date,Date ,105 ) between '" + date1 + "' and '" + date2 + "' ", "");
            try
            {
                Frm_Print frm = new Frm_Print();

                frm.crystalReportViewer1.RefreshReport();

                RptTaxesReport rpt = new RptTaxesReport();


                rpt.SetDatabaseLogon("", "", @".\SQLEXPRESS", "Sales_System");
                rpt.SetDataSource(tblRpt);

                rpt.SetParameterValue("From", date1);
                rpt.SetParameterValue("To", 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) { }
        }