1
Good afternoon to all,
I am once again asking for help from everyone, because I am trying to mark Faults via a VB.NET application that simulates the Processing of a complete company but I am not being able to.
The code I have is this::
Dim NumFunc = CStr(CodFunc)
Dim strErro As String = ""
Dim Remuneracao As String = Vencimento
Dim Premio As String = Premios
Dim Ano As Short = Now.Year
Dim Periodo = motor.RecursosHumanos.Funcionarios.DaValorAtributo(NumFunc, "Periodo")
Dim DiasUteis = Convert.ToUInt16(motor.RecursosHumanos.Periodos.DaDiasUteis(Periodo, CShort(Ano), CShort(Now.Month)).ToString())
Dim Flt = DirectCast(e, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs).Value
If Flt = "" Then Flt = "0"
     Dim SimulaFuncionario As RhpBEFuncionario = New RhpBEFuncionario()
     SimulaFuncionario = motor.RecursosHumanos.Funcionarios.Edita(NumFunc)
     Dim RemFunc As RhpBEProcRemuneracao = New RhpBEProcRemuneracao
     If CDbl(Premio) > 0 Then
          RemFunc.Remuneracao = "R301"
          RemFunc.Valor = CDbl(Premio)
     End If
     Dim FltFunc As RhpBEProcFalta = New RhpBEProcFalta
     If CDbl(Flt) > 0 Then
          FltFunc.Falta = "F101"
          FltFunc.Descricao = "Falta"
          FltFunc.Data = Now
          FltFunc.Tempo = CDbl(Flt)
     End If
     Dim DesFunc As RhpBEProcDesconto = New RhpBEProcDesconto
     If CDbl(Flt) > 0 And CDbl(Flt)  1 Then
          DesFunc.Desconto = "D111"
          DesFunc.Descricao = "Perda de Prémio"
          DesFunc.Valor = CDbl(Premio)
     ElseIf CDbl(Flt) = 0 Then
          DesFunc.Desconto = "D111"
          DesFunc.Descricao = "Perda de Prémio"
          DesFunc.Valor = 0
     End If
     Dim SimulaVencimento As RhpBEProcessamento = New RhpBEProcessamento()
     SimulaVencimento.Funcionario = NumFunc
     SimulaVencimento.TipoProcessamento = TipoProc.tpVencimento
     SimulaVencimento.Periodo = Periodo
     SimulaVencimento.Ano = Ano
     SimulaVencimento.NumPeriodoProcessado = CShort(Now.Month)
     SimulaVencimento.DiasUteis = DiasUteis
     SimulaVencimento.DiasProc = DiasUteis - CInt(Flt)
     If CDbl(Premio) > 0 Then
          SimulaVencimento.Remuneracoes.Insere(RemFunc)
     End If
     If CDbl(Flt) > 0 Then
          SimulaVencimento.Faltas.Insere(FltFunc)
          SimulaVencimento.Descontos.Insere(DesFunc)
     End If
     motor.RecursosHumanos.Processamento.InsereLinhaRemuneracao(SimulaVencimento, SimulaFuncionario, Remuneracao, strErro, 1, CDbl(Premio), 1, "AKZ", Ano, CShort(Now.Month))
     motor.RecursosHumanos.Processamento.CalculaProcessamento(SimulaVencimento)
     Dim ValorPrevisto = SimulaVencimento.TotalLiquido()
     ValorPrevisto = ValorPrevisto.ToString("N2"))
     SimulaVencimento = Nothing
Everything works (Remunerations and Discounts), but I am not able to make the discount of Absences on Basic Salary.