BillToPayQuery(2.0)

The BillToPayQuery request returns information about open bills and credits. You can use this information in subsequent BillPaymentCheck and BillPaymentCreditCard requests.


Request

Response

XMLOps

VB.NET

C#

Tag Type Max length Implementation Required

IBillToPayQuery

The BillToPayQuery request returns information about open bills and credits. You can use this information in subsequent BillPaymentCheck and BillPaymentCreditCard requests.
    2.0  

metaData

This is used in a query to cause a count of query objects to be returned. You can specify that the count of query objects is to be returned with the returned objects, or you can specify that only a count and no data is returned. (The default is that no count is returned.) A common use of this feature is to specify a count with no data in order to determine how many objects to expect from the actual query. If you don’t want a query to return a count, either don’t use this feature, or specify the value NoMetaData. If you want only a count, specify the value MetaDataOnly. If you want data and a count, specify MetaDataAndResponseData. You should be aware that the count returned via this setting is not guaranteed to be exact: it could be off slightly due to new object creation or deletions.
IQBENmetaDataType   4.0 us.png  

PayeeEntityRef

Refers to a payee who is a customer, vendor, employee, or person on the “other names” list. In a request, if a PayeeEntityRef aggregate includes both FullName and ListID, FullName will be ignored. In a Check message, PayeeEntityRef refers to the person or company to whom the check is written. In CreditCardCharge and CreditCardCredit messages, PayeeEntityRef refers to the vendor or company from whom merchandise was purchased. (PayeeEntityRef corresponds to the choice in the Purchased From list in QuickBooks.)
IQBBaseRef     Y

ListID

Along with FullName, ListID is a way to identify a list object. When a list object is added to QuickBooks through the SDK or through the QuickBooks user interface, the server assigns it a ListID. A ListID is not unique across lists, but it is unique across each particular type of list. For example, two customers could not have the same ListID, and a customer could not have the same ListID as an employee (because Customer and Employee are both name lists). But a customer could have the same ListID as a non-inventory item.
IQBIDType      

FullName

FullName (along with ListID) is a way to identify a list object. The FullName is the name prefixed by the names of each ancestor, for example Jones:Kitchen:Cabinets. FullName values are not case-sensitive.
IQBStringType 209 chars    

APAccountRef

Refers to an accounts payable account in the QuickBooks file. (The AccountType of this account will be AccountsPayable.) If APAccountRef is missing, the SDK will use the QuickBooks default AP account. In a request, if an APAccountRef aggregate includes both FullName and ListID, FullName will be ignored.
IQBBaseRef      

ListID

Along with FullName, ListID is a way to identify a list object. When a list object is added to QuickBooks through the SDK or through the QuickBooks user interface, the server assigns it a ListID. A ListID is not unique across lists, but it is unique across each particular type of list. For example, two customers could not have the same ListID, and a customer could not have the same ListID as an employee (because Customer and Employee are both name lists). But a customer could have the same ListID as a non-inventory item.
IQBIDType      

FullName

FullName (along with ListID) is a way to identify a list object. The FullName is the name prefixed by the names of each ancestor, for example Jones:Kitchen:Cabinets. FullName values are not case-sensitive.
IQBStringType 159 chars    

DueDate

The date on which payment is due.
IQBDateType      

CurrencyFilter

Filters by the specified currency.
ICurrencyFilter   8.0  

ORCurrencyFilter

IORCurrencyFilter     Y

ListIDList

One or more ListID values. Along with FullName, ListID is a way to identify a list object. When a list object is added to QuickBooks through the SDK or through the QuickBooks user interface, the server assigns it a ListID. A ListID is not unique across lists, but it is unique across each particular type of list. For example, two customers could not have the same ListID, and a customer could not have the same ListID as an employee (because Customer and Employee are both name lists). But a customer could have the same ListID as a non-inventory item.
IBSTRList      

FullNameList

A list of one or more FullName values. FullName (along with ListID) is a way to identify a list object. The FullName is the name prefixed by the names of each ancestor, for example Jones:Kitchen:Cabinets. FullName values are not case-sensitive.
IBSTRList 64 chars    

IncludeRetElementList

You use this if you want to limit the data that will be returned in the response. In this list, you specify the name of each top-level element or aggregate that you want to be returned in the response to the request. You cannot specify fields within an aggregate, for example, you cannot specify a City within an Address: you must specify Address and will get the entire address. The names specified in the list are not parsed, so you must be especially careful to supply valid names, properly cased. No error is returned in the status code if you specify an invalid name. Notice that if you want to return custom data or private data extensions, you must specify the DataExtRet element and you must supply the OwnerID set to either a value of 0 (custom data) or the GUID for the private data.
IBSTRList 50 chars 4.0  
Tag Type Max length Implementation Required

IResponse

The BillToPayQuery request returns information about open bills and credits. You can use this information in subsequent BillPaymentCheck and BillPaymentCreditCard requests.
    2.0  

StatusCode

A number that corresponds to a statusSeverity and statusMessage. Five status codes relate directly to signon messages: 2000, 2010, 2020, 2030, and 2040. For details about these and other statusCode values that can be returned, see the statusCode table on the Error Codes page.
IQBIntType     Y

StatusSeverity

One of the following values: INFO The request was completed, and the results are consistent with what your application expected. WARNING The request was completed, but the results might not be consistent with what you expected. ERROR The request was not completed. No data will appear in the server’s response after the statusMessage.
IQBStringType     Y

StatusMessage

A user-readable explanation of the success or error condition that is indicated by the statusCode. For details about the statusMessage values that can be returned, see the “Explanation” column of the statusCode table on the Error Codes page.
IQBStringType     Y

