Skip to Content
0
Former Member
Nov 14, 2011 at 05:19 PM

Error adding Incoming Payments

218 Views

hello all

I have a third party application, and I need to migrate incoming payments generated by that application. I read the headlines fit to be migrated to and through a loop trying to insert as many as required.

A payment can pay multiple invoices to a client. And this payment can be made partly in cash, another in check and another in credit card.

I had several error codes, but I will go for parts, first I get an error code (-10) and says it is an invalid document number in RCT2.DocEntry, reviewing SAP B1, if exist the invoice.

For i = 0 To dvMigrar.Count - 1
   Console.WriteLine(CType(dvMigrar(i)("Ingreso_Caja"), String) + " " + dvMigrar(i)("Recibo_de_Caja"))
   vPay.Series = oSeries.Series
   vPay.ApplyVAT = BoYesNoEnum.tNO
   vPay.CardCode = Trim(dvMigrar(i)("Cliente_No"))
   vPay.CashSum = 0
   vPay.DocCurrency = "USD"
   vPay.DocDate = dvMigrar(i)("Fecha")
   vPay.DocRate = 0
   vPay.DocTypte = 0
   vPay.HandWritten = 0
   vPay.JournalRemarks = "Ingreso desde POS - " & CStr(dvMigrar(i)("Recibo_de_Caja"))
   vPay.LocalCurrency = BoYesNoEnum.tYES
   vPay.TaxDate = Now

   'Migración de Detalle Facturas Pagadas
   SlctCmd = "SELECT * FROM DOC_ABONAR_POS WHERE Ingreso_Caja = " & dvMigrar(i)("Ingreso_Caja") 
   Dim SqlAdapter2 As OleDbDataAdapter = New OleDbDataAdapter(SlctCmd, MyConnSQL)
   dsMigrar2 = New System.Data.DataSet
   SqlAdapter2.Fill(dsMigrar2)
   Dim dvMigrar2 As DataView = New DataView(dsMigrar2.Tables(0))

   For j = 0 To dvMigrar2.Count - 1
      vPay.Invoices.Add()
      vPay.Invoices.DocEntry = dvMigrar2(j)("DocEntry")
      vPay.Invoices.InstallmentId = dvMigrar2(j)("No")
      vPay.Invoices.DocLine = j
      vPay.Invoices.InvoiceType = BoRcptInvTypes.it_Invoice
      vPay.Invoices.SumApplied = dvMigrar2(j)("Valor")
      vPay.Invoices.InvoiceType = BoRcptInvTypes.it_Invoice
   Next

   If (vPay.Add() <> 0) Then
      Console.WriteLine("No se pudo generar Pago")
      'Check Error
      Call vCompany.GetLastError(nErr, errMsg)
      If (0 <> nErr) Then
         Console.WriteLine("Error encontrado:" + Str(nErr) + "," + errMsg)
      End If
   End If
Next

I'm trying to pay several invoices at the same incoming payment

Thanks in advance

Edited by: Oscar Alberto Cornejo on Nov 14, 2011 11:20 AM