Imports eConnect11Data
Imports FPCommon
Public Class RMIntegration
Sub RMCashReceipt(bShowErrors As Boolean)
Try
'we expect the data to be in the custom DDtaRMCashReceiptInsert table
Dim strReturnDoc As String
'declare our eConnect classes
Dim strSQLServer As String = System.Configuration.ConfigurationManager.AppSettings("SQLServer")
Dim strDabase As String = System.Configuration.ConfigurationManager.AppSettings("Database")
Dim oeConnectType As New Microsoft.Dynamics.GP.eConnect.Serialization.eConnectType
Dim oeConnectFunctions As New eConnectFunctions(strSQLServer, strDabase)
'============================================================================
'create the document details
'============================================================================
'get all the lines in the custom DDtaRMCashReceiptInsert table
Dim oDT As DataTable = SPs.DD_DDtaRMCashReceiptInsert_SEL().getTable
'loop through the lines
For Each oRow In oDT.Rows
Dim oRMCashReceiptsType As New Microsoft.Dynamics.GP.eConnect.Serialization.RMCashReceiptsType
'declare an object for the detail line
Dim otaRMCashReceiptInsert As New Microsoft.Dynamics.GP.eConnect.Serialization.taRMCashReceiptInsert
'populate the detail line
With otaRMCashReceiptInsert
.BACHNUMB = oRow("BACHNUMB")
.CUSTNMBR = oRow("CUSTNMBR")
.DOCNUMBR = oRow("DOCNUMBR")
.DOCDATE = oRow("DOCDATE")
.ORTRXAMT = oRow("ORTRXAMT")
.GLPOSTDT = oRow("GLPOSTDT")
.CSHRCTYP = oRow("CSHRCTYP")
.CHEKBKID = oRow("CHEKBKID")
.CHEKNMBR = oRow("CHEKNMBR")
.CRCARDID = oRow("CRCARDID")
.TRXDSCRN = oRow("TRXDSCRN")
oRMCashReceiptsType.taRMCashReceiptInsert = otaRMCashReceiptInsert
End With
ReDim Preserve oeConnectType.RMCashReceiptsType(0)
oeConnectType.RMCashReceiptsType(0) = oRMCashReceiptsType
strReturnDoc = oeConnectFunctions.CreateTransactionEntity(oeConnectType)
'delete the line that we just integrated
SPs.DD_DDtaRMCashReceiptInsert_DEL_byID(oRow("RowID"))
Next
Catch ex As Exception
ErrorHandler.globalErrorHandler(ex, bShowErrors)
End Try
End Sub
End Class