retCount

The retCount is returned in a query if in the query request you specified the metaData attribute with a value of MetaDataOnly (in which case the retCount is the only data returned in the query response) or MetaDataAndResponseData (the query response contains object data AND the approximate count). The retCount value contains the approximate count of the objects that could be expected to be returned from the query. A common use of this feature is to specify a count with no data in order to determine how many objects to expect from the actual query. You should be aware that the count returned in retCount is not guaranteed to be exact: it could be off slightly due to new object creation or deletions.
IQBIntType   4.0 us.png Y

Detail

IBillToPayRetList      

(List

of IBillToPayRet Objects)
       

ORBillToPayRet

IORBillToPayRet     Y

BillToPay

Each BillToPay object contains information about a bill with a positive AmountDue.
IBillToPay      

TxnID

QuickBooks generates a unique TxnID for each transaction that is added to QuickBooks. A TxnID returned from a request can be used to refer to the transaction in subsequent requests. Notice that you cannot supply the TxnID of a TimeTracking transaction to TransactionQueryRq requests. If you do, you get an error stating that no such record could be found, even though the transaction is in QuickBooks. This behavior reflects the behavior in the QuicKBooks UI in the Find window.
IQBIDType     Y

TxnType

The type of transaction.
IQBENTxnTypeType     Y

APAccountRef

Refers to an accounts payable account in the QuickBooks file. (The AccountType of this account will be AccountsPayable.) If APAccountRef is missing, the SDK will use the QuickBooks default AP account. In a request, if an APAccountRef aggregate includes both FullName and ListID, FullName will be ignored.
IQBBaseRef     Y

ListID

Along with FullName, ListID is a way to identify a list object. When a list object is added to QuickBooks through the SDK or through the QuickBooks user interface, the server assigns it a ListID. A ListID is not unique across lists, but it is unique across each particular type of list. For example, two customers could not have the same ListID, and a customer could not have the same ListID as an employee (because Customer and Employee are both name lists). But a customer could have the same ListID as a non-inventory item.
IQBIDType      

FullName

FullName (along with ListID) is a way to identify a list object. The FullName is the name prefixed by the names of each ancestor, for example Jones:Kitchen:Cabinets. FullName values are not case-sensitive.
IQBStringType 159 chars    

TxnDate

The date of the transaction. In some cases, if you leave TxnDate out of an -Add message, QuickBooks will prefill TxnDate with the date of the last-saved transaction of the same type.
IQBDateType     Y

RefNumber

A string of characters that refers to this transaction and that can be arbitrarily changed by the QuickBooks user. In a BillPaymentCheckAdd request, if you want to set the check number, use RefNumber. Note (especially relevant to CheckAdd requests): When RefNumber is left blank in an SDK transaction add request (that is, or ), the RefNumber will be left blank in QuickBooks. This behavior is new as of QBFC3. It used to select the next sequential reference number since the last one used by QuickBooks, as though no RefNumber had been provided. This is especially relevant to CheckAdd requests because with the current behavior, you will not know the number until the check is printed.
IQBStringType 20 chars    

DueDate

Selects bills due on this date. If you don’t specify DueDate, the filter will return bills from all dates.
IQBDateType      

AmountDue

The total monetary amount shown on a bill or packing slip received from a vendor. AmountDue will be the total of the amounts in the expense lines, item lines, and item group lines. AmountDue minus any credits or discounts equals the OpenAmount.
IQBAmountType     Y

CurrencyRef

The currency object contains all of the information needed by QuickBooks to display and use. For built-in currencies, the name and currency code values are internationally accepted values and thus are not editable. The comma format is editable, as is the IsActive status. For user-defined currencies, every value in the object is editable including name and currency code. When used with PriceLevels, the CurrencyRef should only be used with “per item” price levels.
IQBBaseRef   8.0  

ListID

Along with FullName, ListID is a way to identify a list object. When a list object is added to QuickBooks through the SDK or through the QuickBooks user interface, the server assigns it a ListID. A ListID is not unique across lists, but it is unique across each particular type of list. For example, two customers could not have the same ListID, and a customer could not have the same ListID as an employee (because Customer and Employee are both name lists). But a customer could have the same ListID as a non-inventory item.
IQBIDType   8.0  

FullName

FullName (along with ListID) is a way to identify a list object. The FullName is the name prefixed by the names of each ancestor, for example Jones:Kitchen:Cabinets. FullName values are not case-sensitive.
IQBStringType 64 chars 8.0  

ExchangeRate

The exchange rate is the market price for which this currency can be exchanged for the currency used by the QuickBooks company file as the “home” currency. The exchange rate should be considered a snapshot of the rates in effect at the AsOfDate. You can update the exchange rate using the exchange rate property when you add a transaction. However, you need to obtain and supply the exchange rate. If you are using USD (United States Dollars) as the home currency and are connected to the Internet, you can download the current exchange rates for all active currencies automatically in the QuickBooks UI by selecting Lists->Currency->Activities->Download latest exchange rates. (Currently, you can’t do this in the SDK.)
IQBFloatType   8.0  

AmountDueInHomeCurrency

Amount due in units of the home currency.
IQBAmountType   8.0  

CreditToApply

Each CreditToApply object contains information about a credit memo that is linked to this payee.
ICreditToApply      

TxnID

QuickBooks generates a unique TxnID for each transaction that is added to QuickBooks. A TxnID returned from a request can be used to refer to the transaction in subsequent requests. Notice that you cannot supply the TxnID of a TimeTracking transaction to TransactionQueryRq requests. If you do, you get an error stating that no such record could be found, even though the transaction is in QuickBooks. This behavior reflects the behavior in the QuicKBooks UI in the Find window.
IQBIDType     Y

