private void dgvVentas_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) { return; } if (e.ColumnIndex == dgvVentas.Columns["Editar"].Index) { string idVenta = dgvVentas.CurrentRow.Cells["IdVentaVEN"].Value.ToString(); frmVentas ventas = new frmVentas(idVenta, idPc, tblVentas, tblVentasDetalle); ventas.FormClosed += editVentas_FormClosed; ventas.ShowDialog(); } if (e.ColumnIndex == dgvVentas.Columns["Borrar"].Index) { if (MessageBox.Show("¿Desea borrar este registro y todos los movimientos relacionados?", "Trend Gestión", MessageBoxButtons.YesNo, MessageBoxIcon.Stop) == DialogResult.Yes) { if (!BL.UtilDB.ValidarServicioMysql()) { MessageBox.Show("NO SE BORRARON LOS DATOS." + '\r' + "No se pudo conectar con el servidor de base de datos." + '\r' + "Consulte al administrador del sistema.", "Trend Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } int PK = Convert.ToInt32(dgvVentas.CurrentRow.Cells["IdVentaVEN"].Value.ToString()); frmProgress frm = new frmProgress(PK, "frmArqueoCajaAdmin_borrarVenta", "grabar"); frm.FormClosed += progreso_FormClosed; frm.Show(); } } }
private void ventasToolStripMenuItem_Click(object sender, EventArgs e) { frmVentas newMDIChild = new frmVentas(); newMDIChild.MdiParent = this; newMDIChild.Show(); }
void editVentas_FormClosed(object sender, FormClosedEventArgs e) { frmVentas formVentas = (frmVentas)sender; if (formVentas.Tag != null && formVentas.Tag.ToString() == "ActualizarArqueo") { Cursor.Current = Cursors.Arrow; DataSet dsVentas = formVentas.dsVentas; try { BL.TransaccionesBLL.GrabarVentas(dsVentas); } catch (ServidorMysqlInaccesibleException ex) { MessageBox.Show(ex.Message, "Trend Gestión", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { MessageBox.Show(ex.Message); } ActualizarArqueo(); Cursor.Current = Cursors.Arrow; } }
public frmArticulos(ref frmVentas f, DataTable tblArticulos) { InitializeComponent(); formVentas = f; this.tblArticulos = tblArticulos; btnBorrar.Enabled = false; btnEditar.Enabled = false; }
private void ventasToolStripMenuItem_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; frmVentas newMDIChild = new frmVentas(); newMDIChild.MdiParent = this; newMDIChild.Show(); Cursor.Current = Cursors.Arrow; }
private void dgvVentas_CellClick(object sender, DataGridViewCellEventArgs e) { int PK = Convert.ToInt32(dgvVentas.CurrentRow.Cells["IdVentaVEN"].Value.ToString()); if (dtPicker.Value.Date != DateTime.Today) { return; } if (e.RowIndex < 0) { return; } if (e.ColumnIndex == dgvVentas.Columns["Editar"].Index) { string idVenta = dgvVentas.CurrentRow.Cells["IdVentaVEN"].Value.ToString(); frmVentas ventas = new frmVentas(idVenta, idPc, tblVentas, tblVentasDetalle); ventas.FormClosed += editVentas_FormClosed; ventas.ShowDialog(); } if (e.ColumnIndex == dgvVentas.Columns["Borrar"].Index) { if (MessageBox.Show("¿Desea borrar este registro y todos los movimientos relacionados?", "Trend", MessageBoxButtons.YesNo, MessageBoxIcon.Stop) == DialogResult.Yes) { Cursor.Current = Cursors.WaitCursor; viewVentas = new DataView(tblVentas); viewVentas.RowFilter = "[IdVentaVEN] = '" + PK + "'"; foreach (DataRowView row in viewVentas) { row.Delete(); } bool borrarRemotas = false; BL.TransaccionesBLL.BorrarVentasByPK(PK, ref codigoError, borrarRemotas); if (codigoError != null) { Close(); return; } tblVentas.AcceptChanges(); CargarDatos(); Cursor.Current = Cursors.Arrow; } } }
void editVentas_FormClosed(object sender, FormClosedEventArgs e) { frmVentas formVentas = (frmVentas)sender; if (formVentas.Tag != null && formVentas.Tag.ToString() == "ActualizarArqueo") { DataSet dsVentas = formVentas.dsVentas; if (!BL.UtilDB.ValidarServicioMysql()) { MessageBox.Show("NO SE ACTUALIZARON LOS DATOS." + '\r' + "No se pudo conectar con el servidor de base de datos." + '\r' + "Consulte al administrador del sistema.", "Trend Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); dsVentas.RejectChanges(); return; } frmProgress progreso = new frmProgress(dsVentas, "frmVentas", "grabar"); progreso.FormClosed += progreso_FormClosed; progreso.Show(); } }
private void dgvVentas_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) { return; } if (e.ColumnIndex == dgvVentas.Columns["Editar"].Index) { string idVenta = dgvVentas.CurrentRow.Cells["IdVentaVEN"].Value.ToString(); frmVentas ventas = new frmVentas(idVenta, idPc, tblVentas, tblVentasDetalle); ventas.FormClosed += editVentas_FormClosed; ventas.ShowDialog(); } if (e.ColumnIndex == dgvVentas.Columns["Borrar"].Index) { if (MessageBox.Show("¿Desea borrar este registro y todos los movimientos relacionados?", "Trend Gestión", MessageBoxButtons.YesNo, MessageBoxIcon.Stop) == DialogResult.Yes) { Cursor.Current = Cursors.WaitCursor; try { int PK = Convert.ToInt32(dgvVentas.CurrentRow.Cells["IdVentaVEN"].Value.ToString()); BL.VentasBLL.BorrarByPK(PK); } catch (ServidorMysqlInaccesibleException ex) { MessageBox.Show(ex.Message, "Trend Gestión", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { MessageBox.Show(ex.Message); } Cursor.Current = Cursors.Arrow; } } }
private void frmVentas_Load(object sender, EventArgs e) { this.StartPosition = FormStartPosition.CenterScreen; System.Drawing.Icon ico = Properties.Resources.icono_app; this.Icon = ico; this.ControlBox = true; this.MaximizeBox = false; instanciaVentas = this; this.AutoValidate = System.Windows.Forms.AutoValidate.EnablePreventFocusChange; this.ControlBox = true; this.MaximizeBox = false; this.CancelButton = btnSalir; btnSalir.Visible = false; dateTimePicker1.Visible = false; lblFecha.Text = DateTime.Today.ToLongDateString(); lblTotal.ForeColor = System.Drawing.Color.DarkRed; ToolTip tooltipClientes = new ToolTip(); tooltipClientes.SetToolTip(btnClientes, "Agregar nuevo cliente"); ToolTip tooltipCupones = new ToolTip(); tooltipCupones.SetToolTip(btnCupon, "Ingresar cupón de descuento"); dsForaneos = BL.VentasBLL.CrearDatasetForaneos(); tblLocales = dsForaneos.Tables[3]; tblPcs = dsForaneos.Tables[4]; CargarComboLocales(); tblArticulos = dsForaneos.Tables[0]; tblArticulos.TableName = "Articulos"; var source = new AutoCompleteStringCollection(); String[] stringArray = Array.ConvertAll<DataRow, String>(tblArticulos.Select(), delegate(DataRow row) { return (String)row["IdArticuloART"]; }); source.AddRange(stringArray); txtArticulo.AutoCompleteMode = AutoCompleteMode.SuggestAppend; txtArticulo.AutoCompleteCustomSource = source; txtArticulo.AutoCompleteSource = AutoCompleteSource.CustomSource; txtArticulo.BackColor = Color.White; txtDescripcion.BackColor = Color.White; txtDescripcion.TabStop = false; txtDescripcion.ReadOnly = true; txtCantidad.BackColor = Color.White; txtPrecio.BackColor = Color.White; tblFormasPago = dsForaneos.Tables[2]; tblFormasPago.TableName = "FormasPago"; cmbForma.ValueMember = "IdFormaPagoFOR"; cmbForma.DisplayMember = "DescripcionFOR"; cmbForma.DropDownStyle = ComboBoxStyle.DropDown; cmbForma.DataSource = tblFormasPago; cmbForma.SelectedValue = -1; cmbForma.BackColor = Color.White; AutoCompleteStringCollection formasColection = new AutoCompleteStringCollection(); foreach (DataRow row in tblFormasPago.Rows) { formasColection.Add(Convert.ToString(row["DescripcionFOR"])); } cmbForma.AutoCompleteCustomSource = formasColection; cmbForma.AutoCompleteMode = AutoCompleteMode.SuggestAppend; cmbForma.AutoCompleteSource = AutoCompleteSource.CustomSource; txtCosto.Visible = false; grpInicial.CausesValidation = false; grpBotonera.CausesValidation = false; btnClientes.CausesValidation = false; btnCupon.CausesValidation = false; btnEditar.CausesValidation = false; btnBorrar.CausesValidation = false; btnArticulos.CausesValidation = false; lblNro.ForeColor = System.Drawing.Color.DarkRed; dsVentas = new DataSet(); dsVentas.DataSetName = "dsVentas"; if (tblVentas.DataSet == null) { dsVentas.Tables.Add(tblVentas); dsVentas.Tables.Add(tblVentasDetalle); } tblVentasDetalle.PrimaryKey = new DataColumn[] { tblVentasDetalle.Columns["IdDVEN"] }; viewVentas = new DataView(tblVentas); viewDetalle = new DataView(tblVentasDetalle); bindingSource1.DataSource = viewDetalle; bindingNavigator1.BindingSource = bindingSource1; dgvDatos.ReadOnly = true; dgvDatos.AllowUserToAddRows = false; dgvDatos.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dgvDatos.DataSource = viewDetalle; dgvDatos.AllowUserToOrderColumns = false; dgvDatos.Columns["IdDVEN"].Visible = false; dgvDatos.Columns["IdVentaDVEN"].Visible = false; dgvDatos.Columns["IdLocalDVEN"].Visible = false; dgvDatos.Columns["PrecioCostoDVEN"].Visible = false; dgvDatos.Columns["PrecioMayorDVEN"].Visible = false; dgvDatos.Columns["IdFormaPagoDVEN"].Visible = false; dgvDatos.Columns["NroCuponDVEN"].Visible = false; dgvDatos.Columns["NroFacturaDVEN"].Visible = false; dgvDatos.Columns["IdEmpleadoDVEN"].Visible = false; dgvDatos.Columns["LiquidadoDVEN"].Visible = false; dgvDatos.Columns["EsperaDVEN"].Visible = false; dgvDatos.Columns["DescripcionDVEN"].HeaderText = "Descripción"; dgvDatos.Columns["CantidadDVEN"].Width = 55; dgvDatos.Columns["CantidadDVEN"].HeaderText = "Cantidad"; dgvDatos.Columns["IdArticuloDVEN"].HeaderText = "Artículo"; dgvDatos.Columns["PrecioPublicoDVEN"].Width = 100; dgvDatos.Columns["PrecioPublicoDVEN"].HeaderText = "Precio"; dgvDatos.Columns["NroFacturaDVEN"].Width = 100; dgvDatos.Columns["NroFacturaDVEN"].HeaderText = "Nº fact."; dgvDatos.Columns.Remove("DevolucionDVEN"); dgvDatos.Columns.Remove("IdFormaPagoDVEN"); cmbFormaPago = new DataGridViewComboBoxColumn(); cmbFormaPago.Name = "FormaPago"; cmbFormaPago.HeaderText = "Forma de pago"; cmbFormaPago.DataSource = tblFormasPago; cmbFormaPago.ValueMember = "IdFormaPagoFOR"; cmbFormaPago.DisplayMember = "DescripcionFOR"; cmbFormaPago.DataPropertyName = "IdFormaPagoDVEN"; dgvDatos.Columns.Insert(7, cmbFormaPago); chkDevolucion = new DataGridViewCheckBoxColumn(); chkDevolucion.Name = "DevolucionDVEN"; chkDevolucion.Width = 40; chkDevolucion.HeaderText = "Dev."; chkDevolucion.DataPropertyName = "DevolucionDVEN"; chkDevolucion.TrueValue = 1; chkDevolucion.FalseValue = 0; dgvDatos.Columns.Insert(12, chkDevolucion); if (PK == "") //registro nuevo { tblVentas.PrimaryKey = new DataColumn[] { tblVentas.Columns["IdVentaVEN"] }; tblDetalleOriginal = tblVentasDetalle.Copy(); //tblDetalleOriginal se usa para controlar errores de guardado remoto por falta de internet Random rand = new Random(); int clave = rand.Next(1, 2000000000); bool existe = true; while (existe == true) { DataRow foundRow = dsVentas.Tables["Ventas"].Rows.Find(clave); if (foundRow == null) { existe = false; } else { clave = rand.Next(1, 2000000000); } } lblNro.Text = clave.ToString(); viewVentas.RowStateFilter = DataViewRowState.Added; viewDetalle.RowStateFilter = DataViewRowState.Added; rowView = viewVentas.AddNew(); rowView["IdVentaVEN"] = clave.ToString(); rowView["FechaVEN"] = DateTime.Now; rowView["IdPCVEN"] = 1; rowView["NroCuponVEN"] = "00000000000"; rowView.EndEdit(); } else // editar registros { tblDetalleOriginal = tblVentasDetalle.Copy(); //tblDetalleOriginal se usa para controlar errores de guardado remoto por falta de internet viewVentas.RowFilter = "IdVentaVEN = '" + PK + "'"; rowView = viewVentas[0]; viewDetalle.RowFilter = "IdVentaDVEN = '" + PK + "'"; lblNro.Text = viewVentas[0][0].ToString(); cmbLocal.Enabled = false; // viewDetalleOriginal se usa para registrar en tabla fallidas errores de guardado remoto por falta de internet viewDetalleOriginal = new DataView(tblDetalleOriginal); viewDetalleOriginal.RowFilter = "IdVentaDVEN = '" + PK + "'"; lblTotal.Text = "$" + CalcularTotalOk().ToString(); } dateTimePicker1.DataBindings.Add("Text", rowView, "FechaVEN", false, DataSourceUpdateMode.OnPropertyChanged); cmbLocal.DataBindings.Add("SelectedValue", rowView, "IdPCVEN", false, DataSourceUpdateMode.OnPropertyChanged); cmbCliente.DataBindings.Add("SelectedValue", rowView, "IdClienteVEN", false, DataSourceUpdateMode.OnPropertyChanged); txtCupon.DataBindings.Add("Text", rowView, "NroCuponVEN", false, DataSourceUpdateMode.OnPropertyChanged); rowView.CancelEdit(); cmbCliente.Validating += new System.ComponentModel.CancelEventHandler(BL.Utilitarios.ValidarComboBox); txtPrecio.KeyPress += new KeyPressEventHandler(BL.Utilitarios.SoloNumerosConComa); txtCantidad.KeyPress += new KeyPressEventHandler(BL.Utilitarios.SoloNumeros); txtArticulo.Enter += new System.EventHandler(Utilitarios.SelTextoTextBox); txtCantidad.Enter += new System.EventHandler(Utilitarios.SelTextoTextBox); txtPrecio.Enter += new System.EventHandler(Utilitarios.SelTextoTextBox); txtArticulo.KeyDown += new System.Windows.Forms.KeyEventHandler(Utilitarios.EnterTab); txtCantidad.KeyDown += new System.Windows.Forms.KeyEventHandler(Utilitarios.EnterTab); txtPrecio.KeyDown += new System.Windows.Forms.KeyEventHandler(Utilitarios.EnterTab); cmbForma.KeyDown += new System.Windows.Forms.KeyEventHandler(Utilitarios.EnterTab); cmbForma.Validating += new System.ComponentModel.CancelEventHandler(BL.Utilitarios.ValidarComboBox); chkDev.KeyDown += new System.Windows.Forms.KeyEventHandler(Utilitarios.EnterTab); if (!string.IsNullOrEmpty(PK)) //registro nuevo { tblVentas.AcceptChanges(); tblVentasDetalle.AcceptChanges(); } SetStateForm(FormState.insercion); }
private void dgvVentas_CellClick(object sender, DataGridViewCellEventArgs e) { if (dtPicker.Value.Date != DateTime.Today) return; if (e.RowIndex < 0) return; if (e.ColumnIndex == dgvVentas.Columns["Editar"].Index) { string idVenta = dgvVentas.CurrentRow.Cells["IdVentaVEN"].Value.ToString(); frmVentas ventas = new frmVentas(idVenta, idPc, tblVentas, tblVentasDetalle); ventas.FormClosed += editVentas_FormClosed; ventas.ShowDialog(); } if (e.ColumnIndex == dgvVentas.Columns["Borrar"].Index) { if (MessageBox.Show("¿Desea borrar este registro y todos los movimientos relacionados?", "Trend", MessageBoxButtons.YesNo, MessageBoxIcon.Stop) == DialogResult.Yes) { Cursor.Current = Cursors.WaitCursor; int PK = Convert.ToInt32(dgvVentas.CurrentRow.Cells["IdVentaVEN"].Value.ToString()); viewVentas = new DataView(tblVentas); viewVentas.RowFilter = "[IdVentaVEN] = '" + PK + "'"; foreach (DataRowView row in viewVentas) { row.Delete(); } bool borrarRemotas = false; BL.TransaccionesBLL.BorrarVentasByPK(PK, ref codigoError, borrarRemotas); if (codigoError != null) { Close(); return; } tblVentas.AcceptChanges(); CargarDatos(); Cursor.Current = Cursors.Arrow; } } }
public frmClientes(ref frmVentas instanciaVentas) { InitializeComponent(); this.instanciaVentas = instanciaVentas; }
private void frmVentas_Load(object sender, EventArgs e) { System.Globalization.CultureInfo.CurrentCulture.NumberFormat.CurrencyDecimalSeparator = ","; System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator = ","; this.CenterToScreen(); instanciaVentas = this; this.AutoValidate = System.Windows.Forms.AutoValidate.EnablePreventFocusChange; System.Drawing.Icon ico = Properties.Resources.icono_app; this.Icon = ico; this.ControlBox = true; this.MaximizeBox = false; FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; CargarComboLocales(); grpABM.Enabled = false; tblArticulos = BL.GetDataBLL.Articulos(); tblArticulos.TableName = "Articulos"; var source = new AutoCompleteStringCollection(); String[] stringArray = Array.ConvertAll<DataRow, String>(tblArticulos.Select(), delegate(DataRow row) { return (String)row["IdArticuloART"]; }); source.AddRange(stringArray); txtArticulo.AutoCompleteMode = AutoCompleteMode.SuggestAppend; txtArticulo.AutoCompleteCustomSource = source; txtArticulo.AutoCompleteSource = AutoCompleteSource.CustomSource; txtArticulo.BackColor = Color.White; txtDescripcion.BackColor = Color.White; txtDescripcion.TabStop = false; txtDescripcion.ReadOnly = true; txtCantidad.BackColor = Color.White; txtPrecio.BackColor = Color.White; tblFormasPago = BL.GetDataBLL.FormasPago(); cmbForma.ValueMember = "IdFormaPagoFOR"; cmbForma.DisplayMember = "DescripcionFOR"; cmbForma.DropDownStyle = ComboBoxStyle.DropDown; cmbForma.DataSource = tblFormasPago; cmbForma.SelectedValue = -1; cmbForma.BackColor = Color.White; AutoCompleteStringCollection formasPagoColection = new AutoCompleteStringCollection(); foreach (DataRow row in tblFormasPago.Rows) { formasPagoColection.Add(Convert.ToString(row["DescripcionFOR"])); } cmbForma.AutoCompleteCustomSource = formasPagoColection; cmbForma.AutoCompleteMode = AutoCompleteMode.SuggestAppend; cmbForma.AutoCompleteSource = AutoCompleteSource.CustomSource; cmbForma.Validating += new System.ComponentModel.CancelEventHandler(BL.Utilitarios.ValidarComboBox); lblCosto.Visible = false; txtCosto.Visible = false; grpVentas.CausesValidation = false; dateTimePicker1.CausesValidation = false; cmbLocal.CausesValidation = false; cmbCliente.CausesValidation = false; btnClientes.CausesValidation = false; btnEditar.CausesValidation = false; btnBorrar.CausesValidation = false; btnArticulos.CausesValidation = false; dsVentas = new DataSet(); dsVentas.DataSetName = "dsVentas"; if (tblVentas.DataSet == null) { dsVentas.Tables.Add(tblVentas); dsVentas.Tables.Add(tblVentasDetalle); } tblVentasDetalle.PrimaryKey = new DataColumn[] { tblVentasDetalle.Columns["IdDVEN"] }; viewVentas = new DataView(tblVentas); viewDetalle = new DataView(tblVentasDetalle); viewDetalle.Sort = "OrdenarDVEN ASC"; bindingSource1.DataSource = viewDetalle; bindingNavigator1.BindingSource = bindingSource1; dgvDatos.ReadOnly = true; dgvDatos.AllowUserToAddRows = false; dgvDatos.AllowUserToOrderColumns = false; dgvDatos.DataSource = bindingSource1; dgvDatos.Columns["IdDVEN"].Visible = false; dgvDatos.Columns["IdVentaDVEN"].Visible = false; dgvDatos.Columns["IdLocalDVEN"].Visible = false; dgvDatos.Columns["PrecioCostoDVEN"].Visible = false; dgvDatos.Columns["PrecioMayorDVEN"].Visible = false; dgvDatos.Columns["IdFormaPagoDVEN"].Visible = false; dgvDatos.Columns["NroCuponDVEN"].Visible = false; dgvDatos.Columns["IdEmpleadoDVEN"].Visible = false; dgvDatos.Columns["LiquidadoDVEN"].Visible = false; dgvDatos.Columns["EsperaDVEN"].Visible = false; dgvDatos.Columns["OrdenarDVEN"].Visible = false; dgvDatos.Columns["CantidadDVEN"].Width = 55; dgvDatos.Columns["CantidadDVEN"].HeaderText = "Cantidad"; dgvDatos.Columns["IdArticuloDVEN"].HeaderText = "Artículo"; dgvDatos.Columns["DescripcionDVEN"].HeaderText = "Descripción"; dgvDatos.Columns["PrecioPublicoDVEN"].Width = 100; dgvDatos.Columns["PrecioPublicoDVEN"].HeaderText = "Precio"; dgvDatos.Columns["PrecioPublicoDVEN"].DefaultCellStyle.Format = "C2"; dgvDatos.Columns["NroFacturaDVEN"].Width = 100; dgvDatos.Columns["NroFacturaDVEN"].HeaderText = "Nº fact."; dgvDatos.Columns.Remove("DevolucionDVEN"); dgvDatos.Columns.Remove("IdFormaPagoDVEN"); DataGridViewComboBoxColumn cmbFormaPago = new DataGridViewComboBoxColumn(); cmbFormaPago.Name = "FormaPago"; cmbFormaPago.HeaderText = "Forma de pago"; cmbFormaPago.DataSource = tblFormasPago; cmbFormaPago.ValueMember = "IdFormaPagoFOR"; cmbFormaPago.DisplayMember = "DescripcionFOR"; cmbFormaPago.DataPropertyName = "IdFormaPagoDVEN"; dgvDatos.Columns.Insert(7, cmbFormaPago); DataGridViewCheckBoxColumn chkDevolucion = new DataGridViewCheckBoxColumn(); chkDevolucion.Name = "DevolucionDVEN"; chkDevolucion.Width = 40; chkDevolucion.HeaderText = "Dev."; chkDevolucion.DataPropertyName = "DevolucionDVEN"; chkDevolucion.TrueValue = 1; chkDevolucion.FalseValue = 0; dgvDatos.Columns.Insert(12, chkDevolucion); dgvDatos.SelectionMode = DataGridViewSelectionMode.FullRowSelect; lblTotal.Text = "$ 0"; if (PK == "") //registro nuevo { lblNro.ForeColor = System.Drawing.Color.DarkRed; Random rand = new Random(); int clave = rand.Next(-2000000000, 2000000000); lblNro.Text = clave.ToString(); rowView = viewVentas.AddNew(); rowView["IdVentaVEN"] = clave.ToString(); rowView["FechaVEN"] = dateTimePicker1.Value; rowView.EndEdit(); // SetStateForm(FormState.inicial); } else // editar registros { viewVentas.RowFilter = "IdVentaVEN = '" + PK + "'"; rowView = viewVentas[0]; rowView.BeginEdit(); viewDetalle.RowFilter = "IdVentaDVEN = '" + PK + "'"; lblNro.Text = viewVentas[0][0].ToString(); cmbLocal.Enabled = false; lblTotal.Text = "$ " + CalcularTotal(); dateTimePicker1.TabStop = false; cmbLocal.TabStop = false; cmbCliente.Focus(); SetStateForm(FormState.inicial); } dateTimePicker1.DataBindings.Add("Text", rowView, "FechaVEN", false, DataSourceUpdateMode.OnPropertyChanged); cmbLocal.DataBindings.Add("SelectedValue", rowView, "IdPCVEN", false, DataSourceUpdateMode.OnPropertyChanged); cmbCliente.DataBindings.Add("SelectedValue", rowView, "IdClienteVEN", false, DataSourceUpdateMode.OnPropertyChanged); rowView.CancelEdit(); ToolTip tooltip = new ToolTip(); tooltip.SetToolTip(btnClientes, "Agregar nuevo cliente"); cmbLocal.SelectedIndexChanged += new EventHandler(this.ValidarMaestro); cmbCliente.Validating += new System.ComponentModel.CancelEventHandler(BL.Utilitarios.ValidarComboBox); txtPrecio.KeyPress += new KeyPressEventHandler(BL.Utilitarios.SoloNumerosConComa); txtCantidad.KeyPress += new KeyPressEventHandler(BL.Utilitarios.SoloNumeros); txtArticulo.Enter += new System.EventHandler(BL.Utilitarios.SelTextoTextBox); txtCantidad.Enter += new System.EventHandler(BL.Utilitarios.SelTextoTextBox); txtPrecio.Enter += new System.EventHandler(BL.Utilitarios.SelTextoTextBox); cmbForma.Enter += new System.EventHandler(BL.Utilitarios.SelTextoTextBox); txtArticulo.KeyDown += new System.Windows.Forms.KeyEventHandler(BL.Utilitarios.EnterTab); txtCantidad.KeyDown += new System.Windows.Forms.KeyEventHandler(BL.Utilitarios.EnterTab); txtPrecio.KeyDown += new System.Windows.Forms.KeyEventHandler(BL.Utilitarios.EnterTab); cmbForma.KeyDown += new System.Windows.Forms.KeyEventHandler(BL.Utilitarios.EnterTab); chkDev.KeyDown += new System.Windows.Forms.KeyEventHandler(BL.Utilitarios.EnterTab); }
private void dgvVentas_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) return; if (e.ColumnIndex == dgvVentas.Columns["Editar"].Index) { string idVenta = dgvVentas.CurrentRow.Cells["IdVentaVEN"].Value.ToString(); frmVentas ventas = new frmVentas(idVenta, idPc, tblVentas, tblVentasDetalle); ventas.FormClosed += editVentas_FormClosed; ventas.ShowDialog(); } if (e.ColumnIndex == dgvVentas.Columns["Borrar"].Index) { if (MessageBox.Show("¿Desea borrar este registro y todos los movimientos relacionados?", "Trend Gestión", MessageBoxButtons.YesNo, MessageBoxIcon.Stop) == DialogResult.Yes) { if (!BL.UtilDB.ValidarServicioMysql()) { MessageBox.Show("NO SE BORRARON LOS DATOS." + '\r' + "No se pudo conectar con el servidor de base de datos." + '\r' + "Consulte al administrador del sistema.", "Trend Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } int PK = Convert.ToInt32(dgvVentas.CurrentRow.Cells["IdVentaVEN"].Value.ToString()); frmProgress frm = new frmProgress(PK, "frmArqueoCajaAdmin_borrarVenta", "grabar"); frm.FormClosed += progreso_FormClosed; frm.Show(); } } }
private void frmVentas_Load(object sender, EventArgs e) { this.CenterToScreen(); System.Drawing.Icon ico = Properties.Resources.icono_app; this.Icon = ico; this.ControlBox = true; this.MaximizeBox = false; instanciaVentas = this; this.AutoValidate = System.Windows.Forms.AutoValidate.EnablePreventFocusChange; this.ControlBox = true; this.MaximizeBox = false; this.KeyPreview = true; dateTimePicker1.Visible = false; lblFecha.Text = DateTime.Today.ToLongDateString(); lblTotal.ForeColor = System.Drawing.Color.DarkRed; ToolTip tooltip = new ToolTip(); tooltip.SetToolTip(btnClientes, "Agregar nuevo cliente"); btnClientes.TabStop = false; dsForaneos = BL.VentasBLL.CrearDatasetForaneos(); tblLocales = dsForaneos.Tables[3]; tblPcs = dsForaneos.Tables[4]; CargarComboLocales(); tblArticulos = dsForaneos.Tables[0]; tblArticulos.TableName = "Articulos"; var source = new AutoCompleteStringCollection(); String[] stringArray = Array.ConvertAll <DataRow, String>(tblArticulos.Select(), delegate(DataRow row) { return((String)row["IdArticuloART"]); }); source.AddRange(stringArray); txtArticulo.AutoCompleteMode = AutoCompleteMode.SuggestAppend; txtArticulo.AutoCompleteCustomSource = source; txtArticulo.AutoCompleteSource = AutoCompleteSource.CustomSource; txtArticulo.BackColor = Color.White; txtDescripcion.BackColor = Color.White; txtDescripcion.TabStop = false; txtDescripcion.ReadOnly = true; txtCantidad.BackColor = Color.White; txtPrecio.BackColor = Color.White; tblFormasPago = dsForaneos.Tables[2]; tblFormasPago.TableName = "FormasPago"; DataView viewForma = new DataView(tblFormasPago); viewForma.RowFilter = "IdFormaPagoFOR <>'99'"; cmbForma.ValueMember = "IdFormaPagoFOR"; cmbForma.DisplayMember = "DescripcionFOR"; cmbForma.DropDownStyle = ComboBoxStyle.DropDown; cmbForma.DataSource = viewForma; cmbForma.SelectedValue = -1; cmbForma.BackColor = Color.White; AutoCompleteStringCollection formasColection = new AutoCompleteStringCollection(); foreach (DataRowView row in viewForma) { formasColection.Add(Convert.ToString(row["DescripcionFOR"])); } cmbForma.AutoCompleteCustomSource = formasColection; cmbForma.AutoCompleteMode = AutoCompleteMode.SuggestAppend; cmbForma.AutoCompleteSource = AutoCompleteSource.CustomSource; lblCosto.Visible = false; txtCosto.Visible = false; grpInicial.CausesValidation = false; grpBotonera.CausesValidation = false; cmbCliente.CausesValidation = false; btnClientes.CausesValidation = false; btnEditar.CausesValidation = false; btnBorrar.CausesValidation = false; btnArticulos.CausesValidation = false; lblNro.ForeColor = System.Drawing.Color.DarkRed; dsVentas = new DataSet(); dsVentas.DataSetName = "dsVentas"; if (tblVentas.DataSet == null) { dsVentas.Tables.Add(tblVentas); dsVentas.Tables.Add(tblVentasDetalle); } tblVentasDetalle.PrimaryKey = new DataColumn[] { tblVentasDetalle.Columns["IdDVEN"] }; viewVentas = new DataView(tblVentas); viewDetalle = new DataView(tblVentasDetalle); bindingSource1.DataSource = viewDetalle; bindingNavigator1.BindingSource = bindingSource1; dgvDatos.ReadOnly = true; dgvDatos.AllowUserToAddRows = false; dgvDatos.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dgvDatos.DataSource = viewDetalle; dgvDatos.AllowUserToOrderColumns = false; dgvDatos.Columns["IdDVEN"].Visible = false; dgvDatos.Columns["IdVentaDVEN"].Visible = false; dgvDatos.Columns["IdLocalDVEN"].Visible = false; dgvDatos.Columns["PrecioCostoDVEN"].Visible = false; dgvDatos.Columns["PrecioMayorDVEN"].Visible = false; dgvDatos.Columns["IdFormaPagoDVEN"].Visible = false; dgvDatos.Columns["NroCuponDVEN"].Visible = false; dgvDatos.Columns["NroFacturaDVEN"].Visible = false; dgvDatos.Columns["IdEmpleadoDVEN"].Visible = false; dgvDatos.Columns["LiquidadoDVEN"].Visible = false; dgvDatos.Columns["EsperaDVEN"].Visible = false; dgvDatos.Columns["DescripcionDVEN"].HeaderText = "Descripción"; dgvDatos.Columns["CantidadDVEN"].Width = 55; dgvDatos.Columns["CantidadDVEN"].HeaderText = "Cantidad"; dgvDatos.Columns["IdArticuloDVEN"].HeaderText = "Artículo"; dgvDatos.Columns["PrecioPublicoDVEN"].Width = 100; dgvDatos.Columns["PrecioPublicoDVEN"].HeaderText = "Precio"; dgvDatos.Columns["NroFacturaDVEN"].Width = 100; dgvDatos.Columns["NroFacturaDVEN"].HeaderText = "Nº fact."; dgvDatos.Columns.Remove("DevolucionDVEN"); dgvDatos.Columns.Remove("IdFormaPagoDVEN"); cmbFormaPago = new DataGridViewComboBoxColumn(); cmbFormaPago.Name = "FormaPago"; cmbFormaPago.HeaderText = "Forma de pago"; cmbFormaPago.DataSource = tblFormasPago; cmbFormaPago.ValueMember = "IdFormaPagoFOR"; cmbFormaPago.DisplayMember = "DescripcionFOR"; cmbFormaPago.DataPropertyName = "IdFormaPagoDVEN"; dgvDatos.Columns.Insert(7, cmbFormaPago); chkDevolucion = new DataGridViewCheckBoxColumn(); chkDevolucion.Name = "DevolucionDVEN"; chkDevolucion.Width = 40; chkDevolucion.HeaderText = "Dev."; chkDevolucion.DataPropertyName = "DevolucionDVEN"; chkDevolucion.TrueValue = 1; chkDevolucion.FalseValue = 0; dgvDatos.Columns.Insert(12, chkDevolucion); if (PK == "") //registro nuevo { tblVentas.PrimaryKey = new DataColumn[] { tblVentas.Columns["IdVentaVEN"] }; tblDetalleOriginal = tblVentasDetalle.Copy(); //tblDetalleOriginal se usa para controlar errores de guardado remoto por falta de internet Random rand = new Random(); int clave = rand.Next(1, 2000000000); bool existe = true; while (existe == true) { DataRow foundRow = dsVentas.Tables["Ventas"].Rows.Find(clave); if (foundRow == null) { existe = false; } else { clave = rand.Next(1, 2000000000); } } lblNro.Text = clave.ToString(); viewVentas.RowStateFilter = DataViewRowState.Added; // viewDetalle.RowStateFilter = DataViewRowState.Added; rowView = viewVentas.AddNew(); rowView["IdVentaVEN"] = clave.ToString(); rowView["FechaVEN"] = DateTime.Now; rowView["IdPCVEN"] = (int)tblPcs.Rows[0]["IdPC"]; rowView.EndEdit(); } else // editar registros { tblDetalleOriginal = tblVentasDetalle.Copy(); //tblDetalleOriginal se usa para controlar errores de guardado remoto por falta de internet viewVentas.RowFilter = "IdVentaVEN = '" + PK + "'"; rowView = viewVentas[0]; viewDetalle.RowFilter = "IdVentaDVEN = '" + PK + "'"; lblNro.Text = viewVentas[0][0].ToString(); cmbLocal.Enabled = false; // viewDetalleOriginal se usa para registrar en tabla fallidas errores de guardado remoto por falta de internet viewDetalleOriginal = new DataView(tblDetalleOriginal); viewDetalleOriginal.RowFilter = "IdVentaDVEN = '" + PK + "'"; } dateTimePicker1.DataBindings.Add("Text", rowView, "FechaVEN", false, DataSourceUpdateMode.OnPropertyChanged); cmbLocal.DataBindings.Add("SelectedValue", rowView, "IdPCVEN", false, DataSourceUpdateMode.OnPropertyChanged); cmbCliente.DataBindings.Add("SelectedValue", rowView, "IdClienteVEN", false, DataSourceUpdateMode.OnPropertyChanged); rowView.CancelEdit(); lblTotal.Text = "$" + CalcularTotal().ToString(); cmbCliente.Validating += new System.ComponentModel.CancelEventHandler(BL.Utilitarios.ValidarComboBox); txtPrecio.KeyPress += new KeyPressEventHandler(BL.Utilitarios.SoloNumerosConComa); txtCantidad.KeyPress += new KeyPressEventHandler(BL.Utilitarios.SoloNumeros); txtArticulo.Enter += new System.EventHandler(Utilitarios.SelTextoTextBox); txtCantidad.Enter += new System.EventHandler(Utilitarios.SelTextoTextBox); txtPrecio.Enter += new System.EventHandler(Utilitarios.SelTextoTextBox); cmbCliente.KeyDown += new System.Windows.Forms.KeyEventHandler(Utilitarios.EnterTab); txtArticulo.KeyDown += new System.Windows.Forms.KeyEventHandler(Utilitarios.EnterTab); txtCantidad.KeyDown += new System.Windows.Forms.KeyEventHandler(Utilitarios.EnterTab); txtPrecio.KeyDown += new System.Windows.Forms.KeyEventHandler(Utilitarios.EnterTab); cmbForma.KeyDown += new System.Windows.Forms.KeyEventHandler(Utilitarios.EnterTab); cmbForma.Validating += new System.ComponentModel.CancelEventHandler(BL.Utilitarios.ValidarComboBox); chkDev.KeyDown += new System.Windows.Forms.KeyEventHandler(Utilitarios.EnterTab); // tblVentasDetalle.ColumnChanged += new DataColumnChangeEventHandler(HabilitarGrabar); SetStateForm(FormState.insercion); }
private void toolStripDebito_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; frmVentas newMDIChild = new frmVentas("debito"); newMDIChild.MdiParent = this; newMDIChild.Show(); Cursor.Current = Cursors.Arrow; }
private void dgvVentas_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) return; if (e.ColumnIndex == dgvVentas.Columns["Editar"].Index) { string idVenta = dgvVentas.CurrentRow.Cells["IdVentaVEN"].Value.ToString(); frmVentas ventas = new frmVentas(idVenta, idPc, tblVentas, tblVentasDetalle); ventas.FormClosed += editVentas_FormClosed; ventas.ShowDialog(); } if (e.ColumnIndex == dgvVentas.Columns["Borrar"].Index) { if (MessageBox.Show("¿Desea borrar este registro y todos los movimientos relacionados?", "Trend Gestión", MessageBoxButtons.YesNo, MessageBoxIcon.Stop) == DialogResult.Yes) { Cursor.Current = Cursors.WaitCursor; try { int PK = Convert.ToInt32(dgvVentas.CurrentRow.Cells["IdVentaVEN"].Value.ToString()); BL.VentasBLL.BorrarByPK(PK); } catch (ServidorMysqlInaccesibleException ex) { MessageBox.Show(ex.Message, "Trend Gestión", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { MessageBox.Show(ex.Message); } Cursor.Current = Cursors.Arrow; } } }
private void ventasToolStripMenuItem_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; frmVentas newMDIChild = new frmVentas("factura"); newMDIChild.MdiParent = this; newMDIChild.Show(); Cursor.Current = Cursors.Arrow; }
public frmArticulos(ref frmVentas f, DataTable tblArticulos) { InitializeComponent(); formVentas = f; this.tablaArticulos = tblArticulos; }
private void frmVentas_Load(object sender, EventArgs e) { System.Globalization.CultureInfo.CurrentCulture.NumberFormat.CurrencyDecimalSeparator = ","; System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator = ","; this.CenterToScreen(); instanciaVentas = this; this.AutoValidate = System.Windows.Forms.AutoValidate.EnablePreventFocusChange; System.Drawing.Icon ico = Properties.Resources.icono_app; this.Icon = ico; this.ControlBox = true; this.MaximizeBox = false; FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; CargarComboLocales(); grpABM.Enabled = false; tblArticulos = BL.GetDataBLL.Articulos(); tblArticulos.TableName = "Articulos"; var source = new AutoCompleteStringCollection(); String[] stringArray = Array.ConvertAll <DataRow, String>(tblArticulos.Select(), delegate(DataRow row) { return((String)row["IdArticuloART"]); }); source.AddRange(stringArray); txtArticulo.AutoCompleteMode = AutoCompleteMode.SuggestAppend; txtArticulo.AutoCompleteCustomSource = source; txtArticulo.AutoCompleteSource = AutoCompleteSource.CustomSource; txtArticulo.BackColor = Color.White; txtDescripcion.BackColor = Color.White; txtDescripcion.TabStop = false; txtDescripcion.ReadOnly = true; txtCantidad.BackColor = Color.White; txtPrecio.BackColor = Color.White; tblFormasPago = BL.GetDataBLL.FormasPago(); cmbForma.ValueMember = "IdFormaPagoFOR"; cmbForma.DisplayMember = "DescripcionFOR"; cmbForma.DropDownStyle = ComboBoxStyle.DropDown; cmbForma.DataSource = tblFormasPago; cmbForma.SelectedValue = -1; cmbForma.BackColor = Color.White; AutoCompleteStringCollection formasPagoColection = new AutoCompleteStringCollection(); foreach (DataRow row in tblFormasPago.Rows) { formasPagoColection.Add(Convert.ToString(row["DescripcionFOR"])); } cmbForma.AutoCompleteCustomSource = formasPagoColection; cmbForma.AutoCompleteMode = AutoCompleteMode.SuggestAppend; cmbForma.AutoCompleteSource = AutoCompleteSource.CustomSource; cmbForma.Validating += new System.ComponentModel.CancelEventHandler(BL.Utilitarios.ValidarComboBox); lblCosto.Visible = false; txtCosto.Visible = false; grpVentas.CausesValidation = false; dateTimePicker1.CausesValidation = false; cmbLocal.CausesValidation = false; cmbCliente.CausesValidation = false; btnClientes.CausesValidation = false; btnEditar.CausesValidation = false; btnBorrar.CausesValidation = false; btnArticulos.CausesValidation = false; dsVentas = new DataSet(); dsVentas.DataSetName = "dsVentas"; if (tblVentas.DataSet == null) { dsVentas.Tables.Add(tblVentas); dsVentas.Tables.Add(tblVentasDetalle); } tblVentasDetalle.PrimaryKey = new DataColumn[] { tblVentasDetalle.Columns["IdDVEN"] }; viewVentas = new DataView(tblVentas); viewDetalle = new DataView(tblVentasDetalle); viewDetalle.Sort = "OrdenarDVEN ASC"; bindingSource1.DataSource = viewDetalle; bindingNavigator1.BindingSource = bindingSource1; dgvDatos.ReadOnly = true; dgvDatos.AllowUserToAddRows = false; dgvDatos.AllowUserToOrderColumns = false; dgvDatos.DataSource = bindingSource1; dgvDatos.Columns["IdDVEN"].Visible = false; dgvDatos.Columns["IdVentaDVEN"].Visible = false; dgvDatos.Columns["IdLocalDVEN"].Visible = false; dgvDatos.Columns["PrecioCostoDVEN"].Visible = false; dgvDatos.Columns["PrecioMayorDVEN"].Visible = false; dgvDatos.Columns["IdFormaPagoDVEN"].Visible = false; dgvDatos.Columns["NroCuponDVEN"].Visible = false; dgvDatos.Columns["IdEmpleadoDVEN"].Visible = false; dgvDatos.Columns["LiquidadoDVEN"].Visible = false; dgvDatos.Columns["EsperaDVEN"].Visible = false; dgvDatos.Columns["OrdenarDVEN"].Visible = false; dgvDatos.Columns["CantidadDVEN"].Width = 55; dgvDatos.Columns["CantidadDVEN"].HeaderText = "Cantidad"; dgvDatos.Columns["IdArticuloDVEN"].HeaderText = "Artículo"; dgvDatos.Columns["DescripcionDVEN"].HeaderText = "Descripción"; dgvDatos.Columns["PrecioPublicoDVEN"].Width = 100; dgvDatos.Columns["PrecioPublicoDVEN"].HeaderText = "Precio"; dgvDatos.Columns["PrecioPublicoDVEN"].DefaultCellStyle.Format = "C2"; dgvDatos.Columns["NroFacturaDVEN"].Width = 100; dgvDatos.Columns["NroFacturaDVEN"].HeaderText = "Nº fact."; dgvDatos.Columns.Remove("DevolucionDVEN"); dgvDatos.Columns.Remove("IdFormaPagoDVEN"); DataGridViewComboBoxColumn cmbFormaPago = new DataGridViewComboBoxColumn(); cmbFormaPago.Name = "FormaPago"; cmbFormaPago.HeaderText = "Forma de pago"; cmbFormaPago.DataSource = tblFormasPago; cmbFormaPago.ValueMember = "IdFormaPagoFOR"; cmbFormaPago.DisplayMember = "DescripcionFOR"; cmbFormaPago.DataPropertyName = "IdFormaPagoDVEN"; dgvDatos.Columns.Insert(7, cmbFormaPago); DataGridViewCheckBoxColumn chkDevolucion = new DataGridViewCheckBoxColumn(); chkDevolucion.Name = "DevolucionDVEN"; chkDevolucion.Width = 40; chkDevolucion.HeaderText = "Dev."; chkDevolucion.DataPropertyName = "DevolucionDVEN"; chkDevolucion.TrueValue = 1; chkDevolucion.FalseValue = 0; dgvDatos.Columns.Insert(12, chkDevolucion); dgvDatos.SelectionMode = DataGridViewSelectionMode.FullRowSelect; lblTotal.Text = "$ 0"; if (PK == "") //registro nuevo { lblNro.ForeColor = System.Drawing.Color.DarkRed; Random rand = new Random(); int clave = rand.Next(-2000000000, 2000000000); lblNro.Text = clave.ToString(); rowView = viewVentas.AddNew(); rowView["IdVentaVEN"] = clave.ToString(); rowView["FechaVEN"] = dateTimePicker1.Value; rowView.EndEdit(); // SetStateForm(FormState.inicial); } else // editar registros { viewVentas.RowFilter = "IdVentaVEN = '" + PK + "'"; rowView = viewVentas[0]; rowView.BeginEdit(); viewDetalle.RowFilter = "IdVentaDVEN = '" + PK + "'"; lblNro.Text = viewVentas[0][0].ToString(); cmbLocal.Enabled = false; lblTotal.Text = "$ " + CalcularTotal(); dateTimePicker1.TabStop = false; cmbLocal.TabStop = false; cmbCliente.Focus(); SetStateForm(FormState.inicial); } dateTimePicker1.DataBindings.Add("Text", rowView, "FechaVEN", false, DataSourceUpdateMode.OnPropertyChanged); cmbLocal.DataBindings.Add("SelectedValue", rowView, "IdPCVEN", false, DataSourceUpdateMode.OnPropertyChanged); cmbCliente.DataBindings.Add("SelectedValue", rowView, "IdClienteVEN", false, DataSourceUpdateMode.OnPropertyChanged); rowView.CancelEdit(); ToolTip tooltip = new ToolTip(); tooltip.SetToolTip(btnClientes, "Agregar nuevo cliente"); cmbLocal.SelectedIndexChanged += new EventHandler(this.ValidarMaestro); cmbCliente.Validating += new System.ComponentModel.CancelEventHandler(BL.Utilitarios.ValidarComboBox); txtPrecio.KeyPress += new KeyPressEventHandler(BL.Utilitarios.SoloNumerosConComa); txtCantidad.KeyPress += new KeyPressEventHandler(BL.Utilitarios.SoloNumeros); txtArticulo.Enter += new System.EventHandler(BL.Utilitarios.SelTextoTextBox); txtCantidad.Enter += new System.EventHandler(BL.Utilitarios.SelTextoTextBox); txtPrecio.Enter += new System.EventHandler(BL.Utilitarios.SelTextoTextBox); cmbForma.Enter += new System.EventHandler(BL.Utilitarios.SelTextoTextBox); txtArticulo.KeyDown += new System.Windows.Forms.KeyEventHandler(BL.Utilitarios.EnterTab); txtCantidad.KeyDown += new System.Windows.Forms.KeyEventHandler(BL.Utilitarios.EnterTab); txtPrecio.KeyDown += new System.Windows.Forms.KeyEventHandler(BL.Utilitarios.EnterTab); cmbForma.KeyDown += new System.Windows.Forms.KeyEventHandler(BL.Utilitarios.EnterTab); chkDev.KeyDown += new System.Windows.Forms.KeyEventHandler(BL.Utilitarios.EnterTab); }