private void gridView1_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
{
if (gridView1.RowCount > 0 && e.RowHandle >= 0)
{
if (gridView1.FocusedColumn.FieldName == "kunZs" || gridView1.FocusedColumn.FieldName == "Zzl" || gridView1.FocusedColumn.FieldName == "mperz")
{
try
{
int handle = e.RowHandle;
if (radioGroup2.SelectedIndex == 0)
{
decimal zzl = Convert.ToDecimal(this.gridView1.GetRowCellValue(handle, gridView1.Columns["Zzl"]));
int kunzs = Convert.ToInt32(this.gridView1.GetRowCellValue(handle, gridView1.Columns["kunZs"])); decimal tdQty = Convert.ToInt32(this.gridView1.GetRowCellValue(handle, gridView1.Columns["提单数量"]));
int zj = Convert.ToInt32(tdQty / kunzs / zzl);
decimal sj = tdQty % (kunzs * zzl);
decimal kunZl = kunzs * zzl;
this.gridView1.GetDataRow(handle)["整件"] = zj.ToString();
this.gridView1.GetDataRow(handle)["散件"] = zj.ToString();
this.gridView1.GetDataRow(handle)["kunZl"] = zj.ToString();
}
else
{
int kunzs = Convert.ToInt32(this.gridView1.GetRowCellValue(handle, gridView1.Columns["kunZs"])); decimal mperz = Convert.ToDecimal(this.gridView1.GetRowCellValue(handle, gridView1.Columns["mperz"]));
decimal tdQty = Convert.ToInt32(this.gridView1.GetRowCellValue(handle, gridView1.Columns["提单数量"]));
int zj = Convert.ToInt32(tdQty / kunzs / mperz);
decimal sj = tdQty % (kunzs * mperz);
decimal mperkun = kunzs * mperz;
this.gridView1.GetDataRow(handle)["整件"] = zj.ToString();
this.gridView1.GetDataRow(handle)["散件"] = zj.ToString();
this.gridView1.GetDataRow(handle)["mperkun"] = zj.ToString();
}
}
catch { }
}
}
}
{
if (gridView1.RowCount > 0 && e.RowHandle >= 0)
{
if (gridView1.FocusedColumn.FieldName == "kunZs" || gridView1.FocusedColumn.FieldName == "Zzl" || gridView1.FocusedColumn.FieldName == "mperz")
{
try
{
int handle = e.RowHandle;
if (radioGroup2.SelectedIndex == 0)
{
decimal zzl = Convert.ToDecimal(this.gridView1.GetRowCellValue(handle, gridView1.Columns["Zzl"]));
int kunzs = Convert.ToInt32(this.gridView1.GetRowCellValue(handle, gridView1.Columns["kunZs"])); decimal tdQty = Convert.ToInt32(this.gridView1.GetRowCellValue(handle, gridView1.Columns["提单数量"]));
int zj = Convert.ToInt32(tdQty / kunzs / zzl);
decimal sj = tdQty % (kunzs * zzl);
decimal kunZl = kunzs * zzl;
this.gridView1.GetDataRow(handle)["整件"] = zj.ToString();
this.gridView1.GetDataRow(handle)["散件"] = zj.ToString();
this.gridView1.GetDataRow(handle)["kunZl"] = zj.ToString();
}
else
{
int kunzs = Convert.ToInt32(this.gridView1.GetRowCellValue(handle, gridView1.Columns["kunZs"])); decimal mperz = Convert.ToDecimal(this.gridView1.GetRowCellValue(handle, gridView1.Columns["mperz"]));
decimal tdQty = Convert.ToInt32(this.gridView1.GetRowCellValue(handle, gridView1.Columns["提单数量"]));
int zj = Convert.ToInt32(tdQty / kunzs / mperz);
decimal sj = tdQty % (kunzs * mperz);
decimal mperkun = kunzs * mperz;
this.gridView1.GetDataRow(handle)["整件"] = zj.ToString();
this.gridView1.GetDataRow(handle)["散件"] = zj.ToString();
this.gridView1.GetDataRow(handle)["mperkun"] = zj.ToString();
}
}
catch { }
}
}
}
原创地址:http://blog.csdn.net/jameshelong/article/details/52023206