There are two types of voucher in QBPOS. A receiving voucher is a QuickBooks POS history document that provides a permanent record of merchandise received into inventory. When a shipment arrives from a vendor, you create a receiving voucher to update inventory. A return voucher, on the other hand, records merchandise returned to the vendor and removed from inventory. Use a return voucher if you need to send back items that have already been received into inventory. If you refuse delivery before creating a receiving voucher, such as for merchandise that arrives damaged, no return voucher should be made. When receiving merchandise ordered on a purchase order (PO), you can bring any or all of the ordered items to the voucher by “referencing” the PO on the voucher.
Request
Response
XMLOPS
VB.NET
C#
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 | <?xml version="1.0" encoding="utf-8"?> <?qbposxml version="4.0"?> <QBPOSXML> <QBPOSXMLMsgsRq onError="stopOnError"> <VoucherAddRq> <VoucherAdd defMacro="MACROTYPE"> <!-- required --> <Associate >STRTYPE</Associate> <!-- optional --> <Comments >STRTYPE</Comments> <!-- optional --> <Discount >AMTTYPE</Discount> <!-- optional --> <DiscountPercent >FLOATTYPE</DiscountPercent> <!-- optional --> <Fee >AMTTYPE</Fee> <!-- optional --> <Freight >AMTTYPE</Freight> <!-- optional --> <InvoiceDate >DATETYPE</InvoiceDate> <!-- optional --> <InvoiceDueDate >DATETYPE</InvoiceDueDate> <!-- optional --> <InvoiceNumber >STRTYPE</InvoiceNumber> <!-- optional --> <PayeeListID useMacro="MACROTYPE">IDTYPE</PayeeListID> <!-- optional --> <PurchaseOrderTxnID useMacro="MACROTYPE">IDTYPE</PurchaseOrderTxnID> <!-- optional --> <!-- QuickBooksFlag may have one of the following values: NotPosted, Completed, Error, UnbilledPurchases --> <QuickBooksFlag >ENUMTYPE</QuickBooksFlag> <!-- optional --> <StoreNumber >INTTYPE</StoreNumber> <!-- optional --> <TermsDiscount >FLOATTYPE</TermsDiscount> <!-- optional --> <TermsDiscountDays >INTTYPE</TermsDiscountDays> <!-- optional --> <TermsNetDays >INTTYPE</TermsNetDays> <!-- optional --> <TxnDate >DATETYPE</TxnDate> <!-- optional --> <!-- TxnState may have one of the following values: Normal, Held --> <TxnState >ENUMTYPE</TxnState> <!-- optional --> <VendorListID useMacro="MACROTYPE">IDTYPE</VendorListID> <!-- required --> <!-- VoucherType may have one of the following values: Receiving, Return --> <VoucherType >ENUMTYPE</VoucherType> <!-- optional --> <Workstation >INTTYPE</Workstation> <!-- optional --> <VoucherItemAdd> <!-- optional, may repeat --> <ListID useMacro="MACROTYPE">IDTYPE</ListID> <!-- required --> <ALU >STRTYPE</ALU> <!-- optional --> <Attribute >STRTYPE</Attribute> <!-- optional --> <Cost >AMTTYPE</Cost> <!-- optional --> <Desc1 >STRTYPE</Desc1> <!-- optional --> <Desc2 >STRTYPE</Desc2> <!-- optional --> <ExtendedCost >AMTTYPE</ExtendedCost> <!-- optional --> <QtyReceived >QUANTYPE</QtyReceived> <!-- optional --> <SerialNumber >STRTYPE</SerialNumber> <!-- optional --> <Size >STRTYPE</Size> <!-- optional --> <UnitOfMeasure >STRTYPE</UnitOfMeasure> <!-- optional --> <UPC >STRTYPE</UPC> <!-- optional --> </VoucherItemAdd> </VoucherAdd> <IncludeRetElement >STRTYPE</IncludeRetElement> <!-- optional, may repeat --> </VoucherAddRq> <VoucherAddRs statusCode="INTTYPE" statusSeverity="STRTYPE" statusMessage="STRTYPE"> <VoucherRet> <!-- optional --> <TxnID >IDTYPE</TxnID> <!-- optional --> <TimeCreated >DATETIMETYPE</TimeCreated> <!-- optional --> <TimeModified >DATETIMETYPE</TimeModified> <!-- optional --> <Associate >STRTYPE</Associate> <!-- optional --> <Comments >STRTYPE</Comments> <!-- optional --> <CompanyName >STRTYPE</CompanyName> <!-- optional --> <Discount >AMTTYPE</Discount> <!-- optional --> <DiscountPercent >FLOATTYPE</DiscountPercent> <!-- optional --> <Fee >AMTTYPE</Fee> <!-- optional --> <Freight >AMTTYPE</Freight> <!-- optional --> <!-- HistoryDocStatus may have one of the following values: Regular, Reversed, Reversing --> <HistoryDocStatus >ENUMTYPE</HistoryDocStatus> <!-- optional --> <InvoiceDate >DATETYPE</InvoiceDate> <!-- optional --> <InvoiceDueDate >DATETYPE</InvoiceDueDate> <!-- optional --> <InvoiceNumber >STRTYPE</InvoiceNumber> <!-- optional --> <ItemsCount >INTTYPE</ItemsCount> <!-- optional --> <PayeeCode >STRTYPE</PayeeCode> <!-- optional --> <PayeeListID >IDTYPE</PayeeListID> <!-- optional --> <PayeeName >STRTYPE</PayeeName> <!-- optional --> <PurchaseOrderNumber >STRTYPE</PurchaseOrderNumber> <!-- optional --> <PurchaseOrderTxnID >IDTYPE</PurchaseOrderTxnID> <!-- optional --> <!-- QuickBooksFlag may have one of the following values: NotPosted, Completed, Error, UnbilledPurchases --> <QuickBooksFlag >ENUMTYPE</QuickBooksFlag> <!-- optional --> <!-- StoreExchangeStatus may have one of the following values: Modified, Sent, Acknowledged --> <StoreExchangeStatus >ENUMTYPE</StoreExchangeStatus> <!-- optional --> <StoreNumber >INTTYPE</StoreNumber> <!-- optional --> <Subtotal >AMTTYPE</Subtotal> <!-- optional --> <TermsDiscount >FLOATTYPE</TermsDiscount> <!-- optional --> <TermsDiscountDays >INTTYPE</TermsDiscountDays> <!-- optional --> <TermsNetDays >INTTYPE</TermsNetDays> <!-- optional --> <Total >AMTTYPE</Total> <!-- optional --> <TotalQty >QUANTYPE</TotalQty> <!-- optional --> <TxnDate >DATETYPE</TxnDate> <!-- optional --> <!-- TxnState may have one of the following values: Normal, Held --> <TxnState >ENUMTYPE</TxnState> <!-- optional --> <VendorCode >STRTYPE</VendorCode> <!-- optional --> <VendorListID >IDTYPE</VendorListID> <!-- optional --> <VoucherNumber >INTTYPE</VoucherNumber> <!-- optional --> <!-- VoucherType may have one of the following values: Receiving, Return --> <VoucherType >ENUMTYPE</VoucherType> <!-- optional --> <Workstation >INTTYPE</Workstation> <!-- optional --> <VoucherItemRet> <!-- optional, may repeat --> <ListID >IDTYPE</ListID> <!-- optional --> <ALU >STRTYPE</ALU> <!-- optional --> <Attribute >STRTYPE</Attribute> <!-- optional --> <Cost >AMTTYPE</Cost> <!-- optional --> <Desc1 >STRTYPE</Desc1> <!-- optional --> <Desc2 >STRTYPE</Desc2> <!-- optional --> <ExtendedCost >AMTTYPE</ExtendedCost> <!-- optional --> <ItemNumber >INTTYPE</ItemNumber> <!-- optional --> <NumberOfBaseUnits >QUANTYPE</NumberOfBaseUnits> <!-- optional --> <OriginalOrderQty >QUANTYPE</OriginalOrderQty> <!-- optional --> <QtyReceived >QUANTYPE</QtyReceived> <!-- optional --> <SerialNumber >STRTYPE</SerialNumber> <!-- optional --> <Size >STRTYPE</Size> <!-- optional --> <UnitOfMeasure >STRTYPE</UnitOfMeasure> <!-- optional --> <UPC >STRTYPE</UPC> <!-- optional --> </VoucherItemRet> <DataExtRet> <!-- optional, may repeat --> <OwnerID >GUIDTYPE</OwnerID> <!-- required --> <DataExtName >STRTYPE</DataExtName> <!-- required --> <!-- DataExtType may have one of the following values: INTTYPE, AMTTYPE, PRICETYPE, QUANTYPE, PERCENTTYPE, DATETIMETYPE, STR255TYPE, STR1024TYPE --> <DataExtType >ENUMTYPE</DataExtType> <!-- required --> <DataExtValue >STRTYPE</DataExtValue> <!-- required --> </DataExtRet> </VoucherRet> </VoucherAddRs> </QBPOSXMLMsgsRq> </QBPOSXML> |
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 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 | '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.qbposfc4
Public Class SampleVoucherAdd
Public Sub DoVoucherAdd()
Dim sessionBegun as Boolean
sessionBegun = False
Dim connectionOpen as Boolean
connectionOpen = False
Dim sessionManager as QBPOSSessionManager
sessionManager = nothing
Try
'Create the session Manager object
sessionManager = new QBPOSSessionManager
'Create the message set request object to hold our request
Dim requestMsgSet as IMsgSetRequest
requestMsgSet = sessionManager.CreateMsgSetRequest(4,0)
requestMsgSet.Attributes.OnError = ENRqOnError.roeContinue
BuildVoucherAddRq(requestMsgSet)
'Connect to QuickBooks and begin a session
sessionManager.OpenConnection("","Sample Code from OSR")
connectionOpen = True
sessionManager.BeginSession("")
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
WalkVoucherAddRs(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 BuildVoucherAddRq(requestMsgSet as IMsgSetRequest)
Dim VoucherAddRq as IVoucherAdd
VoucherAddRq= requestMsgSet.AppendVoucherAddRq()
'Set field value for Associate
VoucherAddRq.Associate.SetValue("ab")
'Set field value for Comments
VoucherAddRq.Comments.SetValue("ab")
'Set field value for Discount
VoucherAddRq.Discount.SetValue(10.01)
'Set field value for DiscountPercent
VoucherAddRq.DiscountPercent.SetValue(12.34)
'Set field value for Fee
VoucherAddRq.Fee.SetValue(10.01)
'Set field value for Freight
VoucherAddRq.Freight.SetValue(10.01)
'Set field value for InvoiceDate
VoucherAddRq.InvoiceDate.SetValue(DateTime.Parse("12/15/2007"))
'Set field value for InvoiceDueDate
VoucherAddRq.InvoiceDueDate.SetValue(DateTime.Parse("12/15/2007"))
'Set field value for InvoiceNumber
VoucherAddRq.InvoiceNumber.SetValue("ab")
'Set field value for PayeeListID
VoucherAddRq.PayeeListID.SetValue("200000-1011023419")
'Set attributes
'Set field value for PayeeListID to use Macro
VoucherAddRq.PayeeListID.SetValueUseMacro("200000-1011023419")
'Set field value for PurchaseOrderTxnID
VoucherAddRq.PurchaseOrderTxnID.SetValue("200000-1011023419")
'Set attributes
'Set field value for PurchaseOrderTxnID to use Macro
VoucherAddRq.PurchaseOrderTxnID.SetValueUseMacro("200000-1011023419")
'Set field value for QuickBooksFlag
VoucherAddRq.QuickBooksFlag.SetValue(ENQuickBooksFlag.qbfNotPosted)
'Set field value for StoreNumber
VoucherAddRq.StoreNumber.SetValue(6)
'Set field value for TermsDiscount
VoucherAddRq.TermsDiscount.SetValue(12.34)
'Set field value for TermsDiscountDays
VoucherAddRq.TermsDiscountDays.SetValue(6)
'Set field value for TermsNetDays
VoucherAddRq.TermsNetDays.SetValue(6)
'Set field value for TxnDate
VoucherAddRq.TxnDate.SetValue(DateTime.Parse("12/15/2007"))
'Set field value for TxnState
VoucherAddRq.TxnState.SetValue(ENTxnState.tsNormal)
'Set field value for VendorListID
VoucherAddRq.VendorListID.SetValue("200000-1011023419")
'Set attributes
'Set field value for VendorListID to use Macro
VoucherAddRq.VendorListID.SetValueUseMacro("200000-1011023419")
'Set field value for VoucherType
VoucherAddRq.VoucherType.SetValue(ENVoucherType.vtReceiving)
'Set field value for Workstation
VoucherAddRq.Workstation.SetValue(6)
Dim VoucherItemAdd4735 as IVoucherItemAdd
VoucherItemAdd4735=VoucherAddRq.VoucherItemAddList.Append()
'Set field value for ListID
VoucherItemAdd4735.ListID.SetValue("200000-1011023419")
'Set attributes
'Set field value for ListID to use Macro
VoucherItemAdd4735.ListID.SetValueUseMacro("200000-1011023419")
'Set field value for ALU
VoucherItemAdd4735.ALU.SetValue("ab")
'Set field value for Attribute
VoucherItemAdd4735.Attribute.SetValue("ab")
'Set field value for Cost
VoucherItemAdd4735.Cost.SetValue(10.01)
'Set field value for Desc1
VoucherItemAdd4735.Desc1.SetValue("ab")
'Set field value for Desc2
VoucherItemAdd4735.Desc2.SetValue("ab")
'Set field value for ExtendedCost
VoucherItemAdd4735.ExtendedCost.SetValue(10.01)
'Set field value for QtyReceived
VoucherItemAdd4735.QtyReceived.SetValue(2)
'Set field value for SerialNumber
VoucherItemAdd4735.SerialNumber.SetValue("ab")
'Set field value for Size
VoucherItemAdd4735.Size.SetValue("ab")
'Set field value for UnitOfMeasure
VoucherItemAdd4735.UnitOfMeasure.SetValue("ab")
'Set field value for UPC
VoucherItemAdd4735.UPC.SetValue("ab")
'Set field value for IncludeRetElementList
'May create more than one of these if needed
VoucherAddRq.IncludeRetElementList.Add("ab")
End Sub
Public Sub WalkVoucherAddRs( 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.rtVoucherAddRs) then
'upcast to more specific type here, this is safe because we checked with response.Type check above
Dim VoucherRet as IVoucherRet
VoucherRet = CType(response.Detail,IVoucherRet)
WalkVoucherRet(VoucherRet)
End If
End If
End If
Next j
End Sub
Public Sub WalkVoucherRet(VoucherRet as IVoucherRet)
if (VoucherRet is nothing) then
Exit Sub
End If
'Go through all the elements of IVoucherRet
'Get value of TxnID
if ( not VoucherRet.TxnID is nothing) then
Dim TxnID4736 as String
TxnID4736 = VoucherRet.TxnID.GetValue()
End If
'Get value of TimeCreated
if ( not VoucherRet.TimeCreated is nothing) then
Dim TimeCreated4737 as DateTime
TimeCreated4737 = VoucherRet.TimeCreated.GetValue()
End If
'Get value of TimeModified
if ( not VoucherRet.TimeModified is nothing) then
Dim TimeModified4738 as DateTime
TimeModified4738 = VoucherRet.TimeModified.GetValue()
End If
'Get value of Associate
if ( not VoucherRet.Associate is nothing) then
Dim Associate4739 as String
Associate4739 = VoucherRet.Associate.GetValue()
End If
'Get value of Comments
if ( not VoucherRet.Comments is nothing) then
Dim Comments4740 as String
Comments4740 = VoucherRet.Comments.GetValue()
End If
'Get value of CompanyName
if ( not VoucherRet.CompanyName is nothing) then
Dim CompanyName4741 as String
CompanyName4741 = VoucherRet.CompanyName.GetValue()
End If
'Get value of Discount
if ( not VoucherRet.Discount is nothing) then
Dim Discount4742 as Double
Discount4742 = VoucherRet.Discount.GetValue()
End If
'Get value of DiscountPercent
if ( not VoucherRet.DiscountPercent is nothing) then
Dim DiscountPercent4743 as Single
DiscountPercent4743 = VoucherRet.DiscountPercent.GetValue()
End If
'Get value of Fee
if ( not VoucherRet.Fee is nothing) then
Dim Fee4744 as Double
Fee4744 = VoucherRet.Fee.GetValue()
End If
'Get value of Freight
if ( not VoucherRet.Freight is nothing) then
Dim Freight4745 as Double
Freight4745 = VoucherRet.Freight.GetValue()
End If
'Get value of HistoryDocStatus
if ( not VoucherRet.HistoryDocStatus is nothing) then
Dim HistoryDocStatus4746 as ENHistoryDocStatus
HistoryDocStatus4746 = VoucherRet.HistoryDocStatus.GetValue()
End If
'Get value of InvoiceDate
if ( not VoucherRet.InvoiceDate is nothing) then
Dim InvoiceDate4747 as DateTime
InvoiceDate4747 = VoucherRet.InvoiceDate.GetValue()
End If
'Get value of InvoiceDueDate
if ( not VoucherRet.InvoiceDueDate is nothing) then
Dim InvoiceDueDate4748 as DateTime
InvoiceDueDate4748 = VoucherRet.InvoiceDueDate.GetValue()
End If
'Get value of InvoiceNumber
if ( not VoucherRet.InvoiceNumber is nothing) then
Dim InvoiceNumber4749 as String
InvoiceNumber4749 = VoucherRet.InvoiceNumber.GetValue()
End If
'Get value of ItemsCount
if ( not VoucherRet.ItemsCount is nothing) then
Dim ItemsCount4750 as Integer
ItemsCount4750 = VoucherRet.ItemsCount.GetValue()
End If
'Get value of PayeeCode
if ( not VoucherRet.PayeeCode is nothing) then
Dim PayeeCode4751 as String
PayeeCode4751 = VoucherRet.PayeeCode.GetValue()
End If
'Get value of PayeeListID
if ( not VoucherRet.PayeeListID is nothing) then
Dim PayeeListID4752 as String
PayeeListID4752 = VoucherRet.PayeeListID.GetValue()
End If
'Get value of PayeeName
if ( not VoucherRet.PayeeName is nothing) then
Dim PayeeName4753 as String
PayeeName4753 = VoucherRet.PayeeName.GetValue()
End If
'Get value of PurchaseOrderNumber
if ( not VoucherRet.PurchaseOrderNumber is nothing) then
Dim PurchaseOrderNumber4754 as String
PurchaseOrderNumber4754 = VoucherRet.PurchaseOrderNumber.GetValue()
End If
'Get value of PurchaseOrderTxnID
if ( not VoucherRet.PurchaseOrderTxnID is nothing) then
Dim PurchaseOrderTxnID4755 as String
PurchaseOrderTxnID4755 = VoucherRet.PurchaseOrderTxnID.GetValue()
End If
'Get value of QuickBooksFlag
if ( not VoucherRet.QuickBooksFlag is nothing) then
Dim QuickBooksFlag4756 as ENQuickBooksFlag
QuickBooksFlag4756 = VoucherRet.QuickBooksFlag.GetValue()
End If
'Get value of StoreExchangeStatus
if ( not VoucherRet.StoreExchangeStatus is nothing) then
Dim StoreExchangeStatus4757 as ENStoreExchangeStatus
StoreExchangeStatus4757 = VoucherRet.StoreExchangeStatus.GetValue()
End If
'Get value of StoreNumber
if ( not VoucherRet.StoreNumber is nothing) then
Dim StoreNumber4758 as Integer
StoreNumber4758 = VoucherRet.StoreNumber.GetValue()
End If
'Get value of Subtotal
if ( not VoucherRet.Subtotal is nothing) then
Dim Subtotal4759 as Double
Subtotal4759 = VoucherRet.Subtotal.GetValue()
End If
'Get value of TermsDiscount
if ( not VoucherRet.TermsDiscount is nothing) then
Dim TermsDiscount4760 as Single
TermsDiscount4760 = VoucherRet.TermsDiscount.GetValue()
End If
'Get value of TermsDiscountDays
if ( not VoucherRet.TermsDiscountDays is nothing) then
Dim TermsDiscountDays4761 as Integer
TermsDiscountDays4761 = VoucherRet.TermsDiscountDays.GetValue()
End If
'Get value of TermsNetDays
if ( not VoucherRet.TermsNetDays is nothing) then
Dim TermsNetDays4762 as Integer
TermsNetDays4762 = VoucherRet.TermsNetDays.GetValue()
End If
'Get value of Total
if ( not VoucherRet.Total is nothing) then
Dim Total4763 as Double
Total4763 = VoucherRet.Total.GetValue()
End If
'Get value of TotalQty
if ( not VoucherRet.TotalQty is nothing) then
Dim TotalQty4764 as Double
TotalQty4764 = VoucherRet.TotalQty.GetValue()
End If
'Get value of TxnDate
if ( not VoucherRet.TxnDate is nothing) then
Dim TxnDate4765 as DateTime
TxnDate4765 = VoucherRet.TxnDate.GetValue()
End If
'Get value of TxnState
if ( not VoucherRet.TxnState is nothing) then
Dim TxnState4766 as ENTxnState
TxnState4766 = VoucherRet.TxnState.GetValue()
End If
'Get value of VendorCode
if ( not VoucherRet.VendorCode is nothing) then
Dim VendorCode4767 as String
VendorCode4767 = VoucherRet.VendorCode.GetValue()
End If
'Get value of VendorListID
if ( not VoucherRet.VendorListID is nothing) then
Dim VendorListID4768 as String
VendorListID4768 = VoucherRet.VendorListID.GetValue()
End If
'Get value of VoucherNumber
if ( not VoucherRet.VoucherNumber is nothing) then
Dim VoucherNumber4769 as Integer
VoucherNumber4769 = VoucherRet.VoucherNumber.GetValue()
End If
'Get value of VoucherType
if ( not VoucherRet.VoucherType is nothing) then
Dim VoucherType4770 as ENVoucherType
VoucherType4770 = VoucherRet.VoucherType.GetValue()
End If
'Get value of Workstation
if ( not VoucherRet.Workstation is nothing) then
Dim Workstation4771 as Integer
Workstation4771 = VoucherRet.Workstation.GetValue()
End If
if (not VoucherRet.VoucherItemRetList is nothing)
Dim i4772 as Integer
for i4772 = 0 to VoucherRet.VoucherItemRetList.Count - 1
Dim VoucherItemRet as IVoucherItemRet
VoucherItemRet = VoucherRet.VoucherItemRetList.GetAt(i4772)
'Get value of ListID
if ( not VoucherItemRet.ListID is nothing) then
Dim ListID4773 as String
ListID4773 = VoucherItemRet.ListID.GetValue()
End If
'Get value of ALU
if ( not VoucherItemRet.ALU is nothing) then
Dim ALU4774 as String
ALU4774 = VoucherItemRet.ALU.GetValue()
End If
'Get value of Attribute
if ( not VoucherItemRet.Attribute is nothing) then
Dim Attribute4775 as String
Attribute4775 = VoucherItemRet.Attribute.GetValue()
End If
'Get value of Cost
if ( not VoucherItemRet.Cost is nothing) then
Dim Cost4776 as Double
Cost4776 = VoucherItemRet.Cost.GetValue()
End If
'Get value of Desc1
if ( not VoucherItemRet.Desc1 is nothing) then
Dim Desc14777 as String
Desc14777 = VoucherItemRet.Desc1.GetValue()
End If
'Get value of Desc2
if ( not VoucherItemRet.Desc2 is nothing) then
Dim Desc24778 as String
Desc24778 = VoucherItemRet.Desc2.GetValue()
End If
'Get value of ExtendedCost
if ( not VoucherItemRet.ExtendedCost is nothing) then
Dim ExtendedCost4779 as Double
ExtendedCost4779 = VoucherItemRet.ExtendedCost.GetValue()
End If
'Get value of ItemNumber
if ( not VoucherItemRet.ItemNumber is nothing) then
Dim ItemNumber4780 as Integer
ItemNumber4780 = VoucherItemRet.ItemNumber.GetValue()
End If
'Get value of NumberOfBaseUnits
if ( not VoucherItemRet.NumberOfBaseUnits is nothing) then
Dim NumberOfBaseUnits4781 as Double
NumberOfBaseUnits4781 = VoucherItemRet.NumberOfBaseUnits.GetValue()
End If
'Get value of OriginalOrderQty
if ( not VoucherItemRet.OriginalOrderQty is nothing) then
Dim OriginalOrderQty4782 as Double
OriginalOrderQty4782 = VoucherItemRet.OriginalOrderQty.GetValue()
End If
'Get value of QtyReceived
if ( not VoucherItemRet.QtyReceived is nothing) then
Dim QtyReceived4783 as Double
QtyReceived4783 = VoucherItemRet.QtyReceived.GetValue()
End If
'Get value of SerialNumber
if ( not VoucherItemRet.SerialNumber is nothing) then
Dim SerialNumber4784 as String
SerialNumber4784 = VoucherItemRet.SerialNumber.GetValue()
End If
'Get value of Size
if ( not VoucherItemRet.Size is nothing) then
Dim Size4785 as String
Size4785 = VoucherItemRet.Size.GetValue()
End If
'Get value of UnitOfMeasure
if ( not VoucherItemRet.UnitOfMeasure is nothing) then
Dim UnitOfMeasure4786 as String
UnitOfMeasure4786 = VoucherItemRet.UnitOfMeasure.GetValue()
End If
'Get value of UPC
if ( not VoucherItemRet.UPC is nothing) then
Dim UPC4787 as String
UPC4787 = VoucherItemRet.UPC.GetValue()
End If
Next i4772
End If
if (not VoucherRet.DataExtRetList is nothing)
Dim i4788 as Integer
for i4788 = 0 to VoucherRet.DataExtRetList.Count - 1
Dim DataExtRet as IDataExtRet
DataExtRet = VoucherRet.DataExtRetList.GetAt(i4788)
'Get value of OwnerID
Dim OwnerID4789 as String
OwnerID4789 = DataExtRet.OwnerID.GetValue()
'Get value of DataExtName
Dim DataExtName4790 as String
DataExtName4790 = DataExtRet.DataExtName.GetValue()
'Get value of DataExtType
Dim DataExtType4791 as ENDataExtType
DataExtType4791 = DataExtRet.DataExtType.GetValue()
'Get value of DataExtValue
Dim DataExtValue4792 as String
DataExtValue4792 = DataExtRet.DataExtValue.GetValue()
Next i4788
End If
End Sub
End Class
|
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 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 | //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.qbposfc4; namespace com.intuit.idn.samples { public class SampleVoucherAdd { public void DoVoucherAdd() { bool sessionBegun = false; bool connectionOpen = false; QBPOSSessionManager sessionManager = null; try { //Create the session Manager object sessionManager = new QBPOSSessionManager(); //Create the message set request object to hold our request IMsgSetRequest requestMsgSet = sessionManager.CreateMsgSetRequest(4,0); requestMsgSet.Attributes.OnError = ENRqOnError.roeContinue; BuildVoucherAddRq(requestMsgSet); //Connect to QuickBooks and begin a session sessionManager.OpenConnection("","Sample Code from OSR"); connectionOpen = true; sessionManager.BeginSession(""); 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; WalkVoucherAddRs(responseMsgSet); } catch (Exception e) { MessageBox.Show(e.Message, "Error"); if (sessionBegun) { sessionManager.EndSession(); } if (connectionOpen) { sessionManager.CloseConnection(); } } } void BuildVoucherAddRq(IMsgSetRequest requestMsgSet) { IVoucherAdd VoucherAddRq= requestMsgSet.AppendVoucherAddRq(); //Set attributes //Set field value for defMacro VoucherAddRq.defMacro.SetValue("IQBStringType"); //Set field value for Associate VoucherAddRq.Associate.SetValue("ab"); //Set field value for Comments VoucherAddRq.Comments.SetValue("ab"); //Set field value for Discount VoucherAddRq.Discount.SetValue(10.01); //Set field value for DiscountPercent VoucherAddRq.DiscountPercent.SetValue(12.34F); //Set field value for Fee VoucherAddRq.Fee.SetValue(10.01); //Set field value for Freight VoucherAddRq.Freight.SetValue(10.01); //Set field value for InvoiceDate VoucherAddRq.InvoiceDate.SetValue(DateTime.Parse("12/15/2007")); //Set field value for InvoiceDueDate VoucherAddRq.InvoiceDueDate.SetValue(DateTime.Parse("12/15/2007")); //Set field value for InvoiceNumber VoucherAddRq.InvoiceNumber.SetValue("ab"); //Set field value for PayeeListID VoucherAddRq.PayeeListID.SetValue("200000-1011023419"); //Set attributes //Set field value for PayeeListID to use Macro VoucherAddRq.PayeeListID.SetValueUseMacro("200000-1011023419"); //Set field value for PurchaseOrderTxnID VoucherAddRq.PurchaseOrderTxnID.SetValue("200000-1011023419"); //Set attributes //Set field value for PurchaseOrderTxnID to use Macro VoucherAddRq.PurchaseOrderTxnID.SetValueUseMacro("200000-1011023419"); //Set field value for QuickBooksFlag VoucherAddRq.QuickBooksFlag.SetValue(ENQuickBooksFlag.qbfNotPosted); //Set field value for StoreNumber VoucherAddRq.StoreNumber.SetValue(6); //Set field value for TermsDiscount VoucherAddRq.TermsDiscount.SetValue(12.34F); //Set field value for TermsDiscountDays VoucherAddRq.TermsDiscountDays.SetValue(6); //Set field value for TermsNetDays VoucherAddRq.TermsNetDays.SetValue(6); //Set field value for TxnDate VoucherAddRq.TxnDate.SetValue(DateTime.Parse("12/15/2007")); //Set field value for TxnState VoucherAddRq.TxnState.SetValue(ENTxnState.tsNormal); //Set field value for VendorListID VoucherAddRq.VendorListID.SetValue("200000-1011023419"); //Set attributes //Set field value for VendorListID to use Macro VoucherAddRq.VendorListID.SetValueUseMacro("200000-1011023419"); //Set field value for VoucherType VoucherAddRq.VoucherType.SetValue(ENVoucherType.vtReceiving); //Set field value for Workstation VoucherAddRq.Workstation.SetValue(6); IVoucherItemAdd VoucherItemAdd4793=VoucherAddRq.VoucherItemAddList.Append(); //Set field value for ListID VoucherItemAdd4793.ListID.SetValue("200000-1011023419"); //Set attributes //Set field value for ListID to use Macro VoucherItemAdd4793.ListID.SetValueUseMacro("200000-1011023419"); //Set field value for ALU VoucherItemAdd4793.ALU.SetValue("ab"); //Set field value for Attribute VoucherItemAdd4793.Attribute.SetValue("ab"); //Set field value for Cost VoucherItemAdd4793.Cost.SetValue(10.01); //Set field value for Desc1 VoucherItemAdd4793.Desc1.SetValue("ab"); //Set field value for Desc2 VoucherItemAdd4793.Desc2.SetValue("ab"); //Set field value for ExtendedCost VoucherItemAdd4793.ExtendedCost.SetValue(10.01); //Set field value for QtyReceived VoucherItemAdd4793.QtyReceived.SetValue(2); //Set field value for SerialNumber VoucherItemAdd4793.SerialNumber.SetValue("ab"); //Set field value for Size VoucherItemAdd4793.Size.SetValue("ab"); //Set field value for UnitOfMeasure VoucherItemAdd4793.UnitOfMeasure.SetValue("ab"); //Set field value for UPC VoucherItemAdd4793.UPC.SetValue("ab"); //Set field value for IncludeRetElementList //May create more than one of these if needed VoucherAddRq.IncludeRetElementList.Add("ab"); } void WalkVoucherAddRs(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.rtVoucherAddRs) { //upcast to more specific type here, this is safe because we checked with response.Type check above IVoucherRet VoucherRet = (IVoucherRet)response.Detail; WalkVoucherRet(VoucherRet); } } } } } void WalkVoucherRet(IVoucherRet VoucherRet) { if (VoucherRet == null) return; //Go through all the elements of IVoucherRet //Get value of TxnID if (VoucherRet.TxnID != null) { string TxnID4794 = (string)VoucherRet.TxnID.GetValue(); } //Get value of TimeCreated if (VoucherRet.TimeCreated != null) { DateTime TimeCreated4795 = (DateTime)VoucherRet.TimeCreated.GetValue(); } //Get value of TimeModified if (VoucherRet.TimeModified != null) { DateTime TimeModified4796 = (DateTime)VoucherRet.TimeModified.GetValue(); } //Get value of Associate if (VoucherRet.Associate != null) { string Associate4797 = (string)VoucherRet.Associate.GetValue(); } //Get value of Comments if (VoucherRet.Comments != null) { string Comments4798 = (string)VoucherRet.Comments.GetValue(); } //Get value of CompanyName if (VoucherRet.CompanyName != null) { string CompanyName4799 = (string)VoucherRet.CompanyName.GetValue(); } //Get value of Discount if (VoucherRet.Discount != null) { double Discount4800 = (double)VoucherRet.Discount.GetValue(); } //Get value of DiscountPercent if (VoucherRet.DiscountPercent != null) { float DiscountPercent4801 = (float)VoucherRet.DiscountPercent.GetValue(); } //Get value of Fee if (VoucherRet.Fee != null) { double Fee4802 = (double)VoucherRet.Fee.GetValue(); } //Get value of Freight if (VoucherRet.Freight != null) { double Freight4803 = (double)VoucherRet.Freight.GetValue(); } //Get value of HistoryDocStatus if (VoucherRet.HistoryDocStatus != null) { ENHistoryDocStatus HistoryDocStatus4804 = (ENHistoryDocStatus)VoucherRet.HistoryDocStatus.GetValue(); } //Get value of InvoiceDate if (VoucherRet.InvoiceDate != null) { DateTime InvoiceDate4805 = (DateTime)VoucherRet.InvoiceDate.GetValue(); } //Get value of InvoiceDueDate if (VoucherRet.InvoiceDueDate != null) { DateTime InvoiceDueDate4806 = (DateTime)VoucherRet.InvoiceDueDate.GetValue(); } //Get value of InvoiceNumber if (VoucherRet.InvoiceNumber != null) { string InvoiceNumber4807 = (string)VoucherRet.InvoiceNumber.GetValue(); } //Get value of ItemsCount if (VoucherRet.ItemsCount != null) { int ItemsCount4808 = (int)VoucherRet.ItemsCount.GetValue(); } //Get value of PayeeCode if (VoucherRet.PayeeCode != null) { string PayeeCode4809 = (string)VoucherRet.PayeeCode.GetValue(); } //Get value of PayeeListID if (VoucherRet.PayeeListID != null) { string PayeeListID4810 = (string)VoucherRet.PayeeListID.GetValue(); } //Get value of PayeeName if (VoucherRet.PayeeName != null) { string PayeeName4811 = (string)VoucherRet.PayeeName.GetValue(); } //Get value of PurchaseOrderNumber if (VoucherRet.PurchaseOrderNumber != null) { string PurchaseOrderNumber4812 = (string)VoucherRet.PurchaseOrderNumber.GetValue(); } //Get value of PurchaseOrderTxnID if (VoucherRet.PurchaseOrderTxnID != null) { string PurchaseOrderTxnID4813 = (string)VoucherRet.PurchaseOrderTxnID.GetValue(); } //Get value of QuickBooksFlag if (VoucherRet.QuickBooksFlag != null) { ENQuickBooksFlag QuickBooksFlag4814 = (ENQuickBooksFlag)VoucherRet.QuickBooksFlag.GetValue(); } //Get value of StoreExchangeStatus if (VoucherRet.StoreExchangeStatus != null) { ENStoreExchangeStatus StoreExchangeStatus4815 = (ENStoreExchangeStatus)VoucherRet.StoreExchangeStatus.GetValue(); } //Get value of StoreNumber if (VoucherRet.StoreNumber != null) { int StoreNumber4816 = (int)VoucherRet.StoreNumber.GetValue(); } //Get value of Subtotal if (VoucherRet.Subtotal != null) { double Subtotal4817 = (double)VoucherRet.Subtotal.GetValue(); } //Get value of TermsDiscount if (VoucherRet.TermsDiscount != null) { float TermsDiscount4818 = (float)VoucherRet.TermsDiscount.GetValue(); } //Get value of TermsDiscountDays if (VoucherRet.TermsDiscountDays != null) { int TermsDiscountDays4819 = (int)VoucherRet.TermsDiscountDays.GetValue(); } //Get value of TermsNetDays if (VoucherRet.TermsNetDays != null) { int TermsNetDays4820 = (int)VoucherRet.TermsNetDays.GetValue(); } //Get value of Total if (VoucherRet.Total != null) { double Total4821 = (double)VoucherRet.Total.GetValue(); } //Get value of TotalQty if (VoucherRet.TotalQty != null) { int TotalQty4822 = (int)VoucherRet.TotalQty.GetValue(); } //Get value of TxnDate if (VoucherRet.TxnDate != null) { DateTime TxnDate4823 = (DateTime)VoucherRet.TxnDate.GetValue(); } //Get value of TxnState if (VoucherRet.TxnState != null) { ENTxnState TxnState4824 = (ENTxnState)VoucherRet.TxnState.GetValue(); } //Get value of VendorCode if (VoucherRet.VendorCode != null) { string VendorCode4825 = (string)VoucherRet.VendorCode.GetValue(); } //Get value of VendorListID if (VoucherRet.VendorListID != null) { string VendorListID4826 = (string)VoucherRet.VendorListID.GetValue(); } //Get value of VoucherNumber if (VoucherRet.VoucherNumber != null) { int VoucherNumber4827 = (int)VoucherRet.VoucherNumber.GetValue(); } //Get value of VoucherType if (VoucherRet.VoucherType != null) { ENVoucherType VoucherType4828 = (ENVoucherType)VoucherRet.VoucherType.GetValue(); } //Get value of Workstation if (VoucherRet.Workstation != null) { int Workstation4829 = (int)VoucherRet.Workstation.GetValue(); } if (VoucherRet.VoucherItemRetList != null) { for (int i4830 = 0; i4830 < VoucherRet.VoucherItemRetList.Count; i4830++) { IVoucherItemRet VoucherItemRet = VoucherRet.VoucherItemRetList.GetAt(i4830); //Get value of ListID if (VoucherItemRet.ListID != null) { string ListID4831 = (string)VoucherItemRet.ListID.GetValue(); } //Get value of ALU if (VoucherItemRet.ALU != null) { string ALU4832 = (string)VoucherItemRet.ALU.GetValue(); } //Get value of Attribute if (VoucherItemRet.Attribute != null) { string Attribute4833 = (string)VoucherItemRet.Attribute.GetValue(); } //Get value of Cost if (VoucherItemRet.Cost != null) { double Cost4834 = (double)VoucherItemRet.Cost.GetValue(); } //Get value of Desc1 if (VoucherItemRet.Desc1 != null) { string Desc14835 = (string)VoucherItemRet.Desc1.GetValue(); } //Get value of Desc2 if (VoucherItemRet.Desc2 != null) { string Desc24836 = (string)VoucherItemRet.Desc2.GetValue(); } //Get value of ExtendedCost if (VoucherItemRet.ExtendedCost != null) { double ExtendedCost4837 = (double)VoucherItemRet.ExtendedCost.GetValue(); } //Get value of ItemNumber if (VoucherItemRet.ItemNumber != null) { int ItemNumber4838 = (int)VoucherItemRet.ItemNumber.GetValue(); } //Get value of NumberOfBaseUnits if (VoucherItemRet.NumberOfBaseUnits != null) { int NumberOfBaseUnits4839 = (int)VoucherItemRet.NumberOfBaseUnits.GetValue(); } //Get value of OriginalOrderQty if (VoucherItemRet.OriginalOrderQty != null) { int OriginalOrderQty4840 = (int)VoucherItemRet.OriginalOrderQty.GetValue(); } //Get value of QtyReceived if (VoucherItemRet.QtyReceived != null) { int QtyReceived4841 = (int)VoucherItemRet.QtyReceived.GetValue(); } //Get value of SerialNumber if (VoucherItemRet.SerialNumber != null) { string SerialNumber4842 = (string)VoucherItemRet.SerialNumber.GetValue(); } //Get value of Size if (VoucherItemRet.Size != null) { string Size4843 = (string)VoucherItemRet.Size.GetValue(); } //Get value of UnitOfMeasure if (VoucherItemRet.UnitOfMeasure != null) { string UnitOfMeasure4844 = (string)VoucherItemRet.UnitOfMeasure.GetValue(); } //Get value of UPC if (VoucherItemRet.UPC != null) { string UPC4845 = (string)VoucherItemRet.UPC.GetValue(); } } } if (VoucherRet.DataExtRetList != null) { for (int i4846 = 0; i4846 < VoucherRet.DataExtRetList.Count; i4846++) { IDataExtRet DataExtRet = VoucherRet.DataExtRetList.GetAt(i4846); //Get value of OwnerID string OwnerID4847 = (string)DataExtRet.OwnerID.GetValue(); //Get value of DataExtName string DataExtName4848 = (string)DataExtRet.DataExtName.GetValue(); //Get value of DataExtType ENDataExtType DataExtType4849 = (ENDataExtType)DataExtRet.DataExtType.GetValue(); //Get value of DataExtValue string DataExtValue4850 = (string)DataExtRet.DataExtValue.GetValue(); } } } } } |