Advertisement
brunobola

Untitled

May 29th, 2023
381
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Public Sub CorrigeValoresDMR()
  2.  
  3.     If PlataformaPRIMAVERA.Dialogos.MostraPerguntaSimples("Pretende corrigir os Valores para a DMR na empresa PZODMR ?") Then
  4.        
  5.         Dim Ano As String
  6.         If PlataformaPRIMAVERA.Dialogos.MostraDialogoInput(Ano, "Qual o Ano a Corrigir ?", "Introduza o Ano a efetuar a Corre��o", 4, True, Year(Now)) Then
  7.              
  8.             BSO.DSO.BDAPL.Execute ("delete from PRIPZODMR.DBO.MovimentosFuncionarios where codmov like '%F' and ano = " + CStr(Val(Ano)))
  9.            
  10.             BSO.DSO.BDAPL.Execute ("update m2 set m2.valor = (Select sum(m1.Valor) from PRIPZODMR.DBO.MovimentosFuncionarios m1 where m1.ano = m2.Ano and m1.MesFiscal = m2.MesFiscal and (m1.codmov in (select distinct(remuneracao) from PRIPZODMR.DBO.RemuneracoesDescontos where desconto = 'D01' and descontaFuncionario=1) or m1.codmov in (select distinct(HorasExtra) from PRIPZODMR.DBO.HorasExtrasDescontos where desconto = 'D01' and descontaFuncionario=1)) and m1.TipoVenc = m2.TipoVenc and m1.Funcionario=m2.Funcionario and m1.TipoTabela in (1,2))*.11, m2.ValorSegSocialFuncionario = (Select sum(m1.ValorIrsAli) from PRIPZODMR.DBO.MovimentosFuncionarios m1 where m1.ano = m2.Ano and m1.MesFiscal = m2.MesFiscal and m1.TipoVenc = m2.TipoVenc and m1.Funcionario=m2.Funcionario and m1.TipoTabela in (1,2))*.11 from PRIPZODMR.DBO.MovimentosFuncionarios m2 where m2.codmov = 'D01' and m2.ano = " + CStr(Val(Ano)))
  11.  
  12.             BSO.DSO.BDAPL.Execute ("update PRIPZODMR.DBO.MovimentosFuncionarios set TipoRendimento ='A21' where CodMov = 'R89'")
  13.            
  14.             BSO.DSO.BDAPL.Execute ("update PRIPZODMR.DBO.Remuneracoes set TipoRendimento='A21' where Remuneracao = 'R89'")
  15.        
  16.             BSO.DSO.BDAPL.Execute ("update m1 set m1.valor = (select sum(m2.ValorIrsAli)*.11 from PRIPZODMR.DBO.MovimentosFuncionarios m2 where m2.ano = m1.ano and m2.MesFiscal=m1.MesFiscal and m2.Funcionario=m1.Funcionario and m2.TipoVenc=m1.TipoVenc and m2.TipoTabela in (1, 2)) from PRIPZODMR.DBO.MovimentosFuncionarios m1  Where m1.CodMov='D01' and m1.ano = " + CStr(Val(Ano)))
  17.  
  18.             PlataformaPRIMAVERA.Dialogos.MostraMensagemInterno PRI_SimplesOk, "Valores da DMR corrigidos com sucesso.", PRI_Informativo
  19.            
  20.         End If
  21.     End If
  22.  
  23. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement