private void BuscarLibreriaxCodigoBarra() { int b = 0; if (txt_CodigoBarra.Text.Length > 7) { string CodigoBarra = txt_CodigoBarra.Text; cArticulo art = new cArticulo(); DataTable trdo = art.GetArticuloxCodigoBarra(CodigoBarra); if (trdo.Rows.Count > 0) { if (trdo.Rows[0]["CodArticulo"].ToString() != "") { b = 1; txtCodigo.Text = trdo.Rows[0]["CodArticulo"].ToString(); txt_Nombre.SelectedValue = txtCodigo.Text; txt_CodigoBarra.Text = trdo.Rows[0]["CodigoBarra"].ToString(); txt_Codigo.Text = trdo.Rows[0]["Codigo"].ToString(); txt_Stock.Text = trdo.Rows[0]["Stock"].ToString(); txtPrecio.Text = trdo.Rows[0]["Costo"].ToString(); txtPrecio.Text = trdo.Rows[0]["Costo"].ToString(); txtPorEfe.Text = trdo.Rows[0]["PorEfe"].ToString(); txtPorTar.Text = trdo.Rows[0]["PorTar"].ToString(); if (trdo.Rows[0]["Costo"].ToString() != "") { Double Costo = Math.Round(Convert.ToDouble(trdo.Rows[0]["Costo"]), 0); txtPrecio.Text = Costo.ToString(); CalcularPrecioTarjetaEfectivo(Costo); } if (txtPorEfe.Text != "") { txtPorEfe.Text = fun.SepararDecimales(txtPorEfe.Text); } if (txtPorTar.Text != "") { txtPorTar.Text = fun.SepararDecimales(txtPorTar.Text); } } } if (b == 1) { PuedeAgregar = false; txtCantidad.Text = ""; txtCantidad.Focus(); } } }
private void txt_CodigoBarra_TextChanged(object sender, EventArgs e) { cFunciones fun = new cFunciones(); if (txt_CodigoBarra.Text.Length > 5) { string CodigoBarra = txt_CodigoBarra.Text; cArticulo art = new cArticulo(); DataTable trdo = art.GetArticuloxCodigoBarra(CodigoBarra); if (trdo.Rows.Count > 0) { if (trdo.Rows[0]["CodArticulo"].ToString() != "") { txtCodigo.Text = trdo.Rows[0]["CodArticulo"].ToString(); txt_Nombre.Text = trdo.Rows[0]["Nombre"].ToString(); txt_CodigoBarra.Text = trdo.Rows[0]["CodigoBarra"].ToString(); txt_Codigo.Text = trdo.Rows[0]["Codigo"].ToString(); txt_Stock.Text = trdo.Rows[0]["Stock"].ToString(); txt_Costo.Text = trdo.Rows[0]["Costo"].ToString(); txt_PrecioEfectivo.Text = trdo.Rows[0]["PrecioEfectivo"].ToString(); txt_PrecioTarjeta.Text = trdo.Rows[0]["PrecioTarjeta"].ToString(); txt_PorEfe.Text = trdo.Rows[0]["PorEfe"].ToString(); txt_PorTar.Text = trdo.Rows[0]["PorTar"].ToString(); if (txt_Costo.Text != "") { txt_Costo.Text = fun.SepararDecimales(txt_Costo.Text); } if (txt_PorTar.Text != "") { txt_PorTar.Text = fun.SepararDecimales(txt_PorTar.Text); } if (txt_PorEfe.Text != "") { txt_PorEfe.Text = fun.SepararDecimales(txt_PorEfe.Text); } } } else {/* * txtCodigo.Text = ""; * txt_Nombre.Text = ""; * txt_Stock.Text = ""; * txt_Costo.Text = ""; * txt_PrecioEfectivo.Text = ""; * txt_PrecioTarjeta.Text = ""; * txt_Codigo.Text = "";*/ } } if (txt_PrecioEfectivo.Text != "") { Double Efectivo = Convert.ToDouble(txt_PrecioEfectivo.Text.Replace(".", ",")); txt_PrecioEfectivo.Text = Math.Round(Efectivo, 0).ToString(); } if (txt_PrecioTarjeta.Text != "") { Double Efectivo = Convert.ToDouble(txt_PrecioTarjeta.Text.Replace(".", ",")); txt_PrecioTarjeta.Text = Math.Round(Efectivo, 0).ToString(); } }