Jyoti Jodha

Jyoti Jodha

  • NA
  • 1.7k
  • 396.9k

how to add discount column in gridview c# windows form

Jun 10 2017 4:15 AM
how to add discount column in gridview c# windows application
 
decimal Qty = Convert.ToDecimal(txtqty.Text);
decimal Unit_Price = Convert.ToDecimal(qtytxtprice.Text);
decimal Tax = Convert.ToDecimal(txttax.SelectedValue);
decimal Amount = (Qty * Unit_Price);
decimal PercentageAmount = ((Amount * Tax) / 100);
decimal TotalAmount = Amount + PercentageAmount;
 
 
public void CalculateTotalAmount()
{
decimal taxtotal=0;
decimal totalamount=0;
for(int i=0;i<dataGridView.Rows.Count;i++)
{
decimal TotalAmount = (Convert.ToDecimal(dataGridView.Rows[i].Cells[4].Value) * Convert.ToDecimal(dataGridView.Rows[i].Cells[6].Value));
taxtotal = taxtotal + ((Convert.ToDecimal(dataGridView.Rows[i].Cells[7].Value)*TotalAmount)/100); totalamount=totalamount+ TotalAmount;
}
TotalTaxtxt.Text=taxtotal.ToString();
totalamounttxt.Text=totalamount.ToString();
_subTotal = taxtotal + totalamount;
txtNewTotal.Text = (_subTotal).ToString();
Subtxt.Text = (_subTotal).ToString();
CalcDiscountShopCost();
}
 
 
 
 
 

Answers (3)