Esempio n. 1
0
        private void txtCodigo_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F5)
            {
                int           codigo;
                int           cantidad;
                string        nombre;
                double        precio;
                double        listIva;
                double        subtotal;
                int           sumararticulos = 0;
                PuenteDeDatos objeto         = new PuenteDeDatos();

                Cobro abrir = new Cobro();
                abrir.CantidadxPagar = double.Parse(txtTotal.Text);
                abrir.ShowDialog();
                // Variables parsa llenar mi tabla tempopral

                foreach (ListViewItem item in lvProductos.Items)
                {
                    for (int counter = 0; counter < item.SubItems.Count; counter++)
                    {
                        if (counter == 0)
                        {
                            codigo   = int.Parse(item.SubItems[counter].Text);
                            nombre   = item.SubItems[counter + 1].Text;
                            cantidad = int.Parse(item.SubItems[counter + 2].Text);
                            precio   = double.Parse(item.SubItems[counter + 3].Text);
                            listIva  = double.Parse(item.SubItems[counter + 4].Text);
                            subtotal = double.Parse(item.SubItems[counter + 5].Text);

                            sumararticulos = cantidad + sumararticulos;

                            objeto.AgregaDatosTablaTemp(codigo, lblCajero.Text, cantidad, subtotal, listIva);

                            //Descontar cantidades de la tabla Productos
                        }
                    }
                }

                // Mandamos a llamar el ticket

                Ticket recibo = new Ticket();
                recibo.ShowDialog();

                // llenamos tabla ventas


                //Borrar todos los registros de la tabla temporal


                // Limpiamos todos los campos

                Total         = 0.0;
                txtTotal.Text = Total.ToString("0.00");
                lvProductos.Items.Clear();
            }
            if (e.KeyCode == Keys.F2)
            {
                BuscarProducto BP = new BuscarProducto();
                BP.Show();
                txtCodigo.Text = BP.codigo2;
            }
            if (e.KeyCode == Keys.F7)
            {
                CorteDeCaja CC = new CorteDeCaja();
                CC.ShowDialog();
                this.Close();
            }
        }