Skip to Content
0
Former Member
Jul 19, 2016 at 07:05 PM

Error rounding document line AP Invoice DI API

338 Views

Hello experts. I have an error adding the price AP.Lines When I add for example the price of GS 8200 in a bill that is inserted through the code that is posted below. When I look at SAP it appears that the amount of the price is 8201 which corresponds to a rounding problem. There is some method to add correctly and the price entered by the DI API correctly displayed.?


For Each row In Grilla.Rows
                If Grilla.Rows(row.Index).Cells("cod_articulo").Value = "GRA" Then
                    GRPO.Lines.BaseType = "-1"
                    GRPO.Lines.ItemDescription = row.Cells("descripcion").Value
                    GRPO.Lines.AccountCode = "11030101"
                    GRPO.Lines.Quantity = CInt(row.Cells("cant_fp").Value)
                    GRPO.Lines.PriceAfterVAT = row.Cells("precio_fp").Value
                Else
                    GRPO.Lines.BaseLine = row.Cells("Nro_Linea").Value
                    GRPO.Lines.BaseEntry = CInt(txtdocentry.Text)
                    GRPO.Lines.BaseType = 22
                    If Grilla.Rows(row.Index).Cells("cod_articulo").Value = "OTGRA" Then
                        GRPO.Lines.AccountCode = "11030101"
                    End If
                End If
                GRPO.Lines.ItemCode = row.Cells.Item("cod_articulo").Value
                GRPO.Lines.TaxCode = row.Cells.Item("IVA").Value
                If row.Cells.Item("IVA").Value = "IVA_10" Then
                    If txtmoneda.Text = "USD" Then
                        GRPO.Lines.DiscountPercent = row.Cells("desc_linea").Value
                        'GRPO.Lines.UnitPrice = row.Cells("preciobruto").Value / "1,1"
                        GRPO.Lines.LineTotal = row.Cells("total_line").Value
                        GRPO.Lines.Currency = txtmoneda.Text
                    Else
                        GRPO.Lines.DiscountPercent = row.Cells("desc_linea").Value
                        '  GRPO.Lines.UnitPrice = row.Cells("preciobruto").Value / "1,1"
                        GRPO.Lines.PriceAfterVAT = row.Cells("preciobruto").Value
                        '   GRPO.Lines.RowTotalFC = row.Cells("total_line").Value
                        GRPO.Lines.Currency = txtmoneda.Text
                    End If
                End If
                GRPO.Lines.Add()
            Next
            GRPO.Comments = txtcomentario.Text
            ' GRPO.DocTotal = txttotalfinal.Text
            If txtmoneda.Text = "USD" Then
                GRPO.DocTotalFc = txttotalfinal.Text
            Else
                '   GRPO.DocTotal = txttotalfinal.Text
            End If
            errNum = GRPO.Add