public async Task <ICollection <DetalleLiquidacionParaArchivo> > ObtenerListaDetalleLiquidacionParaArchivo(List <int> listaLiquidacionId, int pciId) { List <DetalleLiquidacionParaArchivo> listaFinal = new List <DetalleLiquidacionParaArchivo>(); string identificacionPCI = string.Empty; var pci = await _listaRepository.ObtenerPci(pciId); if (pci != null) { identificacionPCI = pci.Identificacion; } var lista = await(from dl in _context.DetalleLiquidacion join t in _context.Tercero on dl.TerceroId equals t.TerceroId join p in _context.ParametroLiquidacionTercero on dl.TerceroId equals p.TerceroId into parametroLiquidacion from pl in parametroLiquidacion.DefaultIfEmpty() join tc in _context.TipoCuentaXPagar on pl.TipoCuentaXPagarId equals tc.TipoCuentaXPagarId into CuentaPorPagar from tiCu in CuentaPorPagar.DefaultIfEmpty() join tds in _context.TipoDocumentoSoporte on pl.TipoDocumentoSoporteId equals tds.TipoDocumentoSoporteId into DocumentoSoporte from tipoDocu in DocumentoSoporte.DefaultIfEmpty() where dl.PciId == pl.PciId where (listaLiquidacionId.Contains(dl.DetalleLiquidacionId)) where dl.PciId == pciId where (dl.Procesado == false) select new DetalleLiquidacionParaArchivo() { PCI = identificacionPCI, FechaActual = System.DateTime.Now.ToString("yyyy-MM-dd"), TipoIdentificacion = t.TipoIdentificacion, NumeroIdentificacion = t.NumeroIdentificacion, Crp = dl.Crp, TipoCuentaXPagarCodigo = pl.TipoCuentaXPagarId > 0 ? tiCu.Codigo : string.Empty, TotalACancelar = decimal.Round(dl.TotalACancelar, 2, MidpointRounding.AwayFromZero), ValorIva = decimal.Round(dl.ValorIva, 2, MidpointRounding.AwayFromZero), TextoComprobanteContable = dl.TextoComprobanteContable.Length > 220 ? dl.TextoComprobanteContable.Substring(0, 220) : dl.TextoComprobanteContable, TipoDocumentoSoporteCodigo = pl.TipoDocumentoSoporteId > 0 ? tipoDocu.Codigo : string.Empty, NumeroFactura = dl.NumeroFactura, ConstanteNumero = "16", NombreSupervisor = dl.NombreSupervisor, ConstanteCargo = "CargoSupervisor", FechaRegistro = dl.FechaRegistro.Value }) .ToListAsync(); if (lista != null && lista.Count > 0) { listaFinal = lista.OrderBy(x => x.FechaRegistro).ToList(); } return(listaFinal); }
public async Task <ICollection <DetalleLiquidacionParaArchivo> > ObtenerCabeceraParaArchivoObligacion(List <int> listaLiquidacionId, int pciId) { List <DetalleLiquidacionParaArchivo> listaFinal = new List <DetalleLiquidacionParaArchivo>(); string identificacionPCI = string.Empty; var pci = await _listaRepository.ObtenerPci(pciId); if (pci != null) { identificacionPCI = pci.Identificacion; } var lista = await(from dl in _context.DetalleLiquidacion join t in _context.Tercero on dl.TerceroId equals t.TerceroId join p in _context.ParametroLiquidacionTercero on dl.TerceroId equals p.TerceroId into parametroLiquidacion from pl in parametroLiquidacion.DefaultIfEmpty() join tc in _context.TipoCuentaXPagar on pl.TipoCuentaXPagarId equals tc.TipoCuentaXPagarId into CuentaPorPagar from tiCu in CuentaPorPagar.DefaultIfEmpty() join td in _context.TipoDocumentoSoporte on pl.TipoDocumentoSoporteId equals td.TipoDocumentoSoporteId into TipoDocumento from tiDo in TipoDocumento.DefaultIfEmpty() where dl.PciId == pl.PciId where (listaLiquidacionId.Contains(dl.DetalleLiquidacionId)) select new DetalleLiquidacionParaArchivo() { FechaActual = System.DateTime.Now.ToString("yyyy/MM/dd"), PCI = identificacionPCI, Crp = dl.Crp, Dip = "NO", TipoCuentaXPagarCodigo = pl.TipoCuentaXPagarId > 0 ? tiCu.Codigo : string.Empty, ValorIva = decimal.Round(dl.ValorIva, 2, MidpointRounding.AwayFromZero), TipoDocumentoSoporteCodigo = pl.TipoDocumentoSoporteId > 0 ? tiDo.Codigo : string.Empty, NumeroFactura = dl.NumeroFactura, ConstanteExpedidor = "11", ConstanteCargo = "SUPERVISOR", NombreSupervisor = dl.NombreSupervisor, TextoComprobanteContable = dl.TextoComprobanteContable.Length > 220 ? dl.TextoComprobanteContable.Substring(0, 220) : dl.TextoComprobanteContable, ValorTotal = decimal.Round(dl.ValorTotal, 2, MidpointRounding.AwayFromZero), FechaRegistro = dl.FechaRegistro.Value, }) .ToListAsync(); if (lista != null && lista.Count > 0) { listaFinal = lista.OrderBy(x => x.FechaRegistro).ToList(); } return(listaFinal); }
public async Task <ICollection <ParametroLiquidacionTerceroDto> > ObtenerListaParametroLiquidacionTerceroTotal(int pciId) { var listaInicial = await(from pl in _context.ParametroLiquidacionTercero join t in _context.Tercero on pl.TerceroId equals t.TerceroId join tmc in _context.TipoModalidadContrato on pl.ModalidadContrato equals tmc.TipoModalidadContratoId join tds in _context.TipoDocumentoSoporte on pl.TipoDocumentoSoporteId equals tds.TipoDocumentoSoporteId into DocumentoSoporte from tipoDocu in DocumentoSoporte.DefaultIfEmpty() join tc in _context.TipoCuentaXPagar on pl.TipoCuentaXPagarId equals tc.TipoCuentaXPagarId into CuentaPorPagar from tiCu in CuentaPorPagar.DefaultIfEmpty() where pl.PciId == pciId select new ParametroLiquidacionTerceroDto() { IdentificacionTercero = t.NumeroIdentificacion, NombreTercero = t.Nombre, ModalidadContratoDescripcion = tmc.Nombre, TipoDocumentoSoporteDescripcion = pl.TipoDocumentoSoporteId > 0 ? tipoDocu.Nombre : string.Empty, TipoCuentaPorPagarDescripcion = pl.TipoCuentaXPagarId > 0 ? tiCu.Nombre : string.Empty, HonorarioSinIva = pl.HonorarioSinIva, BaseAporteSalud = pl.BaseAporteSalud, AporteSalud = pl.AporteSalud, AportePension = pl.AportePension, RiesgoLaboral = pl.RiesgoLaboral, FondoSolidaridad = pl.FondoSolidaridad, PensionVoluntaria = pl.PensionVoluntaria, Dependiente = pl.Dependiente, Afc = pl.Afc, MedicinaPrepagada = pl.MedicinaPrepagada, InteresVivienda = pl.InteresVivienda, FechaInicioDescuentoInteresVivienda = pl.FechaInicioDescuentoInteresVivienda, FechaFinalDescuentoInteresVivienda = pl.FechaFinalDescuentoInteresVivienda, TarifaIva = pl.TarifaIva, FacturaElectronicaDescripcion = pl.FacturaElectronica ? "SI" : "NO" }) .Distinct() .OrderBy(c => c.NombreTercero) .ToListAsync(); return(listaInicial); }