private void tbCodigoArt_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Escape) { this.Close(); } if (e.KeyCode == Keys.F1) { BUSCARPRODUCTO buscar = new BUSCARPRODUCTO(); buscar.Visible = true; } if (e.KeyCode == Keys.F2) { try { string codigo = tbCodigoArt.Text; foreach (DataGridViewRow linea in dataGridView1.Rows) { if (linea.Cells[0].Value.ToString() == codigo) { dataGridView1.Rows.Remove(linea); numProds--; clProducto prod = clConsultasProductos.BuscarPorCodigoExterno(linea.Cells[0].Value.ToString()); float subt = prod.Precio1 * float.Parse(linea.Cells[3].Value.ToString()); float iva2 = prod.Precio1 * float.Parse(linea.Cells[3].Value.ToString()) * prod.IVA1 / 100; float tot = subt + iva2; subtotalV = subtotalV - subt; ivaV = ivaV - iva2; totalV = totalV - tot; if (numProds == 0) { subtotalV = 0; ivaV = 0; totalV = 0; } lbArticulos.Text = "ARTICULOS: " + numProds; lbSubTotal.Text = "SUB TOTAL: $ " + subtotalV; lbIva.Text = "IVA: $ " + ivaV; lbTotal.Text = "TOTAL: $ " + totalV; tbCodigoArt.Text = null; tbCantidad.Text = null; } } } catch { } } if (e.KeyCode == Keys.F3) { try{ dataGridView1.Rows.Clear(); subtotalV = 0; ivaV = 0; totalV = 0; numProds = 0; cantProducto = 0; lbArticulos.Text = "ARTICULOS: " + numProds; lbSubTotal.Text = "SUB TOTAL: $ " + subtotalV; lbIva.Text = "IVA: $ " + ivaV; lbTotal.Text = "TOTAL: $ " + totalV; } catch { } } if (e.KeyCode == Keys.F4) { try{ COBRAR cobrar = new COBRAR(totalV); cobrar.Visible = true; registrarVenta(); InicializaVenta(); } catch { } } }
private void btBuscar_Click(object sender, EventArgs e) { BUSCARPRODUCTO buscar = new BUSCARPRODUCTO(); buscar.Visible = true; }