示例#1
0
        /// <summary>
        /// Almacena el registro de una ENTIDAD de registro de Tipo ListaDePrecioDetalle
        /// En la BASE de DATO la Tabla : [GestionComercial.ListaDePrecioDetalle]
        /// <summary>
        /// <param name="itemListaDePrecioDetalle"></param>
        /// <param name="listaProductoPrecio"></param>
        /// <returns></returns>
        public ReturnValor UpdateDetalle(BEListaDePrecioDetalle itemListaDePrecioDetalle, List <BEProductoPrecio> listaProductoPrecio)
        {
            DTOResponseProcedure objProductoPrecio = null;

            try
            {
                using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required))
                {
                    int indPrecioUpdate = -1;
                    returnValor.Exitosa = listaDePrecioDetalleData.Update(itemListaDePrecioDetalle);

                    ProductoPrecioData productoPrecioData = new ProductoPrecioData();
                    //listaProductoPrecio = oProductoPrecioData.List(itemListaDePrecioDetalle.CodigoProducto, string.Empty, null, itemListaDePrecioDetalle.CodigoPersonaEmpre, itemListaDePrecioDetalle.CodigoPuntoVenta, true);
                    if (listaProductoPrecio.Count == 1)
                    {
                        if (itemListaDePrecioDetalle.refEsParaVenta)
                        {
                            listaProductoPrecio[0].ValorVenta = itemListaDePrecioDetalle.PrecioUnitario;
                        }
                        else
                        {
                            listaProductoPrecio[0].ValorCosto = itemListaDePrecioDetalle.PrecioUnitario;
                        }
                        listaProductoPrecio[0].segUsuarioCrea  = itemListaDePrecioDetalle.segUsuarioEdita;
                        listaProductoPrecio[0].segUsuarioEdita = itemListaDePrecioDetalle.segUsuarioEdita;
                        objProductoPrecio = productoPrecioData.InsertUpdate(listaProductoPrecio[0]);
                    }
                    if (returnValor.Exitosa && objProductoPrecio.ErrorCode > 0)
                    {
                        returnValor.Message = HelpEventos.MessageEvento(HelpEventos.Process.EDIT);
                        tx.Complete();
                    }
                }
            }
            catch (Exception ex)
            {
                returnValor = HelpException.mTraerMensaje(ex);
            }
            return(returnValor);
        }
