public SaldoContribuicoesFaelceEntidade(FichaFinanceiraEntidade saldos, IndiceValoresEntidade cota) { Cota = cota.VALOR_IND; QtCotaParticipante = saldos.QTD_COTA_RP_PARTICIPANTE ?? 0; QtCotaPatrocinadora = saldos.QTD_COTA_RP_EMPRESA ?? 0; QtCotaPortabilidade = saldos.QTD_COTA_RP_PORTABILIDADE ?? 0; ContribParticipante = QtCotaParticipante * Cota; ContribPatrocinadora = QtCotaPatrocinadora * Cota; ContribPortabilidade = QtCotaPortabilidade * Cota; ContribTotal = ContribParticipante + ContribPatrocinadora + ContribPortabilidade; QtCotaTotal = QtCotaParticipante + QtCotaPatrocinadora + QtCotaPortabilidade; Referencia = cota.DT_IND; }
public ContrachequeEntidade BuscarUltimaFolhaPorFundacaoEmpresaMatriculaPlanoProcesso(string CD_FUNDACAO, string CD_EMPRESA, string NUM_MATRICULA, string CD_PLANO, string CD_ESPECIE, string ANO_PROCESSO, string NUM_PROCESSO, int?SeqRecebedor = null) { List <FichaFinanceiraAssistidoEntidade> rubricas = new List <FichaFinanceiraAssistidoEntidade>(); if (SeqRecebedor.HasValue) { var ultima = base.BuscarUltimaPorProcessoRecebedor(CD_FUNDACAO, CD_EMPRESA, NUM_MATRICULA, SeqRecebedor.Value, CD_PLANO, CD_ESPECIE, ANO_PROCESSO, NUM_PROCESSO).FirstOrDefault(); if (ultima != null) { rubricas = base.BuscarPorFundacaoEmpresaMatriculaPlanoReferenciaProcessoRecebedor(CD_FUNDACAO, CD_EMPRESA, NUM_MATRICULA, SeqRecebedor.Value, CD_PLANO, ultima.DT_REFERENCIA, ANO_PROCESSO, NUM_PROCESSO).ToList(); } } else { var ultima = base.BuscarUltimaPorProcesso(CD_FUNDACAO, CD_EMPRESA, NUM_MATRICULA, CD_PLANO, CD_ESPECIE, ANO_PROCESSO, NUM_PROCESSO).FirstOrDefault(); if (ultima != null) { rubricas = base.BuscarPorFundacaoEmpresaMatriculaPlanoReferenciaProcesso(CD_FUNDACAO, CD_EMPRESA, NUM_MATRICULA, CD_PLANO, ultima.DT_REFERENCIA, ANO_PROCESSO, NUM_PROCESSO).ToList(); } } if (!string.IsNullOrEmpty(CD_ESPECIE)) { rubricas = rubricas.Where(x => x.CD_ESPECIE == CD_ESPECIE).ToList(); } var proventos = rubricas.Where(x => x.RUBRICA_PROV_DESC == "P").ToList(); var descontos = rubricas.Where(x => x.RUBRICA_PROV_DESC == "D").ToList(); foreach (var rubrica in descontos) { rubrica.VALOR_MC *= -1; } var bruto = proventos.Sum(x => x.VALOR_MC); var valDescontos = descontos.Sum(x => x.VALOR_MC); var liquido = bruto - Math.Abs(valDescontos.Value); var cdTipoFolha = ""; var desTipoFolha = ""; DateTime dtReferencia = new DateTime(); var indice = new IndiceValoresEntidade(); if (rubricas.Any()) { indice = new IndiceValoresProxy().BuscarReservaPoupanca(rubricas.First().DT_REFERENCIA.PrimeiroDiaDoMes()); cdTipoFolha = rubricas.First().CD_TIPO_FOLHA; desTipoFolha = rubricas.First().DS_TIPO_FOLHA; dtReferencia = rubricas.First().DT_REFERENCIA; } return(new ContrachequeEntidade { Proventos = proventos, Descontos = descontos, Resumo = new ContrachequeResumo { Referencia = dtReferencia, Bruto = bruto, Descontos = valDescontos, Liquido = liquido, TipoFolha = cdTipoFolha, DesTipoFolha = desTipoFolha, Indice = indice } }); }