TxnType

The type of transaction.
IQBENTxnTypeType     Y

APAccountRef

Refers to an accounts payable account in the QuickBooks file. (The AccountType of this account will be AccountsPayable.) If APAccountRef is missing, the SDK will use the QuickBooks default AP account. In a request, if an APAccountRef aggregate includes both FullName and ListID, FullName will be ignored.
IQBBaseRef     Y

ListID

Along with FullName, ListID is a way to identify a list object. When a list object is added to QuickBooks through the SDK or through the QuickBooks user interface, the server assigns it a ListID. A ListID is not unique across lists, but it is unique across each particular type of list. For example, two customers could not have the same ListID, and a customer could not have the same ListID as an employee (because Customer and Employee are both name lists). But a customer could have the same ListID as a non-inventory item.
IQBIDType      

FullName

FullName (along with ListID) is a way to identify a list object. The FullName is the name prefixed by the names of each ancestor, for example Jones:Kitchen:Cabinets. FullName values are not case-sensitive.
IQBStringType 159 chars    

TxnDate

The date of the transaction. In some cases, if you leave TxnDate out of an -Add message, QuickBooks will prefill TxnDate with the date of the last-saved transaction of the same type.
IQBDateType     Y

RefNumber

A string of characters that refers to this transaction and that can be arbitrarily changed by the QuickBooks user. In a BillPaymentCheckAdd request, if you want to set the check number, use RefNumber. Note (especially relevant to CheckAdd requests): When RefNumber is left blank in an SDK transaction add request (that is, or ), the RefNumber will be left blank in QuickBooks. This behavior is new as of QBFC3. It used to select the next sequential reference number since the last one used by QuickBooks, as though no RefNumber had been provided. This is especially relevant to CheckAdd requests because with the current behavior, you will not know the number until the check is printed.
IQBStringType 20 chars    

CreditRemaining

Available credit.
IQBAmountType     Y

CurrencyRef

The currency object contains all of the information needed by QuickBooks to display and use. For built-in currencies, the name and currency code values are internationally accepted values and thus are not editable. The comma format is editable, as is the IsActive status. For user-defined currencies, every value in the object is editable including name and currency code. When used with PriceLevels, the CurrencyRef should only be used with “per item” price levels.
IQBBaseRef   8.0  

ListID

Along with FullName, ListID is a way to identify a list object. When a list object is added to QuickBooks through the SDK or through the QuickBooks user interface, the server assigns it a ListID. A ListID is not unique across lists, but it is unique across each particular type of list. For example, two customers could not have the same ListID, and a customer could not have the same ListID as an employee (because Customer and Employee are both name lists). But a customer could have the same ListID as a non-inventory item.
IQBIDType   8.0  

FullName

FullName (along with ListID) is a way to identify a list object. The FullName is the name prefixed by the names of each ancestor, for example Jones:Kitchen:Cabinets. FullName values are not case-sensitive.
IQBStringType 64 chars 8.0  

ExchangeRate

The exchange rate is the market price for which this currency can be exchanged for the currency used by the QuickBooks company file as the “home” currency. The exchange rate should be considered a snapshot of the rates in effect at the AsOfDate. You can update the exchange rate using the exchange rate property when you add a transaction. However, you need to obtain and supply the exchange rate. If you are using USD (United States Dollars) as the home currency and are connected to the Internet, you can download the current exchange rates for all active currencies automatically in the QuickBooks UI by selecting Lists->Currency->Activities->Download latest exchange rates. (Currently, you can’t do this in the SDK.)
IQBFloatType   8.0  

CreditRemainingInHomeCurrency

