Change of state in accounts current accounts

-2

Good morning,

This code example I'm putting in is to settle documents:

Private Sub liquidaDocumento(sTipoDoc As String, sSerie As String, lNumDoc As Long)

Dim liq         As GcpBE900.GcpBEDocumentoLiq
Dim linha       As GcpBE900.GcpBELinhaLiq
Dim aux         As Object
Dim trans       As Boolean
Dim Diario      As String
Dim NumDiario   As Long
Dim DocLiquidacao As String
Dim DataLiquidacao As Date


 trans = False
 DocLiquidacao = "TFI"
 DataLiquidacao = Me.DocumentoCompra.DataDoc

 On Error GoTo sair
 Set liq = New GcpBE900.GcpBEDocumentoLiq
 liq.Tipodoc = DocLiquidacao
 liq.Serie = BSO.Comercial.Series.DaSerieDefeito("M", DocLiquidacao, DataLiquidacao)
 liq.DataIntroducao = Date
 liq.DataDoc = DataLiquidacao
 liq.TipoEntidade = Me.DocumentoCompra.TipoEntidade
 liq.Entidade = Me.DocumentoCompra.CamposUtil("CDU_Investigador").valor
 liq.TipoConta = "C"
 liq.CambioMAlt = 1
 liq.CambioMBase = 1
 liq.Moeda = Me.DocumentoCompra.Moeda
 liq.Cambio = 1
 liq.NumDoc = BSO.Comercial.Series.Edita("M", liq.Tipodoc, liq.Serie).Numerador + 1
 liq.EstadoBE = "PEN"
 liq.ContaBancaria = Conta
 liq.Utilizador = BSO.Contexto.UtilizadorActual

 BSO.Comercial.Liquidacoes.PreencheDadosRelacionados liq

 liq.DataIntroducao = DataLiquidacao 'Date
 liq.DataDoc = DataLiquidacao


 Dim valor As Double
 valor = (-1) * BSO.Comercial.Pendentes.Edita(Me.DocumentoCompra.Filial, "C", Me.DocumentoCompra.Tipodoc, Me.DocumentoCompra.Serie, Me.DocumentoCompra.NumDoc).ValorPendente

 BSO.Comercial.Liquidacoes.AdicionaLinha liq, "000", "C", sTipoDoc, sSerie, lNumDoc, 1, "APR", 0, valor, 0

 liq.LinhasLiquidacao(liq.LinhasLiquidacao.NumItens).DataDoc = liq.DataDoc


 liq.DataDoc = DataLiquidacao

 BSO.IniciaTransaccao
 trans = True
 BSO.Comercial.Liquidacoes.Actualiza liq



    If trans = True Then
        BSO.TerminaTransaccao
        trans = False
    End If

    MsgBox "LiquidaÁ„o gerada automaticamente." & vbCrLf & liq.Tipodoc & " " & liq.NumDoc & "/" & liq.Serie
    Set liq = Nothing
    Set linha = Nothing
    Set aux = Nothing
    Exit Sub

sair:

    If trans = True Then
        BSO.DesfazTransaccao
        trans = False
    End If

    MsgBox "Erro a criar liquidaÁ„o" & vbCrLf & Err.Description, vbInformation

    Set liq = Nothing
    Set linha = Nothing
    Set aux = Nothing

End Sub

What is intended is to change the entity, because the document that is used in the current accounts, is configured to generate a new pending, in this case it will go from the APR state - In approval to the PEN state - Pending. p>

Can anyone help me?

Thank you for your attention.

Good afternoon, It will be easier to explain the functional process.

The process is as follows:

  • The VFA is written to the purchasing module with the vendor entity type, there is a user field in the document header that stores another code from another vendor type entity, which will be used in the current accounts to transfer the account status pending approval for the pending state account in current accounts.
  • There is a document in the current accounts that is set up to transfer pending account and / or status, this process works as follows:
  • To perform pending downloads (Account, Status, Entities, or any combination thereof) perform the following steps:

    Access the "Current Account Operations" option in, Treasury | Payments and Receipts | Current Account Operations;

    On the "General" tab select a document of type Account Transfer / Status;

    Select the type of entity and its entity (this step is optional);

    Select the pendants you wish to transfer;

    Confirm;

    In the next window confirm / change transfer data.

    Running the functional process in the spring current accounts, we can see that a document is created in the cabliq and rows tables. I would like to know which part of the engines does this, if necessary I can put a prints.

        
    asked by anonymous 02.01.2019 / 23:57

    1 answer

    1

    Good afternoon,

    Although I do not have all the information, particularly with regard to the purchase document settings in your connection to the current accounts, I think the problem is in the AdicionaLinha statement.

    Try changing this line to this:

    BSO.Comercial.Liquidacoes.AdicionaLinha liq, "000", "C", sTipoDoc, sSerie, lNumDoc, 1, "AGP", 0, valor, 0
    

    In a normal configuration of a purchase document type equal to the VFA (as used in a demonstration company), when a new document is written, these are the values written to the database:

    NumPrestacao = 1
    Estado = "AGP"
    NumTransferecia = 0
    
        
    03.01.2019 / 19:41