private void Codigo_textbox_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == (char)Keys.Enter)
     {
         //Buscare el producto dentro de la lista de detalle
         bool productoEncontrado = false;
         foreach (Detalle temp in ticket)
         {
             if (temp.id_producto.Equals(Codigo_textbox.Text) && temp.cantidad != 0)
             {
                 productoEncontrado = true;
                 break;
             }
         }
         if (productoEncontrado)
         {
             Codigo_textbox.Enabled   = false;
             cantidad_textbox.Enabled = true;
             cantidad_textbox.Focus();
         }
         else
         {
             MessageBox.Show("Producto no encontrado.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
             Codigo_textbox.Focus();
             Codigo_textbox.SelectionStart  = 0;
             Codigo_textbox.SelectionLength = Codigo_textbox.Text.Length;
         }
     }
 }
Beispiel #2
0
 private void Compras_form_Load(object sender, EventArgs e)
 {
     Codigo_textbox.Focus();
     dataGridView1.DataSource = null;
     // productos = new DAOProductos().GetProducts();
     //dataGridView1.DataSource = productos.ToArray();
     //actualizaDGV();
 }
 public void BusquedaDelTicket()
 {
     ticket = new DAODetalle().GetDetails(clave_venta_textbox.Text);
     ActualizarDataGrid(ticket);
     //dataGridView1.DataSource = ticket.ToArray();
     Codigo_textbox.Enabled = true;
     Codigo_textbox.Focus();
     clave_venta_textbox.Enabled = false;
 }
 private void FocusTicket()
 {
     Codigo_textbox.Text      = null;
     Codigo_textbox.Enabled   = true;
     cantidad_textbox.Text    = null;
     cantidad_textbox.Enabled = false;
     Codigo_textbox.Focus();
     ticket = new DAODetalle().GetDetails(clave_venta_textbox.Text);
     ActualizarDataGrid(ticket);
 }
Beispiel #5
0
        private void agregar_button_Click_1(object sender, EventArgs e)
        {
            int   cantidad = 0;
            float precio   = 0;

            if (Codigo_textbox.Text.Equals(null) || Cantidad_textbox.Text.Equals(null) || precio_textbox.Text.Equals(null) || comboBox1.Text.Equals(null))
            {
                new Mensajes().DebeLlenarTodosLosCampos();
                Codigo_textbox.Focus();
                Codigo_textbox.SelectionStart  = 0;
                Codigo_textbox.SelectionLength = Codigo_textbox.Text.Length;
            }
            else if (new DAOProductos().GetProducts(new Validaciones().LimpiarString(Codigo_textbox.Text)) == null)
            {
                MessageBox.Show("El producto no existe, debe registrarlo.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Codigo_textbox.Focus();
                Codigo_textbox.SelectionStart  = 0;
                Codigo_textbox.SelectionLength = Codigo_textbox.Text.Length;
            }
            else if (!int.TryParse(Cantidad_textbox.Text, out cantidad))
            {
                MessageBox.Show("Debe ingresar un número entero en el campo cantidad.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Cantidad_textbox.Focus();
                Cantidad_textbox.SelectionStart  = 0;
                Cantidad_textbox.SelectionLength = Cantidad_textbox.Text.Length;
            }
            else if (!float.TryParse(precio_textbox.Text, out precio))
            {
                MessageBox.Show("Debe ingresar un número en el campo precio.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                precio_textbox.Focus();
                precio_textbox.SelectionStart  = 0;
                precio_textbox.SelectionLength = precio_textbox.Text.Length;
            }
            else
            {
                float resultado = float.Parse(Cantidad_textbox.Text) * float.Parse(precio_textbox.Text);
                costo_total_textbox.Text = Convert.ToString(resultado);
                PantallaCompras temp = new PantallaCompras();
                temp.Codigo    = Codigo_textbox.Text;
                temp.Producto  = descripcion_textbox.Text;
                temp.proveedor = comboBox1.Text;
                temp.cantidad  = int.Parse(Cantidad_textbox.Text);
                temp.precio    = float.Parse(costo_total_textbox.Text);
                temp.proveedor = comboBox1.Text;
                AgregarPantalla(temp);

                /*pantallita.Add(temp);
                 * dataGridView1.Columns.Clear();
                 * actualizaDGV();
                 * remarcarCodigo();*/
            }
        }
Beispiel #6
0
 public void NuevaCompra()
 {
     Codigo_textbox.Text            = null;
     Codigo_textbox.Enabled         = true;
     Cantidad_textbox.Text          = null;
     Cantidad_textbox.Enabled       = true;
     precio_textbox.Text            = null;
     precio_textbox.Enabled         = true;
     descripcion_textbox.Text       = null;
     descripcion_textbox.Enabled    = false;
     nuevo_proveedor_button.Enabled = true;
     comboBox1.Enabled = true;
     Codigo_textbox.Focus();
     cambiar_precio_vta_button.Enabled = true;
     agregar_button.Enabled            = true;
 }
        private void buscar_button_Click(object sender, EventArgs e)
        {
            Ventas venta = new Ventas();

            if (new DAOVentas().GetVentasXId(clave_venta_textbox.Text) != null)
            {
                ticket = new DAODetalle().GetDetails(clave_venta_textbox.Text);
                ActualizarDataGrid(ticket);
                //dataGridView1.DataSource = ticket.ToArray();
                Codigo_textbox.Enabled = true;
                Codigo_textbox.Focus();
                clave_venta_textbox.Enabled = false;
            }
            else
            {
                MessageBox.Show("Clave de venta incorrecta.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                clave_venta_textbox.Focus();
                clave_venta_textbox.SelectionStart  = 0;
                clave_venta_textbox.SelectionLength = clave_venta_textbox.Text.Length;
            }
        }
Beispiel #8
0
 public void remarcarCodigo()
 {
     Codigo_textbox.Focus();
     Codigo_textbox.SelectionStart  = 0;
     Codigo_textbox.SelectionLength = Codigo_textbox.Text.Length;
 }
Beispiel #9
0
        private void precio_textbox_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!char.IsDigit(e.KeyChar) &&
                e.KeyChar != '.' &&
                !char.IsControl(e.KeyChar))
            {
                e.Handled = true;
            }

            bool IsDec  = false;
            int  nroDec = 0;

            for (int i = 0; i < precio_textbox.Text.Length; i++)
            {
                if (precio_textbox.Text[i] == '.')
                {
                    IsDec = true;
                }

                if (IsDec && e.KeyChar == '.' && !char.IsControl(e.KeyChar))
                {
                    e.Handled = true;
                }

                if (IsDec && nroDec++ >= 2 && !char.IsControl(e.KeyChar))
                {
                    e.Handled = true;
                }
            }

            /* if (e.KeyChar >= 48 && e.KeyChar <= 57)
             *   e.Handled = false;
             * else if (e.KeyChar == 46)
             *   e.Handled = (IsDec) ? true : false;
             * else
             *   e.Handled = true;*/
            if (e.KeyChar == (char)Keys.Enter)
            {
                int   cantidad = 0;
                float precio   = 0;
                if (Codigo_textbox.Text.Equals(null) || Cantidad_textbox.Text.Equals(null) || precio_textbox.Text.Equals(null) || comboBox1.Text.Equals(null))
                {
                    new Mensajes().DebeLlenarTodosLosCampos(); Codigo_textbox.Focus();
                    Codigo_textbox.SelectionStart  = 0;
                    Codigo_textbox.SelectionLength = Codigo_textbox.Text.Length;
                }
                else if (new DAOProductos().GetProducts(new Validaciones().LimpiarString(Codigo_textbox.Text)) == null)
                {
                    MessageBox.Show("El producto no existe, debe registrarlo.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Codigo_textbox.Focus();
                    Codigo_textbox.SelectionStart  = 0;
                    Codigo_textbox.SelectionLength = Codigo_textbox.Text.Length;
                }
                else if (!int.TryParse(Cantidad_textbox.Text, out cantidad))
                {
                    MessageBox.Show("Debe ingresar un número entero en el campo cantidad.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Cantidad_textbox.Focus();
                    Cantidad_textbox.SelectionStart  = 0;
                    Cantidad_textbox.SelectionLength = Cantidad_textbox.Text.Length;
                }
                else if (!float.TryParse(precio_textbox.Text, out precio))
                {
                    MessageBox.Show("Debe ingresar un número en el campo precio.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    precio_textbox.Focus();
                    precio_textbox.SelectionStart  = 0;
                    precio_textbox.SelectionLength = precio_textbox.Text.Length;
                }
                else
                {
                    float resultado = float.Parse(Cantidad_textbox.Text) * float.Parse(precio_textbox.Text);
                    costo_total_textbox.Text = (float.Parse(Cantidad_textbox.Text) * float.Parse(precio_textbox.Text)).ToString();
                    PantallaCompras temp = new PantallaCompras();
                    temp.Codigo    = Codigo_textbox.Text;
                    temp.Producto  = descripcion_textbox.Text;
                    temp.proveedor = comboBox1.Text;
                    temp.cantidad  = int.Parse(Cantidad_textbox.Text);
                    temp.precio    = float.Parse(costo_total_textbox.Text);
                    temp.proveedor = comboBox1.Text;
                    AgregarPantalla(temp);

                    /* pantallita.Add(temp);
                     * dataGridView1.Columns.Clear();
                     * dataGridView1.DataSource = pantallita.ToArray();
                     * actualizaDGV();
                     * remarcarCodigo();*/
                }
            }
        }