public void CargarDatos() { CargarID(); FORM102ATableAdapters.ingresosTableAdapter ingresos = new FORM102ATableAdapters.ingresosTableAdapter(); FORM102A.ingresosDataTable table = ingresos.GetIngresosContr(Convert.ToInt32(LblIdContr.Text)); FORM102A.ingresosRow ingresosRow = (FORM102A.ingresosRow)table.Rows[0]; FORM102ATableAdapters.gastosTableAdapter gastos = new FORM102ATableAdapters.gastosTableAdapter(); FORM102A.gastosDataTable table2 = gastos.GetGastosContr(Convert.ToInt32(LblIdContr.Text)); FORM102A.gastosRow gastosRow = (FORM102A.gastosRow)table2.Rows[0]; LblGastos.Text = gastosRow.valor_gast.ToString(); LblIngresos.Text = ingresosRow.valor_ingre.ToString(); impuesto = decimal.Parse(LblIngresos.Text) - decimal.Parse(LblGastos.Text); LblImpRenta.Text = impuesto.ToString(); }
private void btnGuardar_Click(object sender, EventArgs e) { IDContr(); decimal valorTotal; FORM102ATableAdapters.gastosTableAdapter gastos = new FORM102ATableAdapters.gastosTableAdapter(); valorTotal = decimal.Parse(txtAemp.Text) + decimal.Parse(txtLEProf.Text) + decimal.Parse(txtOLib.Text) + decimal.Parse(txtABInmu.Text) + decimal.Parse(txtGPEdu.Text) + decimal.Parse(txtGPSalud.Text) + decimal.Parse(txtGPAli.Text) + decimal.Parse(txtGPVest.Text) + decimal.Parse(txtGPVivi.Text) + decimal.Parse(txtRPDiscap.Text) + decimal.Parse(txtRPTEdad.Text); LblTotGast.Text = valorTotal.ToString(); try { gastos.InsertarGastos(Convert.ToInt32(LblIdContr.Text), valorTotal); MessageBox.Show("Gastos ingresados!"); }catch (Exception error) { MessageBox.Show(error.Message); } }