The amount of the remaining credit, expressed in units of the current home currency.
IQBAmountType   8.0  

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="17.0"?>
<QBXML>
        <QBXMLMsgsRq onError="stopOnError">
                <BillToPayQueryRq metaData="ENUMTYPE">
                        <PayeeEntityRef> <!-- required -->
                                <ListID >IDTYPE</ListID> <!-- optional -->
                                <FullName >STRTYPE</FullName> <!-- optional -->
                        </PayeeEntityRef>
                        <APAccountRef> <!-- optional -->
                                <ListID >IDTYPE</ListID> <!-- optional -->
                                <FullName >STRTYPE</FullName> <!-- optional -->
                        </APAccountRef>
                        <DueDate >DATETYPE</DueDate> <!-- optional -->
                        <CurrencyFilter> <!-- optional -->
                                <!-- BEGIN OR -->
                                        <ListID >IDTYPE</ListID> <!-- optional, may repeat -->
                                <!-- OR -->
                                        <FullName >STRTYPE</FullName> <!-- optional, may repeat -->
                                <!-- END OR -->
                        </CurrencyFilter>
                        <IncludeRetElement >STRTYPE</IncludeRetElement> <!-- optional, may repeat -->
                </BillToPayQueryRq>

                <BillToPayQueryRs statusCode="INTTYPE" statusSeverity="STRTYPE" statusMessage="STRTYPE" retCount="INTTYPE">
                        <BillToPayRet> <!-- optional, may repeat -->
                                <!-- BEGIN OR -->
                                        <BillToPay> <!-- optional -->
                                                <TxnID >IDTYPE</TxnID> <!-- required -->
                                                <!-- TxnType may have one of the following values: ARRefundCreditCard, Bill, BillPaymentCheck, BillPaymentCreditCard, BuildAssembly, Charge, Check, CreditCardCharge, CreditCardCredit, CreditMemo, Deposit, Estimate, InventoryAdjustment, Invoice, ItemReceipt, JournalEntry, LiabilityAdjustment, Paycheck, PayrollLiabilityCheck, PurchaseOrder, ReceivePayment, SalesOrder, SalesReceipt, SalesTaxPaymentCheck, Transfer, VendorCredit, YTDAdjustment -->
                                                <TxnType >ENUMTYPE</TxnType> <!-- required -->
                                                <APAccountRef> <!-- required -->
                                                        <ListID >IDTYPE</ListID> <!-- optional -->
                                                        <FullName >STRTYPE</FullName> <!-- optional -->
                                                </APAccountRef>
                                                <TxnDate >DATETYPE</TxnDate> <!-- required -->
                                                <RefNumber >STRTYPE</RefNumber> <!-- optional -->
                                                <DueDate >DATETYPE</DueDate> <!-- optional -->
                                                <AmountDue >AMTTYPE</AmountDue> <!-- required -->
                                                <CurrencyRef> <!-- optional -->
                                                        <ListID >IDTYPE</ListID> <!-- optional -->
                                                        <FullName >STRTYPE</FullName> <!-- optional -->
                                                </CurrencyRef>
                                                <ExchangeRate >FLOATTYPE</ExchangeRate> <!-- optional -->
                                                <AmountDueInHomeCurrency >AMTTYPE</AmountDueInHomeCurrency> <!-- optional -->
                                        </BillToPay>
                                <!-- OR -->
                                        <CreditToApply> <!-- optional -->
                                                <TxnID >IDTYPE</TxnID> <!-- required -->
                                                <!-- TxnType may have one of the following values: ARRefundCreditCard, Bill, BillPaymentCheck, BillPaymentCreditCard, BuildAssembly, Charge, Check, CreditCardCharge, CreditCardCredit, CreditMemo, Deposit, Estimate, InventoryAdjustment, Invoice, ItemReceipt, JournalEntry, LiabilityAdjustment, Paycheck, PayrollLiabilityCheck, PurchaseOrder, ReceivePayment, SalesOrder, SalesReceipt, SalesTaxPaymentCheck, Transfer, VendorCredit, YTDAdjustment -->
                                                <TxnType >ENUMTYPE</TxnType> <!-- required -->
                                                <APAccountRef> <!-- required -->
                                                        <ListID >IDTYPE</ListID> <!-- optional -->
                                                        <FullName >STRTYPE</FullName> <!-- optional -->
                                                </APAccountRef>
                                                <TxnDate >DATETYPE</TxnDate> <!-- required -->
                                                <RefNumber >STRTYPE</RefNumber> <!-- optional -->
                                                <CreditRemaining >AMTTYPE</CreditRemaining> <!-- required -->
                                                <CurrencyRef> <!-- optional -->
                                                        <ListID >IDTYPE</ListID> <!-- optional -->
                                                        <FullName >STRTYPE</FullName> <!-- optional -->
                                                </CurrencyRef>
                                                <ExchangeRate >FLOATTYPE</ExchangeRate> <!-- optional -->
                                                <CreditRemainingInHomeCurrency >AMTTYPE</CreditRemainingInHomeCurrency> <!-- optional -->
                                        </CreditToApply>
                                <!-- END OR -->
                        </BillToPayRet>
                </BillToPayQueryRs>
        </QBXMLMsgsRq>
</QBXML>

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
'The following sample code is generated as an illustration of
'Creating requests and parsing responses ONLY
'This code is NOT intended to show best practices or ideal code
'Use at your most careful discretion

imports System
imports System.Net
imports System.Drawing
imports System.Collections
imports System.ComponentModel
imports System.Windows.Forms
imports System.Data
imports System.IO
imports Interop.QBFC16

