I am creating a routine for Integrating Internal Documents into ERP. You are creating the document, but it is not appreciated. The test code I'm using:
Public Sub CriaDocumentoInterno(Public MotorERP As ErpBS100.ErpBS,Utilizador As String, DataDoc As Date, Filial As String, TipoDoc As String, Serie As String, Artigo As String, Armazem As String, Quantidade As Double, PrecUnit As Double)
Try
Dim strAvisos As String
Dim DocINT As New IntBE100.IntBEDocumentoInterno
With DocINT
.Tipodoc = TipoDoc
.Filial = Filial
.Serie = Serie
.Data = DataDoc
.DataVencimento = DataDoc
.Utilizador = Utilizador
End With
MotorERP.Internos.Documentos.PreencheDadosRelacionados(DocINT)
Dim objlinha As New IntBE100.IntBELinhaDocumentoInterno
With objlinha
.Armazem = Armazem
.Localizacao = Armazem
.Artigo = Artigo
.Data = DataDoc
.DataDocStock = DataDoc
.DescontoComercial = 0
.Descricao = MotorERP.Base.Artigos.DaValorAtributo(objlinha.Artigo, "Descricao")
.FactorConv = 1
.Lote = ""
.MovimentaStock = True
.PrecoUnitario = PrecUnit
.Quantidade = Quantidade
.Unidade = MotorERP.Base.Artigos.DaValorAtributo(objlinha.Artigo, "UnidadeBase")
.TipoLinha = 13
.ID = Guid.NewGuid().ToString
.TaxaIva = 13
.CodigoIva = MotorERP.Base.Artigos.DaValorAtributo(objlinha.Artigo, "Iva")
.TaxaIva = MotorERP.Base.Iva.DaValorAtributo(objlinha.CodigoIva, "Taxa")
.RegimeIva = 1
.DataEntrega = DocINT.Data
.INV_EstadoDestino = "DISP"
End With
DocINT.Linhas.Insere(objlinha)
strAvisos = ""
MotorERP.Internos.Documentos.Actualiza(DocINT, strAvisos)
Catch ex As Exception
MsgBox(Err.Source + "|" + Err.Description, vbAbort, "Erro ao criar Doc.Interno")
End Try
End Sub
The routine runs without errors, but after creating / integrating the document in ERP V10, I find that in the SQL table InlineLines columns and TotalIva and PercIvaDedutivel columns (possibly other columns) are not filled out.
What is the missing in this code for the value of each line to be calculated correctly, and therefore the total value of the internal document?
Thank you