private void dgOrdenPedido_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                DataGridViewRow dRow = dgOrdenPedido.Rows[e.RowIndex];
                _drow = dRow.Index.ToString();

                EOrdPedido_Detalle obj = new EOrdPedido_Detalle();

                obj.NuItem = (dRow.Cells["NuItem"].Value == null) ? "" : dRow.Cells["NuItem"].Value.ToString();

                obj.Id_clipro = (dRow.Cells["id_clipro"].Value == null) ? "" : dRow.Cells["id_clipro"].Value.ToString();
                obj.ds_clipro = (dRow.Cells["ds_clipro"].Value == null) ? "" : dRow.Cells["ds_clipro"].Value.ToString();

                obj.Id_producto = (dRow.Cells["Codigo"].Value == null) ? "" : dRow.Cells["Codigo"].Value.ToString();
                obj.ds_producto = (dRow.Cells["Articulo"].Value == null) ? "" : dRow.Cells["Articulo"].Value.ToString();
                obj.Id_color = (dRow.Cells["idcolor"].Value == null) ? "" : dRow.Cells["idcolor"].Value.ToString();
                obj.DsColor = (dRow.Cells["Color"].Value == null) ? "" : dRow.Cells["Color"].Value.ToString();
                obj.Qt_rollo = (dRow.Cells["nu_rollo"].Value == null) ? 0 : Convert.ToInt32(dRow.Cells["nu_rollo"].Value.ToString());
                obj.Qt_peso = (dRow.Cells["Peso_desp"].Value == null) ? 0 : Convert.ToDecimal(dRow.Cells["Peso_desp"].Value.ToString());

                obj.Id_vendedor = (dRow.Cells["id_Vendedor"].Value == null) ? "" : dRow.Cells["id_Vendedor"].Value.ToString();
                obj.Ds_vendedor = (dRow.Cells["ds_Vendedor"].Value == null) ? "" : dRow.Cells["ds_Vendedor"].Value.ToString();

                obj.Mt_preunit_actual = (dRow.Cells["precio_unitario"].Value == null) ? 0 : Convert.ToDecimal(dRow.Cells["precio_unitario"].Value.ToString());

                string chkCell = dRow.Cells["chkIgv"].Value.ToString();
                obj._igvActivo = Convert.ToBoolean(chkCell);
                obj.St_estado = (dRow.Cells["st_estado"].Value == null) ? "" : (dRow.Cells["st_estado"].Value.ToString());

                frmopProductoPopup frm = new frmopProductoPopup();

                    frm.FormParent = this;
                    frm.EstadoDet = 2;
                    frm.nuOp = txtid_op.Text;
                    frm.dscliente = txtds_cliente.Text;
                    frm.dsvendedor = txtds_vendedor.Text;
                    frm.LLenarCampos(obj);
                    frm.ShowDialog();

                //if (editar == "0")
                //{

                //}
                //else
                //{
                //    frm.FormParent = this;
                //    frm.EstadoDet = 1;
                //    frm.nuOp = txtid_op.Text;
                //    frm.dscliente = txtds_cliente.Text;
                //    frm.dsvendedor = txtds_vendedor.Text;
                //    frm.LLenarCampos(obj);
                //    frm.ShowDialog();
                //}

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void FrmOrdenPedido_mnt_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.N && e.Control)
            {
                Nuevo();
            }
            else if (e.KeyCode == Keys.G && e.Control)
            {

                //var cliente = txtid_cliente.Text;
                //var dir = txtds_direccion.Text;
                //var id_prioridad = txtid_prioridad.Text;
                //var id_vendedor = txtid_vendedor.Text;
                //var id_formapago = txtid_formapago.Text;
                //var id_documento = txtid_documento.Text;

                //if ((cliente != "") & (dir != "") & (id_prioridad != "") & (id_vendedor != "") & (id_formapago != "") & (id_documento != ""))
                //{
                //    Grabar();
                //}
                //else
                //{
                //    MessageBox.Show("Falta ingresar un dato", "Verificar", MessageBoxButtons.OK, MessageBoxIcon.Error);

                //}

            }
            else if (e.KeyCode == Keys.C && e.Control)
            {

            }
            else if (e.KeyCode == Keys.P && e.Control)
            {
                FrmOrdenPedido_rpt01 frm = new FrmOrdenPedido_rpt01();
                frm.nuop = txtid_op.Text;
                frm.ShowDialog();
            }
            else if (e.KeyCode == Keys.B && e.Control)
            {
                FrmOrdenPedido_qry frmoc = new FrmOrdenPedido_qry();
                frmoc.pasard += new FrmOrdenPedido_qry.pasar(EjecutarOP);
                frmoc.ShowDialog();

            }

            else if (e.KeyCode == Keys.E && e.Control)
            {
                //HabilitarTexto(groupBox2);

                //DateTime fecha = DateTime.Now;
                //txtFechaOc.Text = fecha.ToString("d");
                //txtFechaEntrega.Text = fecha.ToString("d");

                //List<Dato> oListUsu = BOrdenCompra.OrderCompra_Usuario_qry_(frmLogin.d.dsu);
                //if (oListUsu.Count > 0)
                //{
                //    txtEmitidoPor.Text = oListUsu[0].id;
                //    lblEmitidoPor.Text = oListUsu[0].desc;
                //}
                //txtFechaOc.Focus();

            }
            else if (e.KeyCode == Keys.Escape)
            {
                //this.Close();
            }

            else if (e.KeyCode == Keys.I && e.Control)
            {
                frmopProductoPopup frmps = new frmopProductoPopup();
                frmps.FormParent = this;

                if (txtid_vendedor.Text != "")
                {
                    frmps.EstadoDet = 1;
                    frmps.dscliente = txtds_cliente.Text;
                    frmps.dsvendedor = txtds_vendedor.Text;
                    txtid_vendedor.Enabled = false;
                    btnvendedor.Enabled = false;
                    txtds_vendedor.Enabled = false;
                    frmps.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Ingrese el vendedor", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);

                }

            }
        }
        private void btnNuevoRow_Click(object sender, EventArgs e)
        {
            frmopProductoPopup frmps = new frmopProductoPopup();
            frmps.FormParent = this;

            if (txtid_vendedor.Text != "")
            {
                frmps.EstadoDet = 1;
                frmps.dscliente = txtds_cliente.Text;
                frmps.dsvendedor = txtds_vendedor.Text;
                txtid_vendedor.Enabled = false;
                btnvendedor.Enabled = false;
                txtds_vendedor.Enabled = false;
                frmps.ShowDialog();
            }
            else
            {
                MessageBox.Show("Ingrese el vendedor","Información",MessageBoxButtons.OK,MessageBoxIcon.Information);

            }
        }