private void dataGridViewSaleGrid_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var crp       = new Reports.SaleInvoiceReport();
            var dt        = new DataTable();
            var usedClass = new BasicClass();
            var form      = new PrintForm();

            if (e.ColumnIndex == 0)
            {
                if (e.RowIndex >= 0)
                {
                    string         InvoiceNo = dataGridViewSaleGrid.Rows[e.RowIndex].Cells["ColumnInvoiceNo"].Value.ToString();
                    SqlParameter[] param     = new SqlParameter[1];
                    param[0]       = new SqlParameter("@InvoiceNo", SqlDbType.Int);
                    param[0].Value = int.Parse(InvoiceNo);
                    dt             = usedClass.selectdata("Report_Select_SaleInvoice_usingInvoiceNo", param);
                    TextObject InvoicePayment = (TextObject)crp.ReportDefinition.Sections["Section1"].ReportObjects["Text7"];
                    InvoicePayment.Text = dataGridViewSaleGrid.Rows[e.RowIndex].Cells["ColumnInvoiceStatus"].Value.ToString();
                    TextObject InvoiceType = (TextObject)crp.ReportDefinition.Sections["Section1"].ReportObjects["Text17"];
                    InvoiceType.Text = "قائمة شراء";
                    crp.SetDataSource(dt);
                    form.crystalReportViewer1.ReportSource = crp;
                    form.ShowDialog();
                }
            }
        }
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            SaleInvoiceReport rpt = new SaleInvoiceReport();

            rpt.Site = this.Site;
            return(rpt);
        }
Beispiel #3
0
        private void dataGridViewBuyGridInvoice_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var crp       = new Reports.SaleInvoiceReport();
            var dt        = new DataTable();
            var usedClass = new BasicClass();
            var form      = new PrintForm();

            if (e.ColumnIndex == 0)
            {
                if (e.RowIndex >= 0)
                {
                    int            InvoiceNo = int.Parse(dataGridViewBuyGridInvoice.Rows[e.RowIndex].Cells["ColumnInvoiceNo"].Value.ToString());
                    SqlParameter[] param     = new SqlParameter[1];
                    param[0]       = new SqlParameter("@InvoiceNo", SqlDbType.Int);
                    param[0].Value = InvoiceNo;
                    dt             = usedClass.selectdata("Report_Select_SaleInvoice_usingInvoiceNo", param);
                    if (dt.Rows.Count > 0)
                    {
                        string y = string.Concat(crp.DataDefinition.FormulaFields["ItemQuantity"].Text, "*-1");
                        crp.DataDefinition.FormulaFields["ItemQuantity"].Text = y;
                        TextObject InvoicePayment = (TextObject)crp.ReportDefinition.Sections["Section1"].ReportObjects["Text7"];
                        InvoicePayment.Text = dataGridViewBuyGridInvoice.Rows[e.RowIndex].Cells["ColumnInvoiceStatus"].Value.ToString();
                        TextObject InvoiceType = (TextObject)crp.ReportDefinition.Sections["Section1"].ReportObjects["Text17"];
                        InvoiceType.Text = "قائمة بيع";

                        crp.SetDataSource(dt);
                        form.crystalReportViewer1.ReportSource = crp;
                        form.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("لا توجد بيانات لعرضها", "MESSAGE");
                    }
                }
            }
        }