Module com.intuit.idn.samples
        Public Class Sample
                Public Sub  DoBillToPayQuery()
                        Dim sessionBegun as Boolean
                        sessionBegun = False
                        Dim connectionOpen as Boolean
                        connectionOpen = False
                        Dim sessionManager as QBSessionManager
                        sessionManager = nothing

                        Try
                                'Create the session Manager object
                                sessionManager = new QBSessionManager

                                'Create the message set request object to hold our request
                                Dim requestMsgSet as IMsgSetRequest
                                requestMsgSet = sessionManager.CreateMsgSetRequest("US",16,0)
                                requestMsgSet.Attributes.OnError = ENRqOnError.roeContinue

                                BuildBillToPayQueryRq(requestMsgSet)

                                'Connect to QuickBooks and begin a session
                                sessionManager.OpenConnection("","Sample Code from OSR")
                                connectionOpen = True
                                sessionManager.BeginSession("", ENOpenMode.omDontCare)
                                sessionBegun = True

                                'Send the request and get the response from QuickBooks
                                Dim responseMsgSet as IMsgSetResponse
                                responseMsgSet = sessionManager.DoRequests(requestMsgSet)

                                'End the session and close the connection to QuickBooks
                                sessionManager.EndSession()
                                sessionBegun = False
                                sessionManager.CloseConnection()
                                connectionOpen = False

                                WalkBillToPayQueryRs(responseMsgSet)
                        Catch e as Exception
                                MessageBox.Show(e.Message, "Error")
                                if (sessionBegun) then
                                        sessionManager.EndSession()
                                End If
                                if (connectionOpen) then
                                        sessionManager.CloseConnection()
                                End If
                        End Try
                End Sub
                Public Sub BuildBillToPayQueryRq(requestMsgSet as IMsgSetRequest)
                        Dim BillToPayQueryRq as IBillToPayQuery
                        BillToPayQueryRq= requestMsgSet.AppendBillToPayQueryRq()
                        'Set field value for ListID
                        BillToPayQueryRq.PayeeEntityRef.ListID.SetValue("200000-1011023419")
                        'Set field value for FullName
                        BillToPayQueryRq.PayeeEntityRef.FullName.SetValue("ab")
                        'Set field value for ListID
                        BillToPayQueryRq.APAccountRef.ListID.SetValue("200000-1011023419")
                        'Set field value for FullName
                        BillToPayQueryRq.APAccountRef.FullName.SetValue("ab")
                        'Set field value for DueDate
                        BillToPayQueryRq.DueDate.SetValue(DateTime.Parse("12/15/2007"))
                        Dim ORCurrencyFilterElementType2070 as String
                        ORCurrencyFilterElementType2070 = "ListIDList"
                        if (ORCurrencyFilterElementType2070 == "ListIDList") then
                                'Set field value for ListIDList
                                'May create more than one of these if needed
                                BillToPayQueryRq.CurrencyFilter.ORCurrencyFilter.ListIDList.Add("200000-1011023419")
                        End If
                        if (ORCurrencyFilterElementType2070 == "FullNameList") then
                                'Set field value for FullNameList
                                'May create more than one of these if needed
                                BillToPayQueryRq.CurrencyFilter.ORCurrencyFilter.FullNameList.Add("ab")
                        End If
                        'Set field value for IncludeRetElementList
                        'May create more than one of these if needed
                        BillToPayQueryRq.IncludeRetElementList.Add("ab")
                End Sub




                Public Sub WalkBillToPayQueryRs( responseMsgSet as IMsgSetResponse)
                        if (responseMsgSet is nothing) then
                                Exit Sub
                        End If

                        Dim responseList as IResponseList
                        responseList = responseMsgSet.ResponseList
                        if (responseList is nothing) then
                                Exit Sub
                        End If

                        'if we sent only one request, there is only one response, we'll walk the list for this sample
                        for j=0 to responseList.Count-1
                                Dim response as IResponse
                                response = responseList.GetAt(j)
                                'check the status code of the response, 0=ok, >0 is warning
                                if (response.StatusCode >= 0) then
                                        'the request-specific response is in the details, make sure we have some
                                        if (not response.Detail is nothing) then
                                                'make sure the response is the type we're expecting
                                                Dim responseType as ENResponseType
                                                responseType = CType(response.Type.GetValue(),ENResponseType)
                                                if (responseType == ENResponseType.rtBillToPayQueryRs) then
                                                        'upcast to more specific type here, this is safe because we checked with response.Type check above
                                                        Dim BillToPayRet as IBillToPayRetList
                                                        BillToPayRet = CType(response.Detail,IBillToPayRetList)
                                                        WalkBillToPayRet(BillToPayRet)
                                                End If
                                        End If
                                End If
                        Next j
                End Sub




                Public Sub WalkBillToPayRet(BillToPayRet as IBillToPayRetList)
                        if (BillToPayRet is nothing) then
                                Exit Sub
                        End If

                        'Go through all the elements of IBillToPayRetList
                        if (not BillToPayRet.ORBillToPayRet is nothing) then
                                if (not BillToPayRet.ORBillToPayRet.BillToPay is nothing) then
                                        if (not BillToPayRet.ORBillToPayRet.BillToPay. is nothing) then
                                                'Get value of TxnID
                                                Dim TxnID2072 as String
                                                TxnID2072 = BillToPayRet.ORBillToPayRet.BillToPay.TxnID.GetValue()
                                                'Get value of TxnType
                                                Dim TxnType2073 as ENTxnType
                                                TxnType2073 = BillToPayRet.ORBillToPayRet.BillToPay.TxnType.GetValue()
                                                'Get value of ListID
                                                if ( not BillToPayRet.ORBillToPayRet.BillToPay.APAccountRef.ListID is nothing) then
                                                        Dim ListID2074 as String
                                                        ListID2074 = BillToPayRet.ORBillToPayRet.BillToPay.APAccountRef.ListID.GetValue()
                                                End If
                                                'Get value of FullName
                                                if ( not BillToPayRet.ORBillToPayRet.BillToPay.APAccountRef.FullName is nothing) then
                                                        Dim FullName2075 as String
                                                        FullName2075 = BillToPayRet.ORBillToPayRet.BillToPay.APAccountRef.FullName.GetValue()
                                                End If
                                                'Get value of TxnDate
                                                Dim TxnDate2076 as DateTime
                                                TxnDate2076 = BillToPayRet.ORBillToPayRet.BillToPay.TxnDate.GetValue()
                                                'Get value of RefNumber
                                                if ( not BillToPayRet.ORBillToPayRet.BillToPay.RefNumber is nothing) then
                                                        Dim RefNumber2077 as String
                                                        RefNumber2077 = BillToPayRet.ORBillToPayRet.BillToPay.RefNumber.GetValue()
                                                End If
                                                'Get value of DueDate
                                                if ( not BillToPayRet.ORBillToPayRet.BillToPay.DueDate is nothing) then
                                                        Dim DueDate2078 as DateTime
                                                        DueDate2078 = BillToPayRet.ORBillToPayRet.BillToPay.DueDate.GetValue()
                                                End If
                                                'Get value of AmountDue
                                                Dim AmountDue2079 as Double
                                                AmountDue2079 = BillToPayRet.ORBillToPayRet.BillToPay.AmountDue.GetValue()
                                                if (not BillToPayRet.ORBillToPayRet.BillToPay.CurrencyRef. is nothing) then
                                                        'Get value of ListID
                                                        if ( not BillToPayRet.ORBillToPayRet.BillToPay.CurrencyRef.ListID is nothing) then
                                                                Dim ListID2080 as String
                                                                ListID2080 = BillToPayRet.ORBillToPayRet.BillToPay.CurrencyRef.ListID.GetValue()
                                                        End If
                                                        'Get value of FullName
                                                        if ( not BillToPayRet.ORBillToPayRet.BillToPay.CurrencyRef.FullName is nothing) then
                                                                Dim FullName2081 as String
                                                                FullName2081 = BillToPayRet.ORBillToPayRet.BillToPay.CurrencyRef.FullName.GetValue()
                                                        End If
                                                End If
                                                'Get value of ExchangeRate
                                                if ( not BillToPayRet.ORBillToPayRet.BillToPay.ExchangeRate is nothing) then
                                                        Dim ExchangeRate2082 as IQBFloatType
                                                        ExchangeRate2082 = BillToPayRet.ORBillToPayRet.BillToPay.ExchangeRate.GetValue()
                                                End If
                                                'Get value of AmountDueInHomeCurrency
                                                if ( not BillToPayRet.ORBillToPayRet.BillToPay.AmountDueInHomeCurrency is nothing) then
                                                        Dim AmountDueInHomeCurrency2083 as Double
                                                        AmountDueInHomeCurrency2083 = BillToPayRet.ORBillToPayRet.BillToPay.AmountDueInHomeCurrency.GetValue()
                                                End If
                                        End If
                                End If
                                if (not BillToPayRet.ORBillToPayRet.CreditToApply is nothing) then
                                        if (not BillToPayRet.ORBillToPayRet.CreditToApply. is nothing) then
                                                'Get value of TxnID
                                                Dim TxnID2084 as String
                                                TxnID2084 = BillToPayRet.ORBillToPayRet.CreditToApply.TxnID.GetValue()
                                                'Get value of TxnType
                                                Dim TxnType2085 as ENTxnType
                                                TxnType2085 = BillToPayRet.ORBillToPayRet.CreditToApply.TxnType.GetValue()
                                                'Get value of ListID
                                                if ( not BillToPayRet.ORBillToPayRet.CreditToApply.APAccountRef.ListID is nothing) then
                                                        Dim ListID2086 as String
                                                        ListID2086 = BillToPayRet.ORBillToPayRet.CreditToApply.APAccountRef.ListID.GetValue()
                                                End If
                                                'Get value of FullName
                                                if ( not BillToPayRet.ORBillToPayRet.CreditToApply.APAccountRef.FullName is nothing) then
                                                        Dim FullName2087 as String
                                                        FullName2087 = BillToPayRet.ORBillToPayRet.CreditToApply.APAccountRef.FullName.GetValue()
                                                End If
                                                'Get value of TxnDate
                                                Dim TxnDate2088 as DateTime
                                                TxnDate2088 = BillToPayRet.ORBillToPayRet.CreditToApply.TxnDate.GetValue()
                                                'Get value of RefNumber
                                                if ( not BillToPayRet.ORBillToPayRet.CreditToApply.RefNumber is nothing) then
                                                        Dim RefNumber2089 as String
                                                        RefNumber2089 = BillToPayRet.ORBillToPayRet.CreditToApply.RefNumber.GetValue()
                                                End If
                                                'Get value of CreditRemaining
                                                Dim CreditRemaining2090 as Double
                                                CreditRemaining2090 = BillToPayRet.ORBillToPayRet.CreditToApply.CreditRemaining.GetValue()
                                                if (not BillToPayRet.ORBillToPayRet.CreditToApply.CurrencyRef. is nothing) then
                                                        'Get value of ListID
                                                        if ( not BillToPayRet.ORBillToPayRet.CreditToApply.CurrencyRef.ListID is nothing) then
                                                                Dim ListID2091 as String
                                                                ListID2091 = BillToPayRet.ORBillToPayRet.CreditToApply.CurrencyRef.ListID.GetValue()
                                                        End If
                                                        'Get value of FullName
                                                        if ( not BillToPayRet.ORBillToPayRet.CreditToApply.CurrencyRef.FullName is nothing) then
                                                                Dim FullName2092 as String
                                                                FullName2092 = BillToPayRet.ORBillToPayRet.CreditToApply.CurrencyRef.FullName.GetValue()
                                                        End If
                                                End If
                                                'Get value of ExchangeRate
                                                if ( not BillToPayRet.ORBillToPayRet.CreditToApply.ExchangeRate is nothing) then
                                                        Dim ExchangeRate2093 as IQBFloatType
                                                        ExchangeRate2093 = BillToPayRet.ORBillToPayRet.CreditToApply.ExchangeRate.GetValue()
                                                End If
                                                'Get value of CreditRemainingInHomeCurrency
                                                if ( not BillToPayRet.ORBillToPayRet.CreditToApply.CreditRemainingInHomeCurrency is nothing) then
                                                        Dim CreditRemainingInHomeCurrency2094 as Double
                                                        CreditRemainingInHomeCurrency2094 = BillToPayRet.ORBillToPayRet.CreditToApply.CreditRemainingInHomeCurrency.GetValue()
                                                End If
                                        End If
                                End If
                        End If
                End Sub




        End Class
