| Sno | Product name | dec | QTY | Unit Price | Tax | Total-Amount | |
| 1 | mobile | no | 2 | 5000 | 10 | 11000 | |
| 2 | ABC | no | 1 | 500 | 10 | 550 | |
| Gridview Records |
Database save Records
| sno | Product name | dec | QTY | Unit_Price | Tax | Total_Amount | Tax_Amount | Grand_Total_Amount | |
| 1 | mobile | no | 2 | 5000 | 10 | 10000 | 1000 | 11000 | |
| 2 | ABC | no | 1 | 500 | 10 | 500 | 50 | 550 | |
| 0 | 0 | 0 | 0 | 0 | 0 | 10500 | 1050 | 11550 |
private void addbutton_Click(object sender, EventArgs e)
{
if (producttxt.Text != "" && dectxt.Text != "" && qtytxtprice.Text != "" && txtqty.Text != "" && txttax.Text != "")
{
int Qty = Convert.ToInt32(txtqty.Text);
decimal Unit_Price = Convert.ToDecimal(qtytxtprice.Text);
decimal Tax = Convert.ToDecimal(txttax.Text);
decimal Amount = (Qty * Unit_Price);
decimal PercentageAmount = ((Amount * Tax) / 100);
decimal TotalAmount = Amount + PercentageAmount;
int Sno = dataGridView.Rows.Count ;
dataGridView.Rows.Add(Sno, producttxt.Text, dectxt.Text, txtqty.Text, qtytxtprice.Text, txttax.Text, TotalAmount);
btnclr_Click(sender, e);
CalculateTotalAmount();
ClearData();
}
}
public void CalculateTotalAmount()
{
decimal taxtotal=0;
decimal totalamount=0;
for(int i=0;i
{
decimal TotalAmount = (Convert.ToDecimal(dataGridView.Rows[i].Cells[3].Value) * Convert.ToDecimal(dataGridView.Rows[i].Cells[4].Value));
taxtotal=taxtotal+((Convert.ToDecimal(dataGridView.Rows[i].Cells[5].Value)*TotalAmount)/100);
totalamount=totalamount+Convert.ToDecimal(dataGridView.Rows[i].Cells[6].Value);
}
TotalTaxtxt.Text=taxtotal.ToString(); //tax total amount text box field value setting
totalamounttxt.Text=totalamount.ToString(); //total amount text box field value setting
}


Rafnas T PRank #280 · 8.8K reputationPosted Apr 17, 2017, 3:29 AM EDT
Nitin SontakkeRank #264 · 9.6K reputationPosted Apr 11, 2017, 10:20 PM EDT
Jyoti JodhaRank #1,408 · 1.2K reputationPosted Apr 11, 2017, 10:31 PM EDT
Karthi KeyanRank #1,926 · 762 reputationPosted Apr 12, 2017, 1:11 AM EDT
Jyoti JodhaRank #1,408 · 1.2K reputationPosted Apr 12, 2017, 1:12 AM EDT
Karthi KeyanRank #1,926 · 762 reputationPosted Apr 12, 2017, 1:50 AM EDT
Karthi KeyanRank #1,926 · 762 reputationPosted Apr 17, 2017, 12:51 AM EDT
Jyoti JodhaRank #1,408 · 1.2K reputationPosted Apr 17, 2017, 2:34 AM EDT