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); }
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); }