Click here to Skip to main content
15,879,095 members
Please Sign up or sign in to vote.
4.00/5 (2 votes)
See more:
i am working on inventory , i want to change my amount on run time mean

Rate* Quantiy=Amount
so i want to change my amount on run time after multiplying , pleas giude me as son as possible
my code is given below



C#
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());
                }
            }
        }



    }
Posted

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900