private void Print()
        {
            int       id     = Convert.ToInt32(txtID.Text);
            DataTable tblRpt = new DataTable();

            tblRpt.Clear();
            tblRpt = db.readData("SELECT [Order_ID] as 'رقم العملية' ,[Name] as 'اسم المسؤل عن القبض',[Price] as 'المبلغ',[Date] as 'تاريخ العملية',[From_] as 'تم القبض من ',[Reason] as 'السبب' FROM [dbo].[Sanad_Kabd] where Order_ID=" + id + "", "");
            try
            {
                Frm_Print frm = new Frm_Print();

                frm.crystalReportViewer1.RefreshReport();

                RptSanadKabd rpt = new RptSanadKabd();


                rpt.SetDatabaseLogon("", "", @".\SQLEXPRESS", "Sales_System");
                rpt.SetDataSource(tblRpt);
                rpt.SetParameterValue("ID", id);
                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) { }
        }
예제 #2
0
        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();

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

                frm.crystalReportViewer1.RefreshReport();

                RptSalesReport rpt = new RptSalesReport();


                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) { }
        }
예제 #3
0
        private void Print()
        {
            int       id     = Convert.ToInt32(DgvSearch.CurrentRow.Cells[0].Value);
            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 'الوحدة',[User_Name] as 'اسم المستخدم',[Price] as 'السعر قبل الضريبة',[Buy_Detalis].Tax_Value as 'الضريبة',Price_Tax as 'السعر بعد الضريبة',[Discount] as 'الخصم',[Total] as 'اجمالى الصنف',[TotalOrder] 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 Order_ID =" + id + "", "");
            try
            {
                Frm_Print frm = new Frm_Print();

                frm.crystalReportViewer1.RefreshReport();

                if (Properties.Settings.Default.BuyPrintKind == "8CM")
                {
                    RptOrderBuy rpt = new RptOrderBuy();
                    rpt.SetDatabaseLogon("", "", @".\SQLEXPRESS", "Sales_System");
                    rpt.SetDataSource(tblRpt);
                    rpt.SetParameterValue("ID", id);
                    frm.crystalReportViewer1.ReportSource = rpt;

                    System.Drawing.Printing.PrintDocument printDocument = new System.Drawing.Printing.PrintDocument();
                    rpt.PrintOptions.PrinterName = Properties.Settings.Default.PrinterName;
                    //rpt.PrintToPrinter(1, true, 0, 0);
                    frm.ShowDialog();
                }
                else if (Properties.Settings.Default.BuyPrintKind == "A4")
                {
                    RptOrderBuyA4 rpt = new RptOrderBuyA4();
                    rpt.SetDatabaseLogon("", "", @".\SQLEXPRESS", "Sales_System");
                    rpt.SetDataSource(tblRpt);
                    rpt.SetParameterValue("ID", id);
                    frm.crystalReportViewer1.ReportSource = rpt;

                    System.Drawing.Printing.PrintDocument printDocument = new System.Drawing.Printing.PrintDocument();
                    rpt.PrintOptions.PrinterName = Properties.Settings.Default.PrinterName;
                    rpt.PrintToPrinter(1, true, 0, 0);
                    //frm.ShowDialog();
                }
            }
            catch (Exception) { }
        }
