private void cbtaxcode_DropDownClosed(object sender, System.EventArgs e) { miscellenous mi = new miscellenous(); try { mi.TAX_CODE = cbtaxcode.Text; DataTable tax = mi.tax(); mi.REVENUE = cbrevenue.Text; DataTable d = mi.mixtax(); //Percentage Calculation For Received Amount decimal taxamountvalue = 0, taxamount = 0, totalamount = 0, receivedamountvalue = 0, receivedamount = 0, MISTAX = 0, MISAMOUNT = 0; decimal.TryParse(tax.Rows[0]["FACTOR"].ToString(), out taxamountvalue); decimal.TryParse(txtreceivedamt.Text, out receivedamountvalue); decimal.TryParse(d.Rows[0]["MIS_TAX_STRUCTURE"].ToString(), out MISTAX); if (decimal.TryParse(txtreceivedamt.Text, out receivedamount)) { taxamount = (receivedamount * taxamountvalue) / 100; MISAMOUNT = (receivedamount * MISTAX) / 100; totalamount = receivedamountvalue + taxamount + MISAMOUNT; txttaxamount.Text = taxamount.ToString(); txttotalamount.Text = totalamount.ToString(); } } catch (Exception) { MessageBox.Show("please check the revenue and taxcode"); } }
private void cbrevenue_DropDownClosed(object sender, EventArgs e) { try { miscellenous m = new miscellenous(); m.REVENUE = cbrevenue.Text; DataTable s = m.mixtax(); mixtax.Content = s.Rows[0]["MIS_TAX_STRUCTURE"].ToString(); } catch (Exception) { } }