1
I am trying to perform a C# Salary Simulation by introducing a remuneration, but in the method INSERELINHAREMUNERACAO is going wrong.
The mistake is:
Invalid Procedure Call or Argument.
In VBA works well, but I’m not sure what I lack in C#.
Send down the code.
private void CalculaVencimento(int vPeriodo, int vAno, string vFuncionario, double vRemExtra, ref double vVencimento)
    {
        try
        {
            string strErro = "";
            string strRemuneracao = Txt01.Text;
            short Ano = Convert.ToInt16(vAno);
            short Periodo = Convert.ToInt16(vPeriodo);
            RhpBEFuncionario SimulaFuncionario = new RhpBEFuncionario();
            SimulaFuncionario = PriEngine.Aplicacao.RecursosHumanos.Funcionarios.Edita(vFuncionario);
            RhpBEProcessamento SimulaVencimento = new RhpBEProcessamento();
            SimulaVencimento.set_Funcionario(vFuncionario);
            SimulaVencimento.set_TipoProcessamento(TipoProc.tpVencimento);
            SimulaVencimento.set_Periodo("P01");
            SimulaVencimento.set_Ano((short)vAno);
            SimulaVencimento.set_NumPeriodoProcessado((short)vPeriodo);
            SimulaVencimento.set_DiasUteis(Convert.ToUInt16(PriEngine.Aplicacao.RecursosHumanos.Periodos.DaDiasUteis("P01", (short)vAno, (short)vPeriodo).ToString()));
            MotorBS.RecursosHumanos.Processamento.InsereLinhaRemuneracao(SimulaVencimento, SimulaFuncionario, strRemuneracao, strErro, 1, vRemExtra, 1, "EUR", Ano, Periodo);
            MotorBS.RecursosHumanos.Processamento.CalculaProcessamento(SimulaVencimento);
            vVencimento = SimulaVencimento.get_TotalLiquido();
            SimulaVencimento = null;
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
        }
    }
I’ve seen the stacktrace to see if it has any more information?
– Sérgio Sereno
Could you put this method here
– Amadeu Antunes
The stacktrace has no relevant information. Removing the line from the INSERT will perform perfectly. I already put explicit values according to the types and it still doesn’t work.
– António Dias