예제 #4
0
        private void Print()
        {
            int       id     = Convert.ToInt32(txtID.Text);
            DataTable tblRpt = new DataTable();

            tblRpt.Clear();
            tblRpt = db.readData("SELECT [Order_ID] as 'رقم الفاتورة',[Cust_Name] as 'اسم العميل',Products.Pro_Name as 'المنتج',[Sales_Detalis].[Qty] as 'الكمية',Unit as 'الوحدة',[Price_Tax] as 'السعر شامل الضريب',[Discount] as 'الخصم',[Total] as 'الاجمالى',[TotalOrder] as 'اجمالى الفاتورة',[Madfou3] as 'المبلغ المدفوع',[Baky] as 'المتبقى',[User_Name] as 'الكاشير',[Date] as 'التاريخ',[Sales_Detalis].Tax_Value as'الضريبة' FROM [dbo].[Sales_Detalis] , Products where Products.Pro_ID = Sales_Detalis.Pro_ID and Order_ID=" + id + "", "");
            try
            {
                Frm_Print frm = new Frm_Print();

                frm.crystalReportViewer1.RefreshReport();
                if (Properties.Settings.Default.SalePrintKind == "8CM")
                {
                    RptOrderSales rpt = new RptOrderSales();
                    rpt.SetDatabaseLogon("", "", Properties.Settings.Default.SERVERNAME, "Sales_System");
                    rpt.SetDataSource(tblRpt);
                    rpt.SetParameterValue("ID", id);
                    frm.crystalReportViewer1.ReportSource = rpt;

                    System.Drawing.Printing.PrintDocument printDocument = new System.Drawing.Printing.PrintDocument();
                    rpt.PrintOptions.PrinterName = Properties.Settings.Default.PrinterName;
                    // rpt.PrintToPrinter(1, true, 0, 0);
                    frm.ShowDialog();
                }
                else if (Properties.Settings.Default.SalePrintKind == "A4")
                {
                    RptOrderSalesA4 rpt = new RptOrderSalesA4();
                    rpt.SetDatabaseLogon("", "", @".\SQLEXPRESS", "Sales_System");
                    rpt.SetDataSource(tblRpt);
                    rpt.SetParameterValue("ID", id);
                    frm.crystalReportViewer1.ReportSource = rpt;

                    System.Drawing.Printing.PrintDocument printDocument = new System.Drawing.Printing.PrintDocument();
                    rpt.PrintOptions.PrinterName = Properties.Settings.Default.PrinterName;
                    // rpt.PrintToPrinter(1, true, 0, 0);
                    frm.ShowDialog();
                }
            }
            catch (Exception) { }
        }
        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) { }
        }
        private void btnPrintPreview_Click(object sender, EventArgs e)
        {
            if (txtBarcode.Text == "" || txtProName.Text == "" || txtSalesPrice.Text == "")
            {
                MessageBox.Show("من فضلك اكمل البيانات", "تاكيد");
                return;
            }
            DataSet1 DS = new DataSet1();

            DS.Clear();
            RptCrystalReport rpt = new RptCrystalReport();

            DS.Tables["PrintBarcode"].Rows.Add(txtProName.Text, txtBarcode.Text, txtSalesPrice.Text, "*" + txtBarcode.Text.Trim() + "*");
            //decimal count = 0;
            //try {
            //    count =Convert.ToDecimal( db.readData("select * from Barcode_Print", "").Rows[0][0]);

            //} catch (Exception) { }
            //if (count >= 1)
            //{
            //    db.exceuteData("update Barcode_Print set Pro_Name=N'"+txtProName.Text+ "' ,Pro_Barcode=N'"+txtBarcode.Text+ "' ,Pro_Price=N'"+txtSalesPrice.Text+"' ,barcode=N'"+txtBarcode.Text+"'", "");
            //}else
            //{
            //    db.exceuteData("insert into Barcode_Print values(N'" + txtProName.Text + "' ,N'" + txtBarcode.Text + "' ,N'" + txtSalesPrice.Text + "' ,N'" + txtBarcode.Text + "')", "");

            //}
            //DataTable tblS = new DataTable();
            //tblS.Clear();
            //tblS = db.readData("select * from Barcode_Print", "");

            rpt.SetDataSource(DS);

            Frm_Print frm = new Frm_Print();

            frm.crystalReportViewer1.ReportSource = rpt;
            frm.crystalReportViewer1.Refresh();
            frm.ShowDialog();
            Properties.Settings.Default.Pro_Barcode = txtBarcode.Text;
            Properties.Settings.Default.Save();
            db.exceuteData("update Products set Barcode=N'" + txtBarcode.Text + "' where Pro_Name=N'" + txtProName.Text + "'", "");
        }
예제 #7
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) { }
        }
        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) { }
        }