示例#2
0
        /// <summary>
        /// Almacena el registro de una ENTIDAD de registro de Tipo ListaDePrecioDetalle
        /// En la BASE de DATO la Tabla : [GestionComercial.ListaDePrecioDetalle]
        /// <summary>
        /// <param name="listaDePrecioDetalle"></param>
        /// <returns></returns>
        public int Insert(BEListaDePrecioDetalle listaDePrecioDetalle)
        {
            int?codigoRetorno = -1;

            try
            {
                using (_GestionComercialDataContext SQLDC = new _GestionComercialDataContext(conexion))
                {
                    SQLDC.omgc_I_ListaDePrecioDetalle(
                        ref codigoRetorno,
                        listaDePrecioDetalle.CodigoLista,
                        listaDePrecioDetalle.codProducto,
                        listaDePrecioDetalle.CodigoArguMoneda,
                        listaDePrecioDetalle.PrecioUnitario,
                        listaDePrecioDetalle.Estado,
                        listaDePrecioDetalle.segUsuarioCrea);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(codigoRetorno == null ? 0 : codigoRetorno.Value);
        }
示例#3
0
        /// <summary>
        /// Almacena el registro de una ENTIDAD de registro de Tipo ListaDePrecioDetalle
        /// En la BASE de DATO la Tabla : [GestionComercial.ListaDePrecioDetalle]
        /// <summary>
        /// <param name="lListaDePrecioDetalle"></param>
        /// <returns></returns>
        public bool Update(BEListaDePrecioDetalle listaDePrecioDetalle)
        {
            int codigoRetorno = -1;

            try
            {
                using (_GestionComercialDataContext SQLDC = new _GestionComercialDataContext(conexion))
                {
                    codigoRetorno = SQLDC.omgc_U_ListaDePrecioDetalle(
                        listaDePrecioDetalle.codListaDePrecioDetalle,
                        listaDePrecioDetalle.CodigoLista,
                        listaDePrecioDetalle.codProducto,
                        listaDePrecioDetalle.CodigoArguMoneda,
                        listaDePrecioDetalle.PrecioUnitario,
                        listaDePrecioDetalle.Estado,
                        listaDePrecioDetalle.segUsuarioEdita);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(codigoRetorno == 0 ? true : false);
        }
示例#4
0
        public List <BEListaDePrecioDetalle> ListDesdeStock(BaseFiltro filtro) //, string prm_CodigoPersonaEmpre, string prm_CodigoPuntoVenta, string prm_codDeposito, string prm_CodigoArguMoneda, bool prm_EsParaVentas, string prm_CodigoLista, string prm_UsuarioLogin)
        {
            List <BEListaDePrecioDetalle> lstListaDePrecioDetalle = new List <BEListaDePrecioDetalle>();
            List <BEProducto>             lstProducto             = new List <BEProducto>();
            List <BEProducto>             lstProductoDep          = new List <BEProducto>();
            List <BEProductoPrecio>       lstProductoPrecio       = new List <BEProductoPrecio>();
            BETipoDeCambio itemTiposDeCambio = new BETipoDeCambio();

            try
            {
                ProductoLogic      productoLogic       = new ProductoLogic();
                ProductoPrecioData oProductoPrecioData = new ProductoPrecioData();
                TipoDeCambioLogic  oTiposdeCambioLogic = new TipoDeCambioLogic();
                lstProducto = productoLogic.List(new BaseFiltroAlmacen
                {
                    codPerEmpresa       = filtro.codPerEmpresa,
                    codDeposito         = string.Empty,
                    codProductoRefer    = string.Empty,
                    codProducto         = null,
                    desNombre           = string.Empty,
                    desComercial        = string.Empty,
                    codRegMarca         = string.Empty,
                    codRegTipo          = string.Empty,
                    indDestinoCompra    = true,
                    indDestinaVenta     = true,
                    codRegCentroProducc = string.Empty,
                    codRegCategoria     = string.Empty,
                    codRegUnidadMedida  = string.Empty,
                    indEstado           = true,
                    desPalabraClave     = string.Empty,
                    indTodos            = true
                });
                itemTiposDeCambio = oTiposdeCambioLogic.Find(new BaseFiltro
                {
                    fecInicioDate = DateTime.Now,
                    codRegMoneda  = ConfigCROM.AppConfig(ConfigTool.DEFAULT_MonedaInt)
                });
                foreach (BEProducto xProducto in lstProducto)
                {
                    if (xProducto.EsListaPrecio)
                    {
                        BEProducto productoNew = new BEProducto();
                        filtro.codProducto = xProducto.codProducto;
                        BaseFiltroAlmacen filtroAlmacen = new BaseFiltroAlmacen
                        {
                            codProductoRefer = filtro.codProductoRefer,
                            codProducto      = filtro.codProducto.Value
                        };
                        productoNew = productoLogic.Find(filtroAlmacen);
                        productoNew.itemProductoPrecio.codProducto          = xProducto.codProducto;
                        productoNew.itemProductoPrecio.CodigoProductoNombre = productoNew.Descripcion;
                        lstProductoPrecio.Add(productoNew.itemProductoPrecio);
                    }
                }
                filtro.codProducto = null;
                foreach (BEProductoPrecio itemproductoPrecio in lstProductoPrecio)
                {
                    BEListaDePrecioDetalle itemlistaDePrecioDetalle = new BEListaDePrecioDetalle
                    {
                        CodigoArguMoneda     = filtro.codRegMoneda,
                        codProducto          = itemproductoPrecio.codProducto,
                        CodigoProducto       = itemproductoPrecio.CodigoProducto,
                        Estado               = itemproductoPrecio.Estado,
                        segFechaEdita        = DateTime.Now,
                        segUsuarioEdita      = filtro.segUsuarioEdita,
                        CodigoProductoNombre = itemproductoPrecio.CodigoProductoNombre,
                        CodigoLista          = filtro.codListaPrecio,
                        segUsuarioCrea       = filtro.segUsuarioEdita,
                        segFechaCrea         = DateTime.Now,
                        CodigoPersonaEmpre   = filtro.codPerEmpresa,
                        CodigoPuntoVenta     = filtro.codPuntoVenta,
                    };
                    decimal PRECIO_A_TOMAR = 0;
                    if (filtro.indParaVenta.Value)
                    {
                        PRECIO_A_TOMAR = itemproductoPrecio.ValorVenta;
                    }
                    else
                    {
                        PRECIO_A_TOMAR = itemproductoPrecio.ValorCosto;
                    }

                    if (itemproductoPrecio.CodigoArguMoneda == filtro.codRegMoneda)
                    {
                        itemlistaDePrecioDetalle.PrecioUnitario = PRECIO_A_TOMAR;
                    }
                    else
                    {
                        if (filtro.codRegMoneda == ConfigCROM.AppConfig(ConfigTool.DEFAULT_MonedaNac))
                        {
                            if (itemproductoPrecio.CodigoArguMoneda == filtro.codRegMoneda)
                            {
                                itemlistaDePrecioDetalle.PrecioUnitario = PRECIO_A_TOMAR;
                            }
                            else
                            {
                                itemlistaDePrecioDetalle.PrecioUnitario = Helper.DecimalRound(PRECIO_A_TOMAR * itemTiposDeCambio.CambioVentasPRL, 2);
                            }
                        }
                        if (filtro.codRegMoneda == ConfigCROM.AppConfig(ConfigTool.DEFAULT_MonedaInt))
                        {
                            if (itemproductoPrecio.CodigoArguMoneda == filtro.codRegMoneda)
                            {
                                itemlistaDePrecioDetalle.PrecioUnitario = PRECIO_A_TOMAR;
                            }
                            else
                            {
                                itemlistaDePrecioDetalle.PrecioUnitario = Helper.DecimalRound(PRECIO_A_TOMAR / itemTiposDeCambio.CambioVentasPRL, 2);
                            }
                        }
                    }
                    lstListaDePrecioDetalle.Add(itemlistaDePrecioDetalle);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(lstListaDePrecioDetalle);
        }
示例#5
0
        public List <BEListaDePrecioDetalle> ListDesdeStockCompras(BaseFiltro filtro) // string prm_CodigoPersonaEmpre, string prm_CodigoPuntoVenta, string prm_codDeposito, string prm_CodigoArguMoneda, bool prm_ParaCompras, bool prm_ParaVentas, string prm_CodigoLista, string prm_UsuarioLogin)
        {
            List <BEListaDePrecioDetalle> lstListaDePrecioDetalle = new List <BEListaDePrecioDetalle>();
            List <DTOProductoResponse>    lstProducto             = new List <DTOProductoResponse>();
            List <BEProducto>             lstProductoDep          = new List <BEProducto>();
            List <BEProductoPrecio>       lstProductoPrecio       = new List <BEProductoPrecio>();
            BETipoDeCambio tipoDeCambio = new BETipoDeCambio();

            try
            {
                ProductoLogic      oProductoLogic      = new ProductoLogic();
                ProductoPrecioData oProductoPrecioData = new ProductoPrecioData();
                TipoDeCambioLogic  oTiposdeCambioLogic = new TipoDeCambioLogic();
                lstProducto = oProductoLogic.List(new BaseFiltroProducto
                {
                    codEmpresaRUC       = filtro.codEmpresaRUC,
                    codDeposito         = string.Empty,
                    codProductoRefer    = string.Empty,
                    desNombre           = string.Empty,
                    desComercial        = string.Empty,
                    codMarca            = null,
                    codRegTipo          = string.Empty,
                    indDestinoCompra    = true,
                    indDestinaVenta     = true,
                    codRegCentroProducc = string.Empty,
                    codRegCategoria     = string.Empty,
                    codRegUnidadMedida  = string.Empty,
                    indEstado           = true,
                    desPalabraClave     = string.Empty,
                    indTodos            = true
                });

                tipoDeCambio = oTiposdeCambioLogic.Find(new BaseFiltroTipoCambio
                {
                    codEmpresa    = filtro.codEmpresa,
                    fecInicioDate = DateTime.Now,
                    codRegMoneda  = ConfigCROM.AppConfig(filtro.codEmpresa, ConfigTool.DEFAULT_MonedaInt)
                });

                foreach (DTOProductoResponse xProducto in lstProducto)
                {
                    if (xProducto.EsListaPrecio)
                    {
                        BEProducto productoNew = new BEProducto();
                        productoNew = oProductoLogic.Find(new BaseFiltroAlmacen
                        {
                            codEmpresa  = filtro.codEmpresa,
                            codProducto = xProducto.codProducto
                        });

                        productoNew.itemProductoPrecio.CodigoProductoNombre = productoNew.Descripcion;
                        lstProductoPrecio.Add(productoNew.itemProductoPrecio);
                    }
                }
                filtro.codProducto = null;
                foreach (BEProductoPrecio itemproductoPrecio in lstProductoPrecio)
                {
                    BEListaDePrecioDetalle xlstListaDePrecioDetalle = new BEListaDePrecioDetalle
                    {
                        CodigoArguMoneda     = filtro.codRegMoneda,
                        codProducto          = itemproductoPrecio.codProducto,
                        CodigoProducto       = itemproductoPrecio.CodigoProducto,
                        Estado               = itemproductoPrecio.Estado,
                        segFechaEdita        = DateTime.Now,
                        segUsuarioEdita      = filtro.segUsuarioEdita,
                        CodigoProductoNombre = itemproductoPrecio.CodigoProductoNombre,
                        CodigoLista          = filtro.codListaPrecio,
                        segUsuarioCrea       = filtro.segUsuarioEdita,
                        segFechaCrea         = DateTime.Now,
                        CodigoPersonaEmpre   = filtro.codEmpresaRUC,
                        CodigoPuntoVenta     = filtro.codPuntoVenta,
                    };
                    if (itemproductoPrecio.CodigoArguMoneda == filtro.codRegMoneda)
                    {
                        xlstListaDePrecioDetalle.PrecioUnitario = itemproductoPrecio.ValorVenta;
                    }
                    else
                    {
                        if (filtro.codRegMoneda == ConfigCROM.AppConfig(filtro.codEmpresa, ConfigTool.DEFAULT_MonedaNac))
                        {
                            if (itemproductoPrecio.CodigoArguMoneda == filtro.codRegMoneda)
                            {
                                xlstListaDePrecioDetalle.PrecioUnitario = itemproductoPrecio.ValorVenta;
                            }
                            else
                            {
                                xlstListaDePrecioDetalle.PrecioUnitario = Helper.DecimalRound(itemproductoPrecio.ValorVenta * tipoDeCambio.CambioVentasPRL, 2);
                            }
                        }
                        if (filtro.codRegMoneda == ConfigCROM.AppConfig(filtro.codEmpresa, ConfigTool.DEFAULT_MonedaInt))
                        {
                            if (itemproductoPrecio.CodigoArguMoneda == filtro.codRegMoneda)
                            {
                                xlstListaDePrecioDetalle.PrecioUnitario = itemproductoPrecio.ValorVenta;
                            }
                            else
                            {
                                xlstListaDePrecioDetalle.PrecioUnitario = Helper.DecimalRound(itemproductoPrecio.ValorVenta / tipoDeCambio.CambioVentasPRL, 2);
                            }
                        }
                    }
                    lstListaDePrecioDetalle.Add(xlstListaDePrecioDetalle);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(lstListaDePrecioDetalle);
        }