public void TestFolhaDePagamento() { FolhaDePagamento folha = new FolhaDePagamento(); Demonstrativo demonstrativo = folha.GerarDemonstrativo(200, 5000, 50, 10); Assert.AreEqual(1250, demonstrativo.HorasExtras.ValorTotalHoras); Assert.AreEqual(250, demonstrativo.HorasDescontadas.ValorTotalHoras); Assert.AreEqual(6000, demonstrativo.TotalProventos); Assert.AreEqual(2085, demonstrativo.TotalDescontos); Assert.AreEqual(3915, demonstrativo.TotalLiquido); Assert.AreEqual(660, demonstrativo.Fgts.Valor); }
public void DemonstrativoTestComercioSal12000Hextras80hDesc15() { GeradorDeDemonstrativo gerar = new GeradorDeDemonstrativo(); Demonstrativo demo = gerar.GerarDemonstrativo(170, 12000, 80, 15); Assert.AreEqual(12000, demo.SalarioBase); Assert.AreEqual(5647.05, demo.HorasExtras.calcular(), 0.10); Assert.AreEqual(1058.82, demo.HorasDescontadas.calcular(), 0.10); Assert.AreEqual(16588.23, demo.TotalProventos, 0.10); Assert.AreEqual(1658.82, demo.Inss.calcular(), 0.10); Assert.AreEqual(4105.58, demo.Irrf.calcular(), 0.10); Assert.AreEqual(5764.406, demo.TotalDescontos, 0.10); Assert.AreEqual(10823.82, demo.TotalLiquido, 0.10); Assert.AreEqual(1824.70, demo.Fgts.calcular(), 0.10); }
public void DemonstrativoComercioSal8000Hextras0hDesc0() { GeradorDeDemonstrativo gerar = new GeradorDeDemonstrativo(); Demonstrativo demo = gerar.GerarDemonstrativo(170, 8000, 0, 0); Assert.AreEqual(8000, demo.SalarioBase); Assert.AreEqual(0.00, demo.HorasExtras.calcular(), 0.10); Assert.AreEqual(0.00, demo.HorasDescontadas.calcular(), 0.10); Assert.AreEqual(8000.00, demo.TotalProventos, 0.10); Assert.AreEqual(800.00, demo.Inss.calcular(), 0.10); Assert.AreEqual(1980.00, demo.Irrf.calcular(), 0.10); Assert.AreEqual(2780.00, demo.TotalDescontos, 0.10); Assert.AreEqual(5220.00, demo.TotalLiquido, 0.10); Assert.AreEqual(880.00, demo.Fgts.calcular(), 0.10); }
public void DemonstrativoTestComercioSal25000Hextras90hDesc10() { GeradorDeDemonstrativo gerar = new GeradorDeDemonstrativo(); Demonstrativo demo = gerar.GerarDemonstrativo(170, 25000, 90, 10); Assert.AreEqual(25000, demo.SalarioBase); Assert.AreEqual(13235.294, demo.HorasExtras.calcular(), 0.10); Assert.AreEqual(1470.58, demo.HorasDescontadas.calcular(), 0.10); Assert.AreEqual(36764.71, demo.TotalProventos, 0.10); Assert.AreEqual(3676.47, demo.Inss.calcular(), 0.10); Assert.AreEqual(9099.265, demo.Irrf.calcular(), 0.10); Assert.AreEqual(12775.735, demo.TotalDescontos, 0.10); Assert.AreEqual(23988.97, demo.TotalLiquido, 0.10); Assert.AreEqual(4044.11, demo.Fgts.calcular(), 0.10); }
public void DemonstrativoTestIndustriaSal1200Hextras0hDesc5() { GeradorDeDemonstrativo gerar = new GeradorDeDemonstrativo(); Demonstrativo demo = gerar.GerarDemonstrativo(200, 1200, 0, 5); Assert.AreEqual(1200, demo.SalarioBase); Assert.AreEqual(0.00, demo.HorasExtras.calcular(), 0.10); Assert.AreEqual(30.00, demo.HorasDescontadas.calcular(), 0.10); Assert.AreEqual(1170.00, demo.TotalProventos, 0.10); Assert.AreEqual(105.30, demo.Inss.calcular(), 0.10); Assert.AreEqual(0.00, demo.Irrf.calcular(), 0.10); Assert.AreEqual(105.30, demo.TotalDescontos, 0.10); Assert.AreEqual(1064.70, demo.TotalLiquido, 0.10); Assert.AreEqual(128.70, demo.Fgts.calcular(), 0.10); }
public void DemonstrativoTestIndustriaSal2500Hextras10hDesc40() { GeradorDeDemonstrativo gerar = new GeradorDeDemonstrativo(); Demonstrativo demo = gerar.GerarDemonstrativo(200, 2500, 10, 40); Assert.AreEqual(2500, demo.SalarioBase); Assert.AreEqual(125.00, demo.HorasExtras.calcular(), 0.10); Assert.AreEqual(500.00, demo.HorasDescontadas.calcular(), 0.10); Assert.AreEqual(2125.00, demo.TotalProventos, 0.10); Assert.AreEqual(212.50, demo.Inss.calcular(), 0.10); Assert.AreEqual(143.43, demo.Irrf.calcular(), 0.10); Assert.AreEqual(355.93, demo.TotalDescontos, 0.10); Assert.AreEqual(1769.06, demo.TotalLiquido, 0.10); Assert.AreEqual(233.75, demo.Fgts.calcular(), 0.10); }
public void DemonstrativoTestIndustriaSal5000Hextras50hDesc10() { GeradorDeDemonstrativo gerar = new GeradorDeDemonstrativo(); Demonstrativo demo = gerar.GerarDemonstrativo(200, 5000, 50, 10); Assert.AreEqual(5000, demo.SalarioBase); Assert.AreEqual(1250.0, demo.HorasExtras.calcular(), 0.10); Assert.AreEqual(250.0, demo.HorasDescontadas.calcular(), 0.10); Assert.AreEqual(6000.0, demo.TotalProventos, 0.10); Assert.AreEqual(600, demo.Inss.calcular(), 0.10); Assert.AreEqual(1485.00, demo.Irrf.calcular(), 0.10); Assert.AreEqual(2085.00, demo.TotalDescontos, 0.10); Assert.AreEqual(3915.00, demo.TotalLiquido, 0.10); Assert.AreEqual(660.00, demo.Fgts.calcular(), 0.10); }
public void TestMethod1() { GerarDemonstrativo g1 = new GerarDemonstrativo(200, 5000, 50, 10); Demonstrativo d = g1.gerarDemonstrativo(); Assert.AreEqual(5000, d.SalarioBase); Assert.AreEqual(1250, d.HorasExtras); Assert.AreEqual(250, d.HorasDescontadas); Assert.AreEqual(6000, d.TotalProventos); Assert.AreEqual(600, d.Inss); Assert.AreEqual(1485, d.Irrf); Assert.AreEqual(2085, d.TotalDescontos); Assert.AreEqual(3915, d.TotalLiquido); Assert.AreEqual(660, d.Fgts); }
public Demonstrativo BuscarDemonstrativo(string matricula, string pFilial, string pEmpresa, string tipoDemonstrativoProtheus, string periodoDe, string periodoAte) { Demonstrativo retorno = null; var parameters = new List <IDbDataParameter> { new SqlParameter("@FILIAL", SqlDbType.VarChar) { Value = pFilial }, new SqlParameter("@MAT", SqlDbType.VarChar) { Value = matricula }, new SqlParameter("@pPeriodoDe", SqlDbType.VarChar) { Value = periodoDe }, new SqlParameter("@pPeriodoAte", SqlDbType.VarChar) { Value = periodoAte }, }; var sbQuery = new StringBuilder(" SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; "); sbQuery.Append(CriarQueryDemonstrativo(pEmpresa, tipoDemonstrativoProtheus, true)); sbQuery.Append(" UNION "); sbQuery.Append(CriarQueryDemonstrativo(pEmpresa, tipoDemonstrativoProtheus, false)); var baseIRPF = new[] { "0350", "0353", "0396", "0399", "0017", "0108", "0293", "0294", "0337", "0400", "0649", "0974", "0979", "0015", "0016", "0027", "0057", "0173", "0174", "0221", "0225" }; var baseFGTS01 = new[] { "0013", "0014" }; var baseFGTS02 = new[] { "0019", "0020" }; var baseFGTS03 = new[] { "0018", "0109", "0214", "0339", "0400", "0722", "0117", "0118", "0119", "0120", "0132", "0135", "0292", "0297", "0339", "0650", "0712" }; using (var reader = ExecuteReader(sbQuery.ToString(), CommandType.Text, parameters)) { bool firstRow = true; Decimal vbase = 0; Decimal hbase = 0; Decimal vbase13 = 0; Decimal hbase13 = 0; while (reader.Read()) { if (firstRow) { var bancoAgencia = reader["RA_BCDEPSA"].ToString(); firstRow = false; retorno = new Demonstrativo { Referencia = reader["RD_DATARQ"].ToString(), UnidadeOrganizacional = reader["RA_CC"].ToString(), Secao = reader["RA_DEPTO"].ToString(), Matricula = reader["RA_MAT"].ToString(), Nome = reader["RA_NOME"].ToString(), CPF = reader["RA_CIC"].ToString(), DataAdmissao = reader["RA_ADMISSA"] == DBNull.Value ? new DateTime() : new DateTime(Convert.ToInt32(reader["RA_ADMISSA"].ToString().Substring(0, 4)), Convert.ToInt32(reader["RA_ADMISSA"].ToString().Substring(4, 2)), Convert.ToInt32(reader["RA_ADMISSA"].ToString().Substring(6, 2))), Cargo = reader["RA_CODFUNC"].ToString(), Salario = reader["RA_SALARIO"] == DBNull.Value ? 0 : Convert.ToDecimal(reader["RA_SALARIO"], CultureInfo.InstalledUICulture), QuantidadeDependenteSalarioFamilia = reader["RA_DEPSF"].ToString(), QuantidadeDependentesIR = reader["RA_DEPIR"].ToString(), Banco = bancoAgencia.Substring(0, 3), Agencia = bancoAgencia.Substring(3), ContaCorrente = reader["RA_CTDEPSA"].ToString(), DataPagamento = reader["RD_DATPGT"] == DBNull.Value ? new DateTime() : new DateTime(Convert.ToInt32(reader["RD_DATPGT"].ToString().Substring(0, 4)), Convert.ToInt32(reader["RD_DATPGT"].ToString().Substring(4, 2)), Convert.ToInt32(reader["RD_DATPGT"].ToString().Substring(6, 2))) }; } if (tipoDemonstrativoProtheus == "3") { switch (reader["RV_TIPOCOD"].ToString()) { case "1": retorno.Eventos.Add(new Evento { CodigoRubrica = reader["RD_PD"].ToString(), DescricaoRubrica = reader["RV_DESC"].ToString(), Quantidade = Convert.ToDecimal(reader["RD_HORAS"].ToString(), CultureInfo.InvariantCulture), Valor = Convert.ToDecimal(reader["RD_VALOR"].ToString(), CultureInfo.InvariantCulture) }); break; case "2": retorno.Eventos.Add(new Evento { CodigoRubrica = reader["RD_PD"].ToString(), DescricaoRubrica = reader["RV_DESC"].ToString(), Quantidade = Convert.ToDecimal(reader["RD_HORAS"].ToString(), CultureInfo.InvariantCulture), Desconto = Convert.ToDecimal(reader["RD_VALOR"].ToString(), CultureInfo.InvariantCulture) }); break; } if (baseIRPF.Contains(reader["RV_CODFOL"].ToString())) { retorno.Bases.Add(new Evento { CodigoRubrica = reader["RD_PD"].ToString(), DescricaoRubrica = reader["RV_DESC"].ToString(), Quantidade = Convert.ToDecimal(reader["RD_HORAS"].ToString(), CultureInfo.InvariantCulture), Desconto = Convert.ToDecimal(reader["RD_VALOR"].ToString(), CultureInfo.InvariantCulture), }); } else if (baseFGTS01.Contains(reader["RV_CODFOL"].ToString())) { vbase += Convert.ToDecimal(reader["RD_VALOR"], CultureInfo.InvariantCulture); hbase += Convert.ToDecimal(reader["RD_HORAS"], CultureInfo.InvariantCulture); } else if (baseFGTS02.Contains(reader["RV_CODFOL"].ToString())) { vbase13 += Convert.ToDecimal(reader["RD_VALOR"], CultureInfo.InvariantCulture); hbase13 += Convert.ToDecimal(reader["RD_HORAS"], CultureInfo.InvariantCulture); } else if (baseFGTS03.Contains(reader["RV_CODFOL"].ToString())) { retorno.Recolhimentos.Add(new RecolhimentoFGTS { Codigo = reader["RD_PD"].ToString(), Descricao = reader["RV_DESC"].ToString(), Referencia = Convert.ToDecimal(reader["RD_HORAS"].ToString(), CultureInfo.InvariantCulture), Valor = Convert.ToDecimal(reader["RD_VALOR"].ToString(), CultureInfo.InvariantCulture) }); } else if (reader["RV_CODFOL"].ToString() == "0313") { retorno.Cooperativas.Add(new Evento { CodigoRubrica = reader["RD_PD"].ToString(), DescricaoRubrica = reader["RV_DESC"].ToString(), Quantidade = Convert.ToDecimal(reader["RD_HORAS"].ToString(), CultureInfo.InvariantCulture), Valor = Convert.ToDecimal(reader["RD_VALOR"].ToString(), CultureInfo.InvariantCulture), }); } else { //If Posicione("SP9",4,xFilial("SP9")+QRY->RD_PD,"P9_IDPON") $ "023A|024A" //aAdd(aBanc,{QRY->RD_PD,QRY->RV_DESC,QRY->RD_HORAS,QRY->RD_VALOR}) //BASE BANCO DE HORAS //EndIf if (reader["RD_PD"].ToString() == "023A" || reader["RD_PD"].ToString() == "024A") { retorno.BancoDeHoras.Add(new Evento { CodigoRubrica = reader["RD_PD"].ToString(), DescricaoRubrica = reader["RV_DESC"].ToString(), Quantidade = Convert.ToDecimal(reader["RD_HORAS"].ToString(), CultureInfo.InvariantCulture), Valor = Convert.ToDecimal(reader["RD_VALOR"].ToString(), CultureInfo.InvariantCulture), }); } } } else if (tipoDemonstrativoProtheus == "1") { if (reader["RV_TIPOCOD"].ToString() == "2") { retorno.Eventos.Add(new Evento { CodigoRubrica = reader["RD_PD"].ToString(), DescricaoRubrica = reader["RV_DESC"].ToString(), Quantidade = Convert.ToDecimal(reader["RD_HORAS"].ToString(), CultureInfo.InvariantCulture), Valor = Convert.ToDecimal(reader["RD_VALOR"].ToString(), CultureInfo.InvariantCulture), }); } } else if (tipoDemonstrativoProtheus == "10" || tipoDemonstrativoProtheus == "2" || tipoDemonstrativoProtheus == "5") { if (reader["RV_TIPOCOD"].ToString() == "1") { retorno.Eventos.Add(new Evento { CodigoRubrica = reader["RD_PD"].ToString(), DescricaoRubrica = reader["RV_DESC"].ToString(), Quantidade = Convert.ToDecimal(reader["RD_HORAS"].ToString(), CultureInfo.InvariantCulture), Valor = Convert.ToDecimal(reader["RD_VALOR"].ToString(), CultureInfo.InvariantCulture), }); } else if (reader["RV_TIPOCOD"].ToString() == "2") { retorno.Eventos.Add(new Evento { CodigoRubrica = reader["RD_PD"].ToString(), DescricaoRubrica = reader["RV_DESC"].ToString(), Quantidade = Convert.ToDecimal(reader["RD_HORAS"].ToString(), CultureInfo.InvariantCulture), Desconto = Convert.ToDecimal(reader["RD_VALOR"].ToString(), CultureInfo.InvariantCulture), }); } else { retorno.Bases.Add(new Evento { CodigoRubrica = reader["RD_PD"].ToString(), DescricaoRubrica = reader["RV_DESC"].ToString(), Quantidade = Convert.ToDecimal(reader["RD_HORAS"].ToString(), CultureInfo.InvariantCulture), Desconto = Convert.ToDecimal(reader["RD_VALOR"].ToString(), CultureInfo.InvariantCulture), }); } } } if (tipoDemonstrativoProtheus == "3") { if (vbase != 0 || hbase != 0) { retorno.Bases.Add(new Evento { CodigoRubrica = "0721/0722", DescricaoRubrica = "Base INSS", Quantidade = hbase, Valor = vbase, }); } if (vbase13 != 0 || hbase13 != 0) { retorno.Bases.Add(new Evento { CodigoRubrica = "0723/0724", DescricaoRubrica = "Base INSS 13", Quantidade = hbase13, Valor = vbase13, }); } } reader.Close(); return(retorno); } }