private void toolStripMenuItem1_Click(object sender, EventArgs e) { frmABProducto frmAB = new frmABProducto(); frmAB.txtcodigodebarras.ReadOnly = false; frmAB.LimpiarCotroles(); frmABProducto.EsNuevo = true; frmAB.FormClosing += frm_FormClosing; frmAB.ShowDialog(); //panelCategoria.Visible = false; //pnlABProducto.Visible = true; //LlenarCategorias(); }
private void EditarProducto() { frmABProducto frmAB = new frmABProducto(); frmABProducto.TipoPresentacion = gdvProductos.SelectedCells[4].Value.ToString(); frmABProducto.Categoria = gdvProductos.SelectedCells[3].Value.ToString(); string _strPMenudeo = gdvProductos.SelectedCells[21].Value.ToString(); frmABProducto.PresentacionMenudeo = _strPMenudeo; frmABProducto.EsNuevo = false; frmAB.txtcodigodebarras.ReadOnly = true; frmAB.lblIdProducto.Text = gdvProductos.SelectedCells[2].Value.ToString(); // lblIdProducto.Text = gdvProductos.SelectedCells[2].Value.ToString(); //frmAB.cboCategoria.SelectedValue = gdvProductos.SelectedCells[3].Value.ToString(); //frmAB.cboPresentacion.SelectedValue = gdvProductos.SelectedCells[4].Value.ToString(); frmAB.txtcodigodebarras.Text = gdvProductos.SelectedCells[5].Value.ToString(); frmAB.txtdescripcion.Text = gdvProductos.SelectedCells[6].Value.ToString(); frmAB.txtPresentacion.Text = gdvProductos.SelectedCells[7].Value.ToString(); if (gdvProductos.SelectedCells[8].Value.ToString() == "UNIDAD") { frmAB.porunidad.Checked = true; } else { frmAB.agranel.Checked = true; } frmAB.txtPMenudeo.Text = gdvProductos.SelectedCells[9].Value.ToString(); frmAB.txtPMMayoreo.Text = gdvProductos.SelectedCells[10].Value.ToString(); frmAB.txtApartirDe.Text = gdvProductos.SelectedCells[11].Value.ToString(); frmAB.txtpreciomayoreo.Text = gdvProductos.SelectedCells[12].Value.ToString(); string inventario = gdvProductos.SelectedCells[13].Value.ToString(); frmAB.txtTotalUnidades.Text = gdvProductos.SelectedCells[20].Value.ToString(); if (inventario == "SI") { frmAB.CheckInventarios.Checked = true; frmAB.PANELINVENTARIO.Visible = true; decimal _totalUnidad = Convert.ToDecimal(frmAB.txtTotalUnidades.Text); decimal _stockMaximo = Convert.ToDecimal(gdvProductos.SelectedCells[14].Value); decimal _stockMinimo = Convert.ToDecimal(gdvProductos.SelectedCells[15].Value); decimal _unidades = (_stockMaximo % _totalUnidad); frmAB.lblPiezasStock.Text = _unidades.ToString(); frmAB.txtstock2.Text = Math.Floor((_stockMaximo / _totalUnidad)).ToString(); frmAB.txtstockminimo.Text = (_stockMinimo / _totalUnidad).ToString(); } else { frmAB.CheckInventarios.Checked = false; frmAB.PANELINVENTARIO.Visible = false; } // txtstockminimo.Text = gdvProductos.SelectedCells[15].Value.ToString(); string fecha = gdvProductos.SelectedCells[16].Value.ToString(); bool res = (fecha == "NO APLICA") ? frmAB.No_aplica_fecha.Checked = true : frmAB.No_aplica_fecha.Checked = false; frmAB.txtfechaoka.Text = (!res) ? fecha : null; frmAB.FormClosing += frm_FormClosing; frmAB.ShowDialog(); }