Transformation of an FP into FA (Sales Documents)

1

Good night everyone,

I'm trying to make the Transformation of Sales Documents, in the case a Pro-form in an Invoice, but it gives error because the origin does not have Warehouse in the Lines. How do I add the Warehouse I want?

I have the following code that works if you have Warehouse:


        On Error GoTo Erro
        Dim objDocOrigem As GcpBEDocumentoVenda
        objDocOrigem = motor.Comercial.Vendas.Edita("000", cbOrigTipoDoc.Text, cbOrigSerie.Text, CInt(cbOrigDoc.Text))

        Dim objDocDestino As GcpBEDocumentoVenda
        objDocDestino = New GcpBEDocumentoVenda
        objDocDestino.TipoEntidade = objDocOrigem.TipoEntidade
        objDocDestino.Entidade = objDocOrigem.Entidade
        objDocDestino.Tipodoc = cbDestTipoDoc.Text
        objDocDestino.Serie = cbDestSerie.Text
        objDocDestino.CondPag = objDocOrigem.CondPag

        Dim Doc(0) As Object
        Doc(0) = objDocOrigem

        motor.Comercial.Vendas.TransformaDocumentoEX(Doc, objDocDestino, True)
        GoTo Fim
Erro:
        MsgBox(Err.Number & ": " & Err.Description)

Fim:
        objDocOrigem = Nothing
        objDocDestino = Nothing
        LimpaTransCompras()
        cbOrigTipoDoc.Focus()
    
asked by anonymous 30.11.2018 / 22:24

1 answer

2

I think this is what you want to do:

Dá armazém sugestão
    Dim Armazem As String = BSO.Inventario.Params.ArmazemSugestao

    For x = 1 To objDocOrigem.Linhas.NumItens
        If objDocOrigem.Linhas(x).Armazem = "" Then
            objDocOrigem.Linhas(x).Armazem = Armazem
        End If
    Next
    
03.12.2018 / 18:05