예제 #1
0
        private void txt_CodigoBarra_TextChanged(object sender, EventArgs e)
        {
            cFunciones fun = new cFunciones();

            if (txt_CodigoBarra.Text.Length > 5)
            {
                string    CodigoBarra = txt_CodigoBarra.Text;
                cJuguete  art         = new Clases.cJuguete();
                DataTable trdo        = art.GetJuguetexCodBarra(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_PorEfe.Text != "")
                        {
                            txt_PorEfe.Text = fun.SepararDecimales(txt_PorEfe.Text);
                        }

                        if (txt_PorTar.Text != "")
                        {
                            txt_PorTar.Text = fun.SepararDecimales(txt_PorTar.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();
            }
        }
예제 #2
0
        private void BuscarJuguetexCodigoBarra()
        {
            int b = 0;

            if (txt_CodigoBarra.Text.Length > 7)
            {
                string    CodigoBarra = txt_CodigoBarra.Text;
                cJuguete  art         = new Clases.cJuguete();
                DataTable trdo        = art.GetJuguetexCodBarra(CodigoBarra);
                if (trdo.Rows.Count > 0)
                {
                    if (trdo.Rows[0]["CodArticulo"].ToString() != "")
                    {
                        b = 1;
                        txtCodigo.Text        = trdo.Rows[0]["CodArticulo"].ToString();
                        txtNombreJuguete.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();
                        txtPrecio.Text        = trdo.Rows[0]["Costo"].ToString();
                        txtPorEfe.Text        = trdo.Rows[0]["PorEfe"].ToString();
                        txtPorTar.Text        = trdo.Rows[0]["PorTar"].ToString();
                        if (txtPrecio.Text != "")
                        {
                            txtPrecio.Text = fun.SepararDecimales(txtPrecio.Text);
                        }
                        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();
                }
            }
        }