Site Search:
Sign in | Join | Help

Create a single payment document (cash receipt) and applying it to multiple invoices

Last post 06-04-2008 2:35 AM by Alwani. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 10-03-2007 10:36 AM

    Create a single payment document (cash receipt) and applying it to multiple invoices

    I am attempting to create a single cash receipt (ex: PYMNT1234) and apply it to multiple invoices. I have the following problem:

     1. I loop through a datareader of invoices to apply payments too. When I try to create a single XML document with one <RMCashReceiptsType> and multiple <RMApplyType> by adding to the collection like below, all of the <TARMApply>'s are the same. When I add the next one to the collection it replaces the properties of them all.

                      With paymentApply
                            .APTODCNM = sDocNum
                            .APFRDCNM = sPaymentDoc
                            .APPTOAMT = dApplyAmt
                            .APFRDCTY = 9
                            .APTODCTY = 1
                            .APPLYDATE = frmMain.dtpApplyDate.Text
                            .GLPOSTDT = Date.Today.ToString
                        End With

                        payment.taRMApply = paymentApply

                        ReDim Preserve eConnect.RMApplyType(0)
                        eConnect.RMApplyType(0) = payment

    • 65.173.151.11
  • 10-03-2007 11:06 PM In reply to

    Re: Create a single payment document (cash receipt) and applying it to multiple invoices

    Man, you're not going to like this answer, it's really complicated. But, you asked...

    I think that you have a VB issue, not an eConnect issue. It sounds to me like you're not bringing in the class into the array of apply docs correctly. I don't have a piece of code that shows that being done, but I do have one that shows a SOP header and an array of lines being applied. You'll have to read through the code for the lines section. I have abbreviated the code somewhat to make it easier to read through.

    I use two custom classes, clsSOPHeader and clsSOPLine. These classes directly mirror the tables. I use the classes instead of the eConnect object so that I have an opportunity to insert business logic if I need to. So, the calling function populates clsSOPHeader and an array of clsSOPLines, these are declared at the top.

     Then we go through and populate the eConnect taSopHdrIvcInsert and taSopLineIvcInsert_ItemsTaSopLineIvcInsert objects. Remember that the line object is a collection.

    </font></font>
    
    
    Imports System
    Imports Microsoft.GreatPlains.eConnect.Serialization
    
    
    Public Class clsSOPTrans
        Public SOP As clsSOPHeader
        Public SOPLines As New System.Collections.Generic.List(Of clsSOPLine)
        Public server As String
        Public db As String
    
    
        Public Sub CreateSOPdoc(ByVal db As String)
            'create the eConnect Trasaction document, and an array of transaction docs
            Dim SOPTransType As New SOPTransactionType
            Dim aSOPTransType(0) As SOPTransactionType
    
    
            'create the eConnect docs that go into the transaction doc
            Dim taSOP As New taSopHdrIvcInsert
            Dim taSOPLine As taSopLineIvcInsert_ItemsTaSopLineIvcInsert
    
    
            'create a local instance of our SOP Line class
            Dim oclsSOPLine As New clsSOPLine
    
    
            With taSOP
                .SOPTYPE = Me.SOP.SOPTYPE
                .DOCID = Me.SOP.DOCID
                .SOPNUMBE = Me.SOP.SOPNUMBE
                .ORIGNUMB = Me.SOP.ORIGNUMB
                .ORIGTYPE = Me.SOP.ORIGTYPE
                .TAXSCHID = Me.SOP.TAXSCHID
                .FRTSCHID = Me.SOP.FRTSCHID
    
    
    'abbreviated for clarity
                .USRDEFND1 = Me.SOP.USRDEFND1
                .USRDEFND2 = Me.SOP.USRDEFND2
                .USRDEFND3 = Me.SOP.USRDEFND3
                .USRDEFND4 = Me.SOP.USRDEFND4
                .USRDEFND5 = Me.SOP.USRDEFND5
    
    
            End With
    
    
            Dim a As Int16 = 0
            Dim ataSOPLine(0) As taSopLineIvcInsert_ItemsTaSopLineIvcInsert
    
    
            'loop through our array of SOPLine classes
            For Each oclsSOPLine In Me.SOPLines
                'get a local instance of the 'ta' sop line object
                taSOPLine = New taSopLineIvcInsert_ItemsTaSopLineIvcInsert
    
    
                With taSOPLine
                    .SOPTYPE = oclsSOPLine.SOPTYPE
                    .SOPNUMBE = oclsSOPLine.SOPNUMBE
                    .CUSTNMBR = oclsSOPLine.CUSTNMBR
                    .DOCDATE = oclsSOPLine.DOCDATE
    'abbreviated for clarity
                    .USRDEFND5 = oclsSOPLine.USRDEFND5
    
    
                End With
    
    
                ReDim Preserve ataSOPLine(a)
    
    
                ataSOPLine(a) = taSOPLine
    
    
                'increment the counter
                a += 1
            Next
    
    
            SOPTransType.taSopLineIvcInsert_Items = ataSOPLine
    
    
            aSOPTransType(0) = SOPTransType
    
    
            Dim eConnect As New eConnectType
            eConnect.SOPTransactionType = aSOPTransType
    
    
    'I haven't included this code, but I can if you need it.  
    
    
            clsMain.send(eConnect, server, db)
    
    
        End Sub
    
    
    End Class
    
    
    
    <font size="2"><font size="2">

    Steve Gray, MCDBA
    Technical Editor
    steve@VSToolsForum.com
    • 216.77.101.2
  • 06-04-2008 2:35 AM In reply to

    Re: Create a single payment document (cash receipt) and applying it to multiple invoices

    dear steve,

    is it possible for you to send me these classes, really appreicate or whole project I just wanted to see how you create and map the information using the econnect. I am akber whom you send the chapter 7 of econnect and I really thankful to you.

    Akber

     

    MCSD,
    Certified Microsoft Retail Specialist
    Certified Microsoft Great Plains Specialist
    Certified Cognos BI Specialist
    • 88.84.104.99
Page 1 of 1 (3 items)