Esempio n. 1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            RptBuyReport rpt = new RptBuyReport();

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

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

            DataTable tblRpt = new DataTable();

            tblRpt.Clear();
            tblRpt = db.readData("SELECT [Order_ID] as 'رقم الفاتورة',Suppliers.Sup_Name as 'اسم المورد',Products.Pro_Name as 'اسم المنتج',[Date] as 'تاريخ الفاتورة',[Buy_Detalis].[Qty] as 'الكمية' ,Unit_Name as 'الوحدة',[Price] as 'السعر قبل الضريبة',[Buy_Detalis].Tax_Value as 'الضريبة',Price_Tax as 'السعر بعد الضريبة',[Discount] as 'الخصم',[Total] as 'اجمالى الصنف',[TotalOrder] as 'الاجمالى العام',[User_Name] as 'اسم المستخدم' ,[Madfou3] as 'المدفوع',[Baky] as 'المبلغ المتبقى' FROM [dbo].[Buy_Detalis],Suppliers,Products where  Suppliers.Sup_ID =[Buy_Detalis].Sup_ID and Products.Pro_ID =[Buy_Detalis].Pro_ID and Convert(date,Date ,105 ) between '" + date1 + "' and '" + date2 + "' ORDER BY Order_ID ASC", "");
            try
            {
                Frm_Print frm = new Frm_Print();

                frm.crystalReportViewer1.RefreshReport();

                RptBuyReport rpt = new RptBuyReport();


                //rpt.SetDatabaseLogon(Properties.Settings.Default.USERNAME, Properties.Settings.Default.DATABASEPASSWORD, @".\SQLEXPRESS", "Sales_System");

                rpt.DataSourceConnections[0].IntegratedSecurity = false;
                rpt.DataSourceConnections[0].SetConnection(Properties.Settings.Default.SERVERNAME, "SalesSystem", "admin", "123");

                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) { }
        }