public static TaxaConcessao Criar(TaxasConcessaoEntidade row) { return(new TaxaConcessao { COD_IND = row.COD_IND, IND_DEFAZAGEM = row.IND_DEFAZAGEM, IND_MESES_DEFAZAGEM = row.IND_MESES_DEFAZAGEM, TIPO_IND = row.TIPO_IND, SEQUENCIA = row.SEQUENCIA, TX_JUROS = row.TX_JUROS, IND_CALC_PREST_CONC = row.IND_CALC_PREST_CONC }); }
public decimal CalcularMargem(PlanoVinculadoEntidade plano, string cdEmpresa, decimal cdModal, decimal cdNatur, DateTime dtCredito, string matricula, decimal origem, MargensEntidade margem, TaxasEncargosEntidade encargo, TaxasConcessaoEntidade taxaConcessao) { var valorMargemCalculada = 0M; var parametros = new ParametrosProxy().Buscar(); if (parametros.REGRA_MARGEM_PLANO == DMN_SN.SIM) { //TODO: Regra pelo plano } else { if (margem.MARGEM_BPA_EXTERNA == "E") { decimal numeroGrFamil = 0; var margemCalDados = new MargensCalculadasProxy() .BuscarPorFundacaoEmpresaOrigemMatriculaGrupo(plano.CD_FUNDACAO, cdEmpresa, origem, matricula, numeroGrFamil); valorMargemCalculada = margemCalDados.VL_MARGEM ?? 0; } else if (margem.MARGEM_BPA_EXTERNA == "C") { // Regra não existia no simulador antigo } decimal przMax = ObterPrazoMaximo(cdNatur); decimal percTaxa = taxaConcessao.TX_JUROS.Value / 100; decimal jurosPorPrazo = (decimal)Math.Pow((double)(1 + percTaxa), (double)przMax); decimal w_tx_assist_prest_bl = margem.TX_ASSIST_MC.Value; decimal w_vl_prest = plano.UltimoSalario * (w_tx_assist_prest_bl / 100); decimal w_fator_taxas = 1; DateTime dtAniversarioNatureza = ObterDataAniversarioNatureza(cdNatur, dtCredito); decimal diferencaDias = (dtAniversarioNatureza - dtCredito).Days; decimal w_fator_aplicado = Convert.ToDecimal(Math.Pow((double)(1 + percTaxa), (double)(diferencaDias / dtCredito.UltimoDiaDoMes().Day))); switch (plano.CD_CATEGORIA) { case DMN_CATEGORIA.ATIVO: valorMargemCalculada = plano.UltimoSalario * (margem.TX_ATIVO_SP.Value / 100); // futuramente utilizar parametrização break; case DMN_CATEGORIA.AUTOPATROCINIO: valorMargemCalculada = plano.UltimoSalario * (margem.TX_MANTENEDOR_SP.Value / 100); // futuramente utilizar parametrização break; case DMN_CATEGORIA.DIFERIDO: valorMargemCalculada = plano.UltimoSalario * (margem.TX_MANTENEDOR_SP.Value / 100); // futuramente utilizar parametrização break; case DMN_CATEGORIA.EM_LICENCA: //Ativos, Autopatrocinados ou Em licença valorMargemCalculada = plano.UltimoSalario * (margem.TX_ASSIST_BL.Value / 100); // futuramente utilizar parametrização break; case DMN_CATEGORIA.ASSISTIDO: w_vl_prest = w_vl_prest / w_fator_taxas; //valorMargemCalculada = Convert.ToDecimal(GeneralFinanceFormulas.CalcPresentValue(percTaxa, przMax, w_vl_prest)) / w_fator_aplicado; break; } } return(valorMargemCalculada); }