示例#1
0
        private void تعديلالفاتورةToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ContractSales conFrm = new ContractSales();

            BL.ProfitsClass pr = new BL.ProfitsClass();
            DataTable       d  = new DataTable();

            d = con.GetDetailsByOrderID(Convert.ToInt32(this.dataGridView1.CurrentRow.Cells[0].Value.ToString()));
            conFrm.ConID.Text     = this.dataGridView1.CurrentRow.Cells[0].Value.ToString();
            conFrm.Con_date.Value = (DateTime)this.dataGridView1.CurrentRow.Cells[1].Value;
            conFrm.Con_user.Text  = this.dataGridView1.CurrentRow.Cells[5].Value.ToString();
            conFrm.ConNote.Text   = this.dataGridView1.CurrentRow.Cells[4].Value.ToString();
            conFrm.custId.Text    = this.dataGridView1.CurrentRow.Cells[2].Value.ToString();
            conFrm.Total.Text     = this.dataGridView1.CurrentRow.Cells[6].Value.ToString();
            if (this.dataGridView1.CurrentRow.Cells[7].Value.ToString() != string.Empty)
            {
                conFrm.debit.Text = this.dataGridView1.CurrentRow.Cells[7].Value.ToString();
                conFrm.paid.Text  = Convert.ToString(Convert.ToDouble(this.dataGridView1.CurrentRow.Cells[6].Value.ToString()) - Convert.ToDouble(this.dataGridView1.CurrentRow.Cells[7].Value.ToString()));
            }
            conFrm.PricePrev = Convert.ToDouble(pr.GetProfitPeforeUpdating(Convert.ToInt32(this.dataGridView1.CurrentRow.Cells[0].Value.ToString())).Rows[0][0].ToString());

            conFrm.dataGridView1.DataSource = d;
            conFrm.Text                 = " :تحديث بيانات الفاتورة المحددة " + this.dataGridView1.CurrentRow.Cells[0].Value.ToString();
            conFrm.SaveSale.Text        = "تحديث";
            conFrm.ConState             = "edit";
            conFrm.newSale.Enabled      = false;
            conFrm.Print.Enabled        = false;
            conFrm.choosebtn.Enabled    = false;
            conFrm.CustChoosBtn.Enabled = false;
            conFrm.SetDatatableForUpdate(d);
            conFrm.SaveSale.Enabled = true;
            // conFrm.paid.ReadOnly = true;
            conFrm.حذفالسطرالحاليToolStripMenuItem.Enabled = false;
            conFrm.حذفالكلToolStripMenuItem.Enabled        = false;

            conFrm.ShowDialog();
            if (conFrm.closed)
            {
                this.dataGridView1.DataSource         = con.SearchOrders(textSearch.Text);
                this.dataGridView1.Columns[2].Visible = false;
            }
        }