private void EditJE(KeyEventArgs e) { if (e.Control) { if (this.dataGridView.CurrentRow != null) { Form_edit_je f = new Form_edit_je(); DataGridViewRow row = this.dataGridView.CurrentRow; //原金額 f.yje = float.Parse(row.Cells[5].Value.ToString()); if (f.ShowDialog(this) == DialogResult.OK) { int sl = int.Parse(row.Cells[4].Value.ToString()); float sj = float.Parse(row.Cells[2].Value.ToString()); float je = f.xje / sl; float zq = je / sj; row.Cells[3].Value = zq.ToString("0.00"); //現金額 row.Cells[5].Value = Math.Round(f.xje, 0, MidpointRounding.AwayFromZero).ToString("0.00"); this.MergeSameRows(row); } } } }
private void EditGoodsZQ(KeyEventArgs e) { if (e.Control) { if (this.dataGridView.CurrentRow != null) { Form_edit_je f = new Form_edit_je(); f.Text = "修改折扣"; DataGridViewRow row = this.dataGridView.CurrentRow; f.yje = float.Parse(row.Cells[3].Value.ToString()); if (f.ShowDialog(this) == DialogResult.OK) { float sj = float.Parse(row.Cells[2].Value.ToString()); int sl = int.Parse(row.Cells[4].Value.ToString()); float je = sj * sl * f.xje; je = (float)Math.Round(je, 0, MidpointRounding.AwayFromZero); row.Cells[3].Value = f.xje.ToString("0.00"); // 新折扣 row.Cells[5].Value = je.ToString("0.00"); //更新金额 this.MergeSameRows(row); } } } }