End Module

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
//The following sample code is generated as an illustration of
//Creating requests and parsing responses ONLY
//This code is NOT intended to show best practices or ideal code
//Use at your most careful discretion

using System;
using System.Net;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;
using Interop.QBFC16;

namespace com.intuit.idn.samples
{
        public class Sample
        {
                public void  DoBillToPayQuery()
                {
                        bool sessionBegun = false;
                        bool connectionOpen = false;
                        QBSessionManager sessionManager = null;

                        try
                        {
                                //Create the session Manager object
                                sessionManager = new QBSessionManager();

                                //Create the message set request object to hold our request
                                IMsgSetRequest requestMsgSet = sessionManager.CreateMsgSetRequest("US",16,0);
                                requestMsgSet.Attributes.OnError = ENRqOnError.roeContinue;

                                BuildBillToPayQueryRq(requestMsgSet);

                                //Connect to QuickBooks and begin a session
                                sessionManager.OpenConnection("","Sample Code from OSR");
                                connectionOpen = true;
                                sessionManager.BeginSession("", ENOpenMode.omDontCare);
                                sessionBegun = true;

                                //Send the request and get the response from QuickBooks
                                IMsgSetResponse responseMsgSet = sessionManager.DoRequests(requestMsgSet);

                                //End the session and close the connection to QuickBooks
                                sessionManager.EndSession();
                                sessionBegun = false;
                                sessionManager.CloseConnection();
                                connectionOpen = false;

                                WalkBillToPayQueryRs(responseMsgSet);
                        }
                        catch (Exception e)
                        {
                                MessageBox.Show(e.Message, "Error");
                                if (sessionBegun)
                                {
                                        sessionManager.EndSession();
                                }
                                if (connectionOpen)
                                {
                                        sessionManager.CloseConnection();
                                }
                        }
                }
                void BuildBillToPayQueryRq(IMsgSetRequest requestMsgSet)
                {
                        IBillToPayQuery BillToPayQueryRq= requestMsgSet.AppendBillToPayQueryRq();
                        //Set attributes
                        //Set field value for metaData
                        BillToPayQueryRq.metaData.SetValue("IQBENmetaDataType");
                        //Set field value for ListID
                        BillToPayQueryRq.PayeeEntityRef.ListID.SetValue("200000-1011023419");
                        //Set field value for FullName
                        BillToPayQueryRq.PayeeEntityRef.FullName.SetValue("ab");
                        //Set field value for ListID
                        BillToPayQueryRq.APAccountRef.ListID.SetValue("200000-1011023419");
                        //Set field value for FullName
                        BillToPayQueryRq.APAccountRef.FullName.SetValue("ab");
                        //Set field value for DueDate
                        BillToPayQueryRq.DueDate.SetValue(DateTime.Parse("12/15/2007"));
                        string ORCurrencyFilterElementType2045 = "ListIDList";
                        if (ORCurrencyFilterElementType2045 == "ListIDList")
                        {
                                //Set field value for ListIDList
                                //May create more than one of these if needed
                                BillToPayQueryRq.CurrencyFilter.ORCurrencyFilter.ListIDList.Add("200000-1011023419");
                        }
                        if (ORCurrencyFilterElementType2045 == "FullNameList")
                        {
                                //Set field value for FullNameList
                                //May create more than one of these if needed
                                BillToPayQueryRq.CurrencyFilter.ORCurrencyFilter.FullNameList.Add("ab");
                        }
                        //Set field value for IncludeRetElementList
                        //May create more than one of these if needed
                        BillToPayQueryRq.IncludeRetElementList.Add("ab");
                }




