How to identify dimension launched in the sales editor by an article with dimensions?

1

Environment%% of ERP Spring I am trying to identify the dimension released in the sales editor when launching an article that deals with unsuccessful dimensions. I used the available events vba and EditorVendas_ArtigoIdentificado but they are only triggered by the article that treats the dimension and not the released dimension.

    
asked by anonymous 15.05.2018 / 17:39

2 answers

1

These events only work for parent article. With this code you can make the match between the one released in the editor and the dimensions, which should give to simulate what you want to do. In case of a directly launched child article the event already occurs.

Private Sub EditorVendas_ArtigoIdentificado(Artigo As String, NumLinha As Long, Cancel As Boolean)
Dim objlista As StdBELista
Dim objLinha As GcpBELinhaDocumentoVenda

If (BSO.Comercial.Artigos.DaValorAtributo(Artigo, "artigoPai") = "") Then

    If (BSO.Comercial.Artigos.DaValorAtributo(Artigo, "TratamentoDim")) Then

        Set objlista = New StdBELista

        Set objlista = BSO.Comercial.Artigos.LstDimensoes(Artigo)

        Do While Not objlista.NoFim

            For Each objLinha In Me.DocumentoVenda.Linhas

                If objLinha.Artigo = objlista("Artigo") Then
                    Debug.Print "OK"
                End If
            Next

            objlista.Seguinte

        Loop

    End If
End If

End Sub
    
16.05.2018 / 17:46
0

Thanks for the feedback. I had tried this approach but to no avail. This is my code:

 If (BSO.Comercial.Artigos.DaValorAtributo(Artigo, "artigoPai") = "") Then
    If (BSO.Comercial.Artigos.DaValorAtributo(Artigo, "TratamentoDim")) Then
        Dim objlista As StdBELista
        Dim objLinha As GcpBELinhaDocumentoVenda
        Dim lngI As Long

        Set objlista = New StdBELista
        Set objlista = BSO.Comercial.Artigos.LstDimensoes(Artigo)

        Do While Not objlista.NoFim
            For lngI = 1 To DocumentoVenda.linhas.NumItens
                If DocumentoVenda.linhas(lngI).Artigo = objlista("Artigo") Then
                   DocumentoVenda.linhas(lngI).CamposUtil("CDU_LinVar1").Valor = DocumentoVenda.linhas(lngI).PrecUnit
                End If
            Next
            objlista.seguinte
        Loop
        Set objlista = Nothing
    End If
End If
    
23.05.2018 / 16:16