Sub RMApply(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 a list of pending FROM documents
For Each oHeaderRow In SPs.dd_DDtaRMApply_SEL_byAPFRDCNM().getTable.Rows
'loop through the lines
For Each oRow In SPs.dd_DDtaRMApply_SEL_byAPFRDCNM2(oHeaderRow("apfrdcnm"), oHeaderRow("apfrdcty")).getTable.Rows
Dim oRMApplyType As New Microsoft.Dynamics.GP.eConnect.Serialization.RMApplyType
'declare an object for the detail line
Dim otaRMApply As New Microsoft.Dynamics.GP.eConnect.Serialization.taRMApply
'populate the detail line
With otaRMApply
.APTODCNM = oRow("APTODCNM")
.APTODCTY = oRow("APTODCTY")
.APFRDCNM = oRow("APFRDCNM")
.APFRDCTY = oRow("APFRDCTY")
.APPTOAMT = oRow("APPTOAMT")
.GLPOSTDT = oRow("GLPOSTDT")
.DISTKNAM = oRow("DISTKNAM")
'.CHEKBKID = oRow("CHEKBKID")
.WROFAMNT = oRow("WROFAMNT")
.APPLYDATE = oRow("APPLYDATE")
.GLPOSTDT = oRow("GLPOSTDT")
oRMApplyType.taRMApply = otaRMApply
End With
ReDim Preserve oeConnectType.RMCashReceiptsType(0)
oeConnectType.RMApplyType(0) = oRMApplyType
strReturnDoc = oeConnectFunctions.CreateTransactionEntity(oeConnectType)
'delete the line that we just integrated
SPs.DD_DDtaRMCashReceiptInsert_DEL_byID(oRow("RowID")).execute()
Next
Next
Catch ex As Exception
ErrorHandler.globalErrorHandler(ex, bShowErrors)
End Try
End Sub