                void WalkBillToPayQueryRs(IMsgSetResponse responseMsgSet)
                {
                        if (responseMsgSet == null) return;
                        IResponseList responseList = responseMsgSet.ResponseList;
                        if (responseList == null) return;
                        //if we sent only one request, there is only one response, we'll walk the list for this sample
                        for(int i=0; i < responseList.Count; i++)
                        {
                                IResponse response = responseList.GetAt(i);
                                //check the status code of the response, 0=ok, >0 is warning
                                if (response.StatusCode >= 0)
                                {
                                        //the request-specific response is in the details, make sure we have some
                                        if (response.Detail != null)
                                        {
                                                //make sure the response is the type we're expecting
                                                ENResponseType responseType = (ENResponseType)response.Type.GetValue();
                                                if (responseType == ENResponseType.rtBillToPayQueryRs)
                                                {
                                                        //upcast to more specific type here, this is safe because we checked with response.Type check above
                                                        IBillToPayRetList BillToPayRet = (IBillToPayRetList)response.Detail;
                                                        WalkBillToPayRet(BillToPayRet);
                                                }
                                        }
                                }
                        }
                }




                void WalkBillToPayRet(IBillToPayRetList BillToPayRet)
                {
                        if (BillToPayRet == null) return;
                        //Go through all the elements of IBillToPayRetList
                        if (BillToPayRet.ORBillToPayRet != null)
                        {
                                if (BillToPayRet.ORBillToPayRet.BillToPay != null)
                                {
                                        if (BillToPayRet.ORBillToPayRet.BillToPay != null)
                                        {
                                                //Get value of TxnID
                                                string TxnID2047 = (string)BillToPayRet.ORBillToPayRet.BillToPay.TxnID.GetValue();
                                                //Get value of TxnType
                                                ENTxnType TxnType2048 = (ENTxnType)BillToPayRet.ORBillToPayRet.BillToPay.TxnType.GetValue();
                                                //Get value of ListID
                                                if (BillToPayRet.ORBillToPayRet.BillToPay.APAccountRef.ListID != null)
                                                {
                                                        string ListID2049 = (string)BillToPayRet.ORBillToPayRet.BillToPay.APAccountRef.ListID.GetValue();
                                                }
                                                //Get value of FullName
                                                if (BillToPayRet.ORBillToPayRet.BillToPay.APAccountRef.FullName != null)
                                                {
                                                        string FullName2050 = (string)BillToPayRet.ORBillToPayRet.BillToPay.APAccountRef.FullName.GetValue();
                                                }
                                                //Get value of TxnDate
                                                DateTime TxnDate2051 = (DateTime)BillToPayRet.ORBillToPayRet.BillToPay.TxnDate.GetValue();
                                                //Get value of RefNumber
                                                if (BillToPayRet.ORBillToPayRet.BillToPay.RefNumber != null)
                                                {
                                                        string RefNumber2052 = (string)BillToPayRet.ORBillToPayRet.BillToPay.RefNumber.GetValue();
                                                }
                                                //Get value of DueDate
                                                if (BillToPayRet.ORBillToPayRet.BillToPay.DueDate != null)
                                                {
                                                        DateTime DueDate2053 = (DateTime)BillToPayRet.ORBillToPayRet.BillToPay.DueDate.GetValue();
                                                }
                                                //Get value of AmountDue
                                                double AmountDue2054 = (double)BillToPayRet.ORBillToPayRet.BillToPay.AmountDue.GetValue();
                                                if (BillToPayRet.ORBillToPayRet.BillToPay.CurrencyRef != null)
                                                {
                                                        //Get value of ListID
                                                        if (BillToPayRet.ORBillToPayRet.BillToPay.CurrencyRef.ListID != null)
                                                        {
                                                                string ListID2055 = (string)BillToPayRet.ORBillToPayRet.BillToPay.CurrencyRef.ListID.GetValue();
                                                        }
                                                        //Get value of FullName
                                                        if (BillToPayRet.ORBillToPayRet.BillToPay.CurrencyRef.FullName != null)
                                                        {
                                                                string FullName2056 = (string)BillToPayRet.ORBillToPayRet.BillToPay.CurrencyRef.FullName.GetValue();
                                                        }
                                                }
                                                //Get value of ExchangeRate
                                                if (BillToPayRet.ORBillToPayRet.BillToPay.ExchangeRate != null)
                                                {
                                                        IQBFloatType ExchangeRate2057 = (IQBFloatType)BillToPayRet.ORBillToPayRet.BillToPay.ExchangeRate.GetValue();
                                                }
                                                //Get value of AmountDueInHomeCurrency
                                                if (BillToPayRet.ORBillToPayRet.BillToPay.AmountDueInHomeCurrency != null)
                                                {
                                                        double AmountDueInHomeCurrency2058 = (double)BillToPayRet.ORBillToPayRet.BillToPay.AmountDueInHomeCurrency.GetValue();
                                                }
                                        }
                                }
                                if (BillToPayRet.ORBillToPayRet.CreditToApply != null)
                                {
                                        if (BillToPayRet.ORBillToPayRet.CreditToApply != null)
                                        {
                                                //Get value of TxnID
                                                string TxnID2059 = (string)BillToPayRet.ORBillToPayRet.CreditToApply.TxnID.GetValue();
                                                //Get value of TxnType
                                                ENTxnType TxnType2060 = (ENTxnType)BillToPayRet.ORBillToPayRet.CreditToApply.TxnType.GetValue();
                                                //Get value of ListID
                                                if (BillToPayRet.ORBillToPayRet.CreditToApply.APAccountRef.ListID != null)
                                                {
                                                        string ListID2061 = (string)BillToPayRet.ORBillToPayRet.CreditToApply.APAccountRef.ListID.GetValue();
                                                }
                                                //Get value of FullName
                                                if (BillToPayRet.ORBillToPayRet.CreditToApply.APAccountRef.FullName != null)
                                                {
                                                        string FullName2062 = (string)BillToPayRet.ORBillToPayRet.CreditToApply.APAccountRef.FullName.GetValue();
                                                }
                                                //Get value of TxnDate
                                                DateTime TxnDate2063 = (DateTime)BillToPayRet.ORBillToPayRet.CreditToApply.TxnDate.GetValue();
                                                //Get value of RefNumber
                                                if (BillToPayRet.ORBillToPayRet.CreditToApply.RefNumber != null)
                                                {
                                                        string RefNumber2064 = (string)BillToPayRet.ORBillToPayRet.CreditToApply.RefNumber.GetValue();
                                                }
                                                //Get value of CreditRemaining
                                                double CreditRemaining2065 = (double)BillToPayRet.ORBillToPayRet.CreditToApply.CreditRemaining.GetValue();
                                                if (BillToPayRet.ORBillToPayRet.CreditToApply.CurrencyRef != null)
                                                {
                                                        //Get value of ListID
                                                        if (BillToPayRet.ORBillToPayRet.CreditToApply.CurrencyRef.ListID != null)
                                                        {
                                                                string ListID2066 = (string)BillToPayRet.ORBillToPayRet.CreditToApply.CurrencyRef.ListID.GetValue();
                                                        }
                                                        //Get value of FullName
                                                        if (BillToPayRet.ORBillToPayRet.CreditToApply.CurrencyRef.FullName != null)
                                                        {
                                                                string FullName2067 = (string)BillToPayRet.ORBillToPayRet.CreditToApply.CurrencyRef.FullName.GetValue();
                                                        }
                                                }
                                                //Get value of ExchangeRate
                                                if (BillToPayRet.ORBillToPayRet.CreditToApply.ExchangeRate != null)
                                                {
                                                        IQBFloatType ExchangeRate2068 = (IQBFloatType)BillToPayRet.ORBillToPayRet.CreditToApply.ExchangeRate.GetValue();
                                                }
                                                //Get value of CreditRemainingInHomeCurrency
                                                if (BillToPayRet.ORBillToPayRet.CreditToApply.CreditRemainingInHomeCurrency != null)
                                                {
                                                        double CreditRemainingInHomeCurrency2069 = (double)BillToPayRet.ORBillToPayRet.CreditToApply.CreditRemainingInHomeCurrency.GetValue();
                                                }
                                        }
                                }
                        }
                }




        }
}