VB code snippet for using the generalInvoiceResponseManager


Private Sub GeneralInvoiceResponseExampleButton_Click()

On Error GoTo Err_Trap

Dim bStatus As Boolean

'### GeneralInvoiceResponseManager interface
Dim generalInvoiceRequestManagerEx As GENERALINVOICERESPONSEMANAGER440Lib.GeneralInvoiceResponseManager
Set generalInvoiceRequestManagerEx = New GeneralInvoiceResponseManager

'### GeneralInvoiceResponse interface
Dim generalInvoiceResponseEx As GeneralInvoiceResponse


Dim strXML As String
Dim strXSD As String
Dim lVersion As Long
Dim strFromEAN As String
Dim strToEAN As String
Dim bIsEncrypted As YesNoType

strXML = "Response440_Accepted01.xml"

bStatus = generalInvoiceRequestManagerEx.GetXMLInfo(strXML, strXSD, strFromEAN, strToEAN, bIsEncrypted)
If bStatus And Not bIsEncrypted Then

    bStatus = generalInvoiceRequestManagerEx.LoadXML(strXML, "", "", generalInvoiceResponseEx)
    If bStatus Then
        Dim strCode As String
        Dim strText As String
        Dim bIsAnError As YesNoType
        Dim lRecordID As Long
        Dim strErrorValue As String
        Dim strValidValue As String
        Dim strOutput As String
        strOutput = ""
        bStatus = generalInvoiceResponseEx.GetFirstNotification(strCode,strText,bIsAnError,lRecordID,  _
                                                                strErrorValue,strValidValue)
        If bStatus Then
            strOutput = strOutput + "strCode=[" + strCode + "]strText=[" + strText + "]recordID=[" +  _
                        lRecordID + "]strErrorValue=[" + strErrorValue + "]strValidValue=[" +  _
                        strValidValue + "]" + vbCrLf
            Do While generalInvoiceResponseEx.GetNextNotification(strCode,strText,bIsAnError, lRecordID,  _
                                                                  strErrorValue, strValidValue)
                strOutput = strOutput + "strCode=[" + strCode + "]strText=[" + strText + "]recordID=[" + _
                            lRecordID +  "]strErrorValue=[" + strErrorValue + "]strValidValue=[" +  _
                            strValidValue + "]" + vbCrLf
            Loop
            MsgBox (strOutput)
        End If
    End If
    '### get amount
    Dim dAmountDue As Double
    Dim dAmountVat As Double
    Dim strCurrency As String
    Dim strVatNumber As String
    Dim lPaymentPeriod As Long
    bStatus = generalInvoiceResponseEx.GetBalance(dAmountDue, dAmountVat, strCurrency, strVatNumber, _
                                                  lPaymentPeriod)
    strOutput = "amountDue=[" & dAmountDue & "]dAmountVat=[" & dAmountVat & "]strCurrency=[" &  _
                strCurrency & "]strVatNumber=[" & strVatNumber & "]lPaymentPeriod=[" &  _
                lPaymentPeriod & "]"

    MsgBox (strOutput)

End If

'### relase resources
Set generalInvoiceResponseEx = Nothing
Set generalInvoiceRequestManagerEx = Nothing

Exit Sub

Err_Trap:
    MsgBox "Error: " & Err.Description, vbCritical, _
           "Opps! Error" & Str$(Err.Number)

'### relase resources
Set generalInvoiceResponseEx = Nothing
Set generalInvoiceRequestManagerEx = Nothing

End Sub