public List<clsIngresoEgresoDET> consultaIEDetalle(int nroMov)
 {
     try
     {
         List<clsIngresoEgresoDET> lista = new List<clsIngresoEgresoDET>();
         INVENTARIOEntities ent = new INVENTARIOEntities();
         var sel = from q in ent.IngresoEgresoDet where q.NroMovimiento==nroMov select q;
         foreach (var item in sel)
         {
             clsIngresoEgresoDET clas = new clsIngresoEgresoDET();
             clas.articulo = Convert.ToInt32(item.IdArticulo);
             clas.cantidadPedida = item.Cantidad;
             clas.articulo = item.IdArticulo;
             try
             {
                 clas.NombrePercha = (from q in ent.Percha where q.IdPercha == item.IdPercha select q.Descripcion).First();
                 clas.NombreArticulo = (from q in ent.Articulo where q.IdArticulo == item.IdArticulo select q.Descripcion).First();
             }
             catch (Exception)
             {
             }
             clas.percha = item.IdPercha;
             clas.numero = item.numero;
             clas.empresa = item.IdEmpresa;
             clas.nroMovimiento = item.NroMovimiento;
             lista.Add(clas);
         }
         return lista;
     }
     catch (Exception)
     {
         return null;
     }
 }
        public List<clsIngresoEgresoDET> consulta()
        {
            try
            {

                List<clsIngresoEgresoDET> lista = new List<clsIngresoEgresoDET>();
                INVENTARIOEntities ent = new INVENTARIOEntities();
                var con = from w in ent.IngresoEgresoDet select w;
                foreach (var item in con)
                {
                    clsIngresoEgresoDET clas = new clsIngresoEgresoDET();
                    clas.empresa = Convert.ToInt32(item.IdEmpresa);
                    clas.nroMovimiento = Convert.ToInt32(item.NroMovimiento);
                    clas.numero = Convert.ToInt32(item.numero);
                    clas.tipoArticulo = Convert.ToInt32(item.IdTipoArticulo);
                    clas.articulo = Convert.ToInt32(item.IdArticulo);
                    clas.percha = Convert.ToInt32(item.IdPercha);
                    clas.grupo = Convert.ToInt32(item.IdGrupo);
                    clas.cantidadLlegada = Convert.ToInt32(item.CantidadLlegada);
                    clas.cantidadPedida = Convert.ToInt32(item.CantidadPedida);
                    clas.costo = Convert.ToInt32(item.Costo);
                    clas.subTotal = Convert.ToInt32(item.Subtotal);
                    clas.valorIVA = Convert.ToInt32(item.ValorIVA);
                    clas.valorTotal = Convert.ToInt32(item.ValorTotal);
                }

                return lista;
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error : " + ex);
                return null;
            }
        }
        public void get()
        {
            try
            {
                gwIE.OptionsView.NewItemRowPosition = DevExpress.XtraGrid.Views.Grid.NewItemRowPosition.None;
                List<clsIngresoEgresoDET> lst = new List<clsIngresoEgresoDET>();
                for (int i = 0; i < gwIE.RowCount; i++)
                {
                    clsIngresoEgresoDET cls = new clsIngresoEgresoDET();
                    cls.articulo = Convert.ToInt32(gwIE.GetRowCellValue(i,colarticulo));
                    cls.percha = Convert.ToInt32(gwIE.GetRowCellValue(i, colpercha));
                    cls.cantidadPedida = Convert.ToInt32(gwIE.GetRowCellValue(i, colcantidadPedida));
                    lst.Add(cls);
                }
                oIngresoEgreso.detalle = lst;
                gwIE.OptionsView.NewItemRowPosition = DevExpress.XtraGrid.Views.Grid.NewItemRowPosition.Bottom;

            oIngresoEgreso.empresa = EU;
            try
            {
                oIngresoEgreso.nroMovimiento = Convert.ToInt32(txtNoMovimiento.Text);

            }
            catch (Exception)
            {
            }
            oIngresoEgreso.tipoMovimiento = Convert.ToInt32(cbxTipoMovimiento.EditValue);
            //oIngresoEgreso.ordenCompra = Convert.ToInt32(txtOrdenCompra.Text);
            oIngresoEgreso.motivo = Convert.ToInt32(cbxTipoMovimiento.EditValue);
            oIngresoEgreso.fechaMovimiento = Convert.ToDateTime(dateFecmov.Value);
            oIngresoEgreso.bodega = Convert.ToInt32(cbxBodega.EditValue);
            oIngresoEgreso.responsable = Convert.ToInt32(cbxResponsable.EditValue);
            oIngresoEgreso.estado = Convert.ToInt32(cbxEstado.EditValue);
            oIngresoEgreso.observacion = txtObservacion.Text;
            oIngresoEgreso.totalPagar = Convert.ToDecimal(txtTotalPagar.Text);
            if (cbxTipoMovimiento.SelectedText == "Ingreso" && cbxMotivo.SelectedText == "Compra")
            {
                TabControl_IngEg.Show();
                Compra.PageEnabled = true;
                oIngresoEgreso1.articulo = Convert.ToInt32(cbxArticulo.EditValue);
                oIngresoEgreso1.percha = Convert.ToInt32(cbxPercha.EditValue);
                oIngresoEgreso1.cantidadPedida = Convert.ToInt32(txtCanPedida.Text);
                oIngresoEgreso1.cantidadLlegada = Convert.ToInt32(txtCantLlegada.Text);
                oIngresoEgreso1.costo = Convert.ToInt32(txtPrecio.Text);
                oIngresoEgreso1.subTotal = Convert.ToDecimal(txtSubtotal.Text);
                oIngresoEgreso1.valorIVA = Convert.ToDecimal(txtValorIVA.Text);
                oIngresoEgreso1.valorTotal = Convert.ToDecimal(txtValorTotal.Text);
            }
            if (cbxTipoMovimiento.SelectedText == "Ingreso" && cbxMotivo.SelectedText == "Donacion")
            {
                Donacion.PageEnabled = false;
                oIngresoEgreso1.articulo = Convert.ToInt32(cbxArt1.EditValue);
                oIngresoEgreso1.percha = Convert.ToInt32(cbxPercha1.EditValue);
                oIngresoEgreso1.cantidadLlegada = Convert.ToInt32(txtCantidad.Text);

            }
            if (cbxTipoMovimiento.SelectedText == "Egreso" && cbxMotivo.SelectedText == "Robo/Perdida")
            {
                RoboPerdida.PageEnabled = false;
                oIngresoEgreso1.articulo = Convert.ToInt32(cbxArticulo2.EditValue);
                oIngresoEgreso1.percha = Convert.ToInt32(cbxPercha2.EditValue);
                oIngresoEgreso1.cantidadLlegada = Convert.ToInt32(txtCant.Text);

            }
            }
            catch (Exception)
            {
            }
        }