private void dgDetail_CellEndEdit(object sender, DataGridViewCellEventArgs e) { if (dgDetail.CurrentRow != null) { if (dgDetail.CurrentRow.Cells["Qty"].Value != null && dgDetail.CurrentRow.Cells["Rate"].Value != null) { if (dgDetail.CurrentRow.Cells["Qty"].Value != null && dgDetail.CurrentRow.Cells["Qty"].Value.ToString().Trim() != "" && Convert.ToDecimal(dgDetail.CurrentRow.Cells["Qty"].Value) > 0) { decimal GAmount = Convert.ToDecimal(dgDetail.CurrentRow.Cells["Rate"].Value.ToString()) * Convert.ToDecimal(dgDetail.CurrentRow.Cells["Qty"].Value.ToString()); dgDetail.CurrentRow.Cells["Amount"].Value = Convert.ToDecimal(GAmount); if (dgDetail.CurrentRow.Cells["STPercent"].Value != null) { dgDetail.CurrentRow.Cells["SaleTax"].Value = GAmount / 100 * Convert.ToDecimal(dgDetail.CurrentRow.Cells["STPercent"].Value.ToString()); if (dgDetail.CurrentRow.Cells["OtherSTP"].Value != null) { dgDetail.CurrentRow.Cells["OtherST"].Value = GAmount / 100 * Convert.ToDecimal(dgDetail.CurrentRow.Cells["OtherSTP"].Value.ToString()); dgDetail.CurrentRow.Cells["Total"].Value = GAmount + Convert.ToDecimal(dgDetail.CurrentRow.Cells["SaleTax"].Value.ToString()) + Convert.ToDecimal(dgDetail.CurrentRow.Cells["OtherST"].Value.ToString()); } } } //} } } // } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)