Modifies an existing PO in QBPOS. You must be careful when modifying line items in the purchase order! If you omit any existing txn lines in your mod, those lines will be dropped and you’ll lose their data. To retain a line, simply include its current TxnLineID: that’s all you need to do to retain the line. How do you add a new line to an existing PO? 1. In your PurchaseOrderMod, supply the TxnID of the purchase order you are mod’ing. except for the line items, which I’ll get to next, that’s ALL you need to supply. QBPOS will figure out all the other details using the TxnID you just gave. 2. Reconstruct the line items block. To do this, (a) Insert a separate PurchaseOrderItemMod aggregate for each existing line item that you want to keep, with that line’s current TxnLineID. That’s all you need to do for an existing line, unless you want to mod something within the line item, in which case you need to supply the elements you want to change. (b) If you want to delete any existing line item, simply omit its PurchaseOrderItemMod aggregate: that will cause the line to be dropped. (c) Wherever you want to add a new line in that existing PO, simply specify out its PurchaseOrderItemMod aggregate as you want, but use the TxnLineID value of -1 (minus 1). That tells QBPOS that its a new item.
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 | <?xml version="1.0" encoding="utf-8"?> <?qbposxml version="4.0"?> <QBPOSXML> <QBPOSXMLMsgsRq onError="stopOnError"> <PurchaseOrderModRq> <PurchaseOrderMod> <!-- required --> <TxnID useMacro="MACROTYPE">IDTYPE</TxnID> <!-- required --> <Associate >STRTYPE</Associate> <!-- optional --> <CancelDate >DATETYPE</CancelDate> <!-- optional --> <Discount >AMTTYPE</Discount> <!-- optional --> <DiscountPercent >FLOATTYPE</DiscountPercent> <!-- optional --> <Fee >AMTTYPE</Fee> <!-- optional --> <Instructions >STRTYPE</Instructions> <!-- optional --> <PurchaseOrderNumber >STRTYPE</PurchaseOrderNumber> <!-- optional --> <PurchaseOrderStatusDesc >STRTYPE</PurchaseOrderStatusDesc> <!-- optional --> <ShipToStoreNumber >INTTYPE</ShipToStoreNumber> <!-- optional --> <StartShipDate >DATETYPE</StartShipDate> <!-- optional --> <StoreNumber >INTTYPE</StoreNumber> <!-- optional --> <TermsDiscount >FLOATTYPE</TermsDiscount> <!-- optional --> <TermsDiscountDays >INTTYPE</TermsDiscountDays> <!-- optional --> <TermsNetDays >INTTYPE</TermsNetDays> <!-- optional --> <TxnDate >DATETYPE</TxnDate> <!-- optional --> <VendorListID useMacro="MACROTYPE">IDTYPE</VendorListID> <!-- optional --> <PurchaseOrderItemMod> <!-- optional, may repeat --> <ListID useMacro="MACROTYPE">IDTYPE</ListID> <!-- optional --> <TxnLineID >INTTYPE</TxnLineID> <!-- 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 --> <Qty >QUANTYPE</Qty> <!-- optional --> <Size >STRTYPE</Size> <!-- optional --> <UnitOfMeasure >STRTYPE</UnitOfMeasure> <!-- optional --> <UPC >STRTYPE</UPC> <!-- optional --> </PurchaseOrderItemMod> </PurchaseOrderMod> <IncludeRetElement >STRTYPE</IncludeRetElement> <!-- optional, may repeat --> </PurchaseOrderModRq> <PurchaseOrderModRs statusCode="INTTYPE" statusSeverity="STRTYPE" statusMessage="STRTYPE"> <PurchaseOrderRet> <!-- optional --> <TxnID >IDTYPE</TxnID> <!-- optional --> <TimeCreated >DATETIMETYPE</TimeCreated> <!-- optional --> <TimeModified >DATETIMETYPE</TimeModified> <!-- optional --> <Associate >STRTYPE</Associate> <!-- optional --> <CancelDate >DATETYPE</CancelDate> <!-- optional --> <CompanyName >STRTYPE</CompanyName> <!-- optional --> <Discount >AMTTYPE</Discount> <!-- optional --> <DiscountPercent >FLOATTYPE</DiscountPercent> <!-- optional --> <Fee >AMTTYPE</Fee> <!-- optional --> <Instructions >STRTYPE</Instructions> <!-- optional --> <ItemsCount >INTTYPE</ItemsCount> <!-- optional --> <PurchaseOrderNumber >STRTYPE</PurchaseOrderNumber> <!-- optional --> <PurchaseOrderStatusDesc >STRTYPE</PurchaseOrderStatusDesc> <!-- optional --> <QtyDue >QUANTYPE</QtyDue> <!-- optional --> <QtyOrdered >QUANTYPE</QtyOrdered> <!-- optional --> <QtyReceived >QUANTYPE</QtyReceived> <!-- optional --> <SalesOrderNumber >STRTYPE</SalesOrderNumber> <!-- optional --> <ShipToStoreNumber >INTTYPE</ShipToStoreNumber> <!-- optional --> <StartShipDate >DATETYPE</StartShipDate> <!-- optional --> <!-- StoreExchangeStatus may have one of the following values: Modified, Sent, Acknowledged --> <StoreExchangeStatus >ENUMTYPE</StoreExchangeStatus> <!-- optional --> <StoreNumber >INTTYPE</StoreNumber> <!-- optional --> <Subtotal >AMTTYPE</Subtotal> <!-- optional --> <Terms >STRTYPE</Terms> <!-- optional --> <TermsDiscount >FLOATTYPE</TermsDiscount> <!-- optional --> <TermsDiscountDays >INTTYPE</TermsDiscountDays> <!-- optional --> <TermsNetDays >INTTYPE</TermsNetDays> <!-- optional --> <Total >AMTTYPE</Total> <!-- optional --> <TxnDate >DATETYPE</TxnDate> <!-- optional --> <UnfilledPercent >FLOATTYPE</UnfilledPercent> <!-- optional --> <VendorCode >STRTYPE</VendorCode> <!-- optional --> <VendorListID >IDTYPE</VendorListID> <!-- optional --> <PurchaseOrderItemRet> <!-- optional, may repeat --> <ListID >IDTYPE</ListID> <!-- optional --> <TxnLineID >INTTYPE</TxnLineID> <!-- 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 --> <Qty >QUANTYPE</Qty> <!-- optional --> <QtyReceived >QUANTYPE</QtyReceived> <!-- optional --> <Size >STRTYPE</Size> <!-- optional --> <UnitOfMeasure >STRTYPE</UnitOfMeasure> <!-- optional --> <UPC >STRTYPE</UPC> <!-- optional --> </PurchaseOrderItemRet> <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> </PurchaseOrderRet> </PurchaseOrderModRs> </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 | '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 SamplePurchaseOrderMod
Public Sub DoPurchaseOrderMod()
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
BuildPurchaseOrderModRq(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
WalkPurchaseOrderModRs(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 BuildPurchaseOrderModRq(requestMsgSet as IMsgSetRequest)
Dim PurchaseOrderModRq as IPurchaseOrderMod
PurchaseOrderModRq= requestMsgSet.AppendPurchaseOrderModRq()
'Set field value for TxnID
PurchaseOrderModRq.TxnID.SetValue("200000-1011023419")
'Set attributes
'Set field value for TxnID to use Macro
PurchaseOrderModRq.TxnID.SetValueUseMacro("200000-1011023419")
'Set field value for Associate
PurchaseOrderModRq.Associate.SetValue("ab")
'Set field value for CancelDate
PurchaseOrderModRq.CancelDate.SetValue(DateTime.Parse("12/15/2007"))
'Set field value for Discount
PurchaseOrderModRq.Discount.SetValue(10.01)
'Set field value for DiscountPercent
PurchaseOrderModRq.DiscountPercent.SetValue(12.34)
'Set field value for Fee
PurchaseOrderModRq.Fee.SetValue(10.01)
'Set field value for Instructions
PurchaseOrderModRq.Instructions.SetValue("ab")
'Set field value for PurchaseOrderNumber
PurchaseOrderModRq.PurchaseOrderNumber.SetValue("ab")
'Set field value for PurchaseOrderStatusDesc
PurchaseOrderModRq.PurchaseOrderStatusDesc.SetValue("ab")
'Set field value for ShipToStoreNumber
PurchaseOrderModRq.ShipToStoreNumber.SetValue(6)
'Set field value for StartShipDate
PurchaseOrderModRq.StartShipDate.SetValue(DateTime.Parse("12/15/2007"))
'Set field value for StoreNumber
PurchaseOrderModRq.StoreNumber.SetValue(6)
'Set field value for TermsDiscount
PurchaseOrderModRq.TermsDiscount.SetValue(12.34)
'Set field value for TermsDiscountDays
PurchaseOrderModRq.TermsDiscountDays.SetValue(6)
'Set field value for TermsNetDays
PurchaseOrderModRq.TermsNetDays.SetValue(6)
'Set field value for TxnDate
PurchaseOrderModRq.TxnDate.SetValue(DateTime.Parse("12/15/2007"))
'Set field value for VendorListID
PurchaseOrderModRq.VendorListID.SetValue("200000-1011023419")
'Set attributes
'Set field value for VendorListID to use Macro
PurchaseOrderModRq.VendorListID.SetValueUseMacro("200000-1011023419")
Dim PurchaseOrderItemMod2755 as IPurchaseOrderItemMod
PurchaseOrderItemMod2755=PurchaseOrderModRq.PurchaseOrderItemModList.Append()
'Set field value for ListID
PurchaseOrderItemMod2755.ListID.SetValue("200000-1011023419")
'Set attributes
'Set field value for ListID to use Macro
PurchaseOrderItemMod2755.ListID.SetValueUseMacro("200000-1011023419")
'Set field value for TxnLineID
PurchaseOrderItemMod2755.TxnLineID.SetValue(6)
'Set field value for ALU
PurchaseOrderItemMod2755.ALU.SetValue("ab")
'Set field value for Attribute
PurchaseOrderItemMod2755.Attribute.SetValue("ab")
'Set field value for Cost
PurchaseOrderItemMod2755.Cost.SetValue(10.01)
'Set field value for Desc1
PurchaseOrderItemMod2755.Desc1.SetValue("ab")
'Set field value for Desc2
PurchaseOrderItemMod2755.Desc2.SetValue("ab")
'Set field value for ExtendedCost
PurchaseOrderItemMod2755.ExtendedCost.SetValue(10.01)
'Set field value for Qty
PurchaseOrderItemMod2755.Qty.SetValue(2)
'Set field value for Size
PurchaseOrderItemMod2755.Size.SetValue("ab")
'Set field value for UnitOfMeasure
PurchaseOrderItemMod2755.UnitOfMeasure.SetValue("ab")
'Set field value for UPC
PurchaseOrderItemMod2755.UPC.SetValue("ab")
'Set field value for IncludeRetElementList
'May create more than one of these if needed
PurchaseOrderModRq.IncludeRetElementList.Add("ab")
End Sub
Public Sub WalkPurchaseOrderModRs( 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.rtPurchaseOrderModRs) then
'upcast to more specific type here, this is safe because we checked with response.Type check above
Dim PurchaseOrderRet as IPurchaseOrderRet
PurchaseOrderRet = CType(response.Detail,IPurchaseOrderRet)
WalkPurchaseOrderRet(PurchaseOrderRet)
End If
End If
End If
Next j
End Sub
Public Sub WalkPurchaseOrderRet(PurchaseOrderRet as IPurchaseOrderRet)
if (PurchaseOrderRet is nothing) then
Exit Sub
End If
'Go through all the elements of IPurchaseOrderRet
'Get value of TxnID
if ( not PurchaseOrderRet.TxnID is nothing) then
Dim TxnID2756 as String
TxnID2756 = PurchaseOrderRet.TxnID.GetValue()
End If
'Get value of TimeCreated
if ( not PurchaseOrderRet.TimeCreated is nothing) then
Dim TimeCreated2757 as DateTime
TimeCreated2757 = PurchaseOrderRet.TimeCreated.GetValue()
End If
'Get value of TimeModified
if ( not PurchaseOrderRet.TimeModified is nothing) then
Dim TimeModified2758 as DateTime
TimeModified2758 = PurchaseOrderRet.TimeModified.GetValue()
End If
'Get value of Associate
if ( not PurchaseOrderRet.Associate is nothing) then
Dim Associate2759 as String
Associate2759 = PurchaseOrderRet.Associate.GetValue()
End If
'Get value of CancelDate
if ( not PurchaseOrderRet.CancelDate is nothing) then
Dim CancelDate2760 as DateTime
CancelDate2760 = PurchaseOrderRet.CancelDate.GetValue()
End If
'Get value of CompanyName
if ( not PurchaseOrderRet.CompanyName is nothing) then
Dim CompanyName2761 as String
CompanyName2761 = PurchaseOrderRet.CompanyName.GetValue()
End If
'Get value of Discount
if ( not PurchaseOrderRet.Discount is nothing) then
Dim Discount2762 as Double
Discount2762 = PurchaseOrderRet.Discount.GetValue()
End If
'Get value of DiscountPercent
if ( not PurchaseOrderRet.DiscountPercent is nothing) then
Dim DiscountPercent2763 as Single
DiscountPercent2763 = PurchaseOrderRet.DiscountPercent.GetValue()
End If
'Get value of Fee
if ( not PurchaseOrderRet.Fee is nothing) then
Dim Fee2764 as Double
Fee2764 = PurchaseOrderRet.Fee.GetValue()
End If
'Get value of Instructions
if ( not PurchaseOrderRet.Instructions is nothing) then
Dim Instructions2765 as String
Instructions2765 = PurchaseOrderRet.Instructions.GetValue()
End If
'Get value of ItemsCount
if ( not PurchaseOrderRet.ItemsCount is nothing) then
Dim ItemsCount2766 as Integer
ItemsCount2766 = PurchaseOrderRet.ItemsCount.GetValue()
End If
'Get value of PurchaseOrderNumber
if ( not PurchaseOrderRet.PurchaseOrderNumber is nothing) then
Dim PurchaseOrderNumber2767 as String
PurchaseOrderNumber2767 = PurchaseOrderRet.PurchaseOrderNumber.GetValue()
End If
'Get value of PurchaseOrderStatusDesc
if ( not PurchaseOrderRet.PurchaseOrderStatusDesc is nothing) then
Dim PurchaseOrderStatusDesc2768 as String
PurchaseOrderStatusDesc2768 = PurchaseOrderRet.PurchaseOrderStatusDesc.GetValue()
End If
'Get value of QtyDue
if ( not PurchaseOrderRet.QtyDue is nothing) then
Dim QtyDue2769 as Double
QtyDue2769 = PurchaseOrderRet.QtyDue.GetValue()
End If
'Get value of QtyOrdered
if ( not PurchaseOrderRet.QtyOrdered is nothing) then
Dim QtyOrdered2770 as Double
QtyOrdered2770 = PurchaseOrderRet.QtyOrdered.GetValue()
End If
'Get value of QtyReceived
if ( not PurchaseOrderRet.QtyReceived is nothing) then
Dim QtyReceived2771 as Double
QtyReceived2771 = PurchaseOrderRet.QtyReceived.GetValue()
End If
'Get value of SalesOrderNumber
if ( not PurchaseOrderRet.SalesOrderNumber is nothing) then
Dim SalesOrderNumber2772 as String
SalesOrderNumber2772 = PurchaseOrderRet.SalesOrderNumber.GetValue()
End If
'Get value of ShipToStoreNumber
if ( not PurchaseOrderRet.ShipToStoreNumber is nothing) then
Dim ShipToStoreNumber2773 as Integer
ShipToStoreNumber2773 = PurchaseOrderRet.ShipToStoreNumber.GetValue()
End If
'Get value of StartShipDate
if ( not PurchaseOrderRet.StartShipDate is nothing) then
Dim StartShipDate2774 as DateTime
StartShipDate2774 = PurchaseOrderRet.StartShipDate.GetValue()
End If
'Get value of StoreExchangeStatus
if ( not PurchaseOrderRet.StoreExchangeStatus is nothing) then
Dim StoreExchangeStatus2775 as ENStoreExchangeStatus
StoreExchangeStatus2775 = PurchaseOrderRet.StoreExchangeStatus.GetValue()
End If
'Get value of StoreNumber
if ( not PurchaseOrderRet.StoreNumber is nothing) then
Dim StoreNumber2776 as Integer
StoreNumber2776 = PurchaseOrderRet.StoreNumber.GetValue()
End If
'Get value of Subtotal
if ( not PurchaseOrderRet.Subtotal is nothing) then
Dim Subtotal2777 as Double
Subtotal2777 = PurchaseOrderRet.Subtotal.GetValue()
End If
'Get value of Terms
if ( not PurchaseOrderRet.Terms is nothing) then
Dim Terms2778 as String
Terms2778 = PurchaseOrderRet.Terms.GetValue()
End If
'Get value of TermsDiscount
if ( not PurchaseOrderRet.TermsDiscount is nothing) then
Dim TermsDiscount2779 as Single
TermsDiscount2779 = PurchaseOrderRet.TermsDiscount.GetValue()
End If
'Get value of TermsDiscountDays
if ( not PurchaseOrderRet.TermsDiscountDays is nothing) then
Dim TermsDiscountDays2780 as Integer
TermsDiscountDays2780 = PurchaseOrderRet.TermsDiscountDays.GetValue()
End If
'Get value of TermsNetDays
if ( not PurchaseOrderRet.TermsNetDays is nothing) then
Dim TermsNetDays2781 as Integer
TermsNetDays2781 = PurchaseOrderRet.TermsNetDays.GetValue()
End If
'Get value of Total
if ( not PurchaseOrderRet.Total is nothing) then
Dim Total2782 as Double
Total2782 = PurchaseOrderRet.Total.GetValue()
End If
'Get value of TxnDate
if ( not PurchaseOrderRet.TxnDate is nothing) then
Dim TxnDate2783 as DateTime
TxnDate2783 = PurchaseOrderRet.TxnDate.GetValue()
End If
'Get value of UnfilledPercent
if ( not PurchaseOrderRet.UnfilledPercent is nothing) then
Dim UnfilledPercent2784 as Single
UnfilledPercent2784 = PurchaseOrderRet.UnfilledPercent.GetValue()
End If
'Get value of VendorCode
if ( not PurchaseOrderRet.VendorCode is nothing) then
Dim VendorCode2785 as String
VendorCode2785 = PurchaseOrderRet.VendorCode.GetValue()
End If
'Get value of VendorListID
if ( not PurchaseOrderRet.VendorListID is nothing) then
Dim VendorListID2786 as String
VendorListID2786 = PurchaseOrderRet.VendorListID.GetValue()
End If
if (not PurchaseOrderRet.PurchaseOrderItemRetList is nothing)
Dim i2787 as Integer
for i2787 = 0 to PurchaseOrderRet.PurchaseOrderItemRetList.Count - 1
Dim PurchaseOrderItemRet as IPurchaseOrderItemRet
PurchaseOrderItemRet = PurchaseOrderRet.PurchaseOrderItemRetList.GetAt(i2787)
'Get value of ListID
if ( not PurchaseOrderItemRet.ListID is nothing) then
Dim ListID2788 as String
ListID2788 = PurchaseOrderItemRet.ListID.GetValue()
End If
'Get value of TxnLineID
if ( not PurchaseOrderItemRet.TxnLineID is nothing) then
Dim TxnLineID2789 as Integer
TxnLineID2789 = PurchaseOrderItemRet.TxnLineID.GetValue()
End If
'Get value of ALU
if ( not PurchaseOrderItemRet.ALU is nothing) then
Dim ALU2790 as String
ALU2790 = PurchaseOrderItemRet.ALU.GetValue()
End If
'Get value of Attribute
if ( not PurchaseOrderItemRet.Attribute is nothing) then
Dim Attribute2791 as String
Attribute2791 = PurchaseOrderItemRet.Attribute.GetValue()
End If
'Get value of Cost
if ( not PurchaseOrderItemRet.Cost is nothing) then
Dim Cost2792 as Double
Cost2792 = PurchaseOrderItemRet.Cost.GetValue()
End If
'Get value of Desc1
if ( not PurchaseOrderItemRet.Desc1 is nothing) then
Dim Desc12793 as String
Desc12793 = PurchaseOrderItemRet.Desc1.GetValue()
End If
'Get value of Desc2
if ( not PurchaseOrderItemRet.Desc2 is nothing) then
Dim Desc22794 as String
Desc22794 = PurchaseOrderItemRet.Desc2.GetValue()
End If
'Get value of ExtendedCost
if ( not PurchaseOrderItemRet.ExtendedCost is nothing) then
Dim ExtendedCost2795 as Double
ExtendedCost2795 = PurchaseOrderItemRet.ExtendedCost.GetValue()
End If
'Get value of ItemNumber
if ( not PurchaseOrderItemRet.ItemNumber is nothing) then
Dim ItemNumber2796 as Integer
ItemNumber2796 = PurchaseOrderItemRet.ItemNumber.GetValue()
End If
'Get value of NumberOfBaseUnits
if ( not PurchaseOrderItemRet.NumberOfBaseUnits is nothing) then
Dim NumberOfBaseUnits2797 as Double
NumberOfBaseUnits2797 = PurchaseOrderItemRet.NumberOfBaseUnits.GetValue()
End If
'Get value of Qty
if ( not PurchaseOrderItemRet.Qty is nothing) then
Dim Qty2798 as Double
Qty2798 = PurchaseOrderItemRet.Qty.GetValue()
End If
'Get value of QtyReceived
if ( not PurchaseOrderItemRet.QtyReceived is nothing) then
Dim QtyReceived2799 as Double
QtyReceived2799 = PurchaseOrderItemRet.QtyReceived.GetValue()
End If
'Get value of Size
if ( not PurchaseOrderItemRet.Size is nothing) then
Dim Size2800 as String
Size2800 = PurchaseOrderItemRet.Size.GetValue()
End If
'Get value of UnitOfMeasure
if ( not PurchaseOrderItemRet.UnitOfMeasure is nothing) then
Dim UnitOfMeasure2801 as String
UnitOfMeasure2801 = PurchaseOrderItemRet.UnitOfMeasure.GetValue()
End If
'Get value of UPC
if ( not PurchaseOrderItemRet.UPC is nothing) then
Dim UPC2802 as String
UPC2802 = PurchaseOrderItemRet.UPC.GetValue()
End If
Next i2787
End If
if (not PurchaseOrderRet.DataExtRetList is nothing)
Dim i2803 as Integer
for i2803 = 0 to PurchaseOrderRet.DataExtRetList.Count - 1
Dim DataExtRet as IDataExtRet
DataExtRet = PurchaseOrderRet.DataExtRetList.GetAt(i2803)
'Get value of OwnerID
Dim OwnerID2804 as String
OwnerID2804 = DataExtRet.OwnerID.GetValue()
'Get value of DataExtName
Dim DataExtName2805 as String
DataExtName2805 = DataExtRet.DataExtName.GetValue()
'Get value of DataExtType
Dim DataExtType2806 as ENDataExtType
DataExtType2806 = DataExtRet.DataExtType.GetValue()
'Get value of DataExtValue
Dim DataExtValue2807 as String
DataExtValue2807 = DataExtRet.DataExtValue.GetValue()
Next i2803
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 | //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 SamplePurchaseOrderMod { public void DoPurchaseOrderMod() { 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; BuildPurchaseOrderModRq(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; WalkPurchaseOrderModRs(responseMsgSet); } catch (Exception e) { MessageBox.Show(e.Message, "Error"); if (sessionBegun) { sessionManager.EndSession(); } if (connectionOpen) { sessionManager.CloseConnection(); } } } void BuildPurchaseOrderModRq(IMsgSetRequest requestMsgSet) { IPurchaseOrderMod PurchaseOrderModRq= requestMsgSet.AppendPurchaseOrderModRq(); //Set field value for TxnID PurchaseOrderModRq.TxnID.SetValue("200000-1011023419"); //Set attributes //Set field value for TxnID to use Macro PurchaseOrderModRq.TxnID.SetValueUseMacro("200000-1011023419"); //Set field value for Associate PurchaseOrderModRq.Associate.SetValue("ab"); //Set field value for CancelDate PurchaseOrderModRq.CancelDate.SetValue(DateTime.Parse("12/15/2007")); //Set field value for Discount PurchaseOrderModRq.Discount.SetValue(10.01); //Set field value for DiscountPercent PurchaseOrderModRq.DiscountPercent.SetValue(12.34F); //Set field value for Fee PurchaseOrderModRq.Fee.SetValue(10.01); //Set field value for Instructions PurchaseOrderModRq.Instructions.SetValue("ab"); //Set field value for PurchaseOrderNumber PurchaseOrderModRq.PurchaseOrderNumber.SetValue("ab"); //Set field value for PurchaseOrderStatusDesc PurchaseOrderModRq.PurchaseOrderStatusDesc.SetValue("ab"); //Set field value for ShipToStoreNumber PurchaseOrderModRq.ShipToStoreNumber.SetValue(6); //Set field value for StartShipDate PurchaseOrderModRq.StartShipDate.SetValue(DateTime.Parse("12/15/2007")); //Set field value for StoreNumber PurchaseOrderModRq.StoreNumber.SetValue(6); //Set field value for TermsDiscount PurchaseOrderModRq.TermsDiscount.SetValue(12.34F); //Set field value for TermsDiscountDays PurchaseOrderModRq.TermsDiscountDays.SetValue(6); //Set field value for TermsNetDays PurchaseOrderModRq.TermsNetDays.SetValue(6); //Set field value for TxnDate PurchaseOrderModRq.TxnDate.SetValue(DateTime.Parse("12/15/2007")); //Set field value for VendorListID PurchaseOrderModRq.VendorListID.SetValue("200000-1011023419"); //Set attributes //Set field value for VendorListID to use Macro PurchaseOrderModRq.VendorListID.SetValueUseMacro("200000-1011023419"); IPurchaseOrderItemMod PurchaseOrderItemMod2808=PurchaseOrderModRq.PurchaseOrderItemModList.Append(); //Set field value for ListID PurchaseOrderItemMod2808.ListID.SetValue("200000-1011023419"); //Set attributes //Set field value for ListID to use Macro PurchaseOrderItemMod2808.ListID.SetValueUseMacro("200000-1011023419"); //Set field value for TxnLineID PurchaseOrderItemMod2808.TxnLineID.SetValue(6); //Set field value for ALU PurchaseOrderItemMod2808.ALU.SetValue("ab"); //Set field value for Attribute PurchaseOrderItemMod2808.Attribute.SetValue("ab"); //Set field value for Cost PurchaseOrderItemMod2808.Cost.SetValue(10.01); //Set field value for Desc1 PurchaseOrderItemMod2808.Desc1.SetValue("ab"); //Set field value for Desc2 PurchaseOrderItemMod2808.Desc2.SetValue("ab"); //Set field value for ExtendedCost PurchaseOrderItemMod2808.ExtendedCost.SetValue(10.01); //Set field value for Qty PurchaseOrderItemMod2808.Qty.SetValue(2); //Set field value for Size PurchaseOrderItemMod2808.Size.SetValue("ab"); //Set field value for UnitOfMeasure PurchaseOrderItemMod2808.UnitOfMeasure.SetValue("ab"); //Set field value for UPC PurchaseOrderItemMod2808.UPC.SetValue("ab"); //Set field value for IncludeRetElementList //May create more than one of these if needed PurchaseOrderModRq.IncludeRetElementList.Add("ab"); } void WalkPurchaseOrderModRs(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.rtPurchaseOrderModRs) { //upcast to more specific type here, this is safe because we checked with response.Type check above IPurchaseOrderRet PurchaseOrderRet = (IPurchaseOrderRet)response.Detail; WalkPurchaseOrderRet(PurchaseOrderRet); } } } } } void WalkPurchaseOrderRet(IPurchaseOrderRet PurchaseOrderRet) { if (PurchaseOrderRet == null) return; //Go through all the elements of IPurchaseOrderRet //Get value of TxnID if (PurchaseOrderRet.TxnID != null) { string TxnID2809 = (string)PurchaseOrderRet.TxnID.GetValue(); } //Get value of TimeCreated if (PurchaseOrderRet.TimeCreated != null) { DateTime TimeCreated2810 = (DateTime)PurchaseOrderRet.TimeCreated.GetValue(); } //Get value of TimeModified if (PurchaseOrderRet.TimeModified != null) { DateTime TimeModified2811 = (DateTime)PurchaseOrderRet.TimeModified.GetValue(); } //Get value of Associate if (PurchaseOrderRet.Associate != null) { string Associate2812 = (string)PurchaseOrderRet.Associate.GetValue(); } //Get value of CancelDate if (PurchaseOrderRet.CancelDate != null) { DateTime CancelDate2813 = (DateTime)PurchaseOrderRet.CancelDate.GetValue(); } //Get value of CompanyName if (PurchaseOrderRet.CompanyName != null) { string CompanyName2814 = (string)PurchaseOrderRet.CompanyName.GetValue(); } //Get value of Discount if (PurchaseOrderRet.Discount != null) { double Discount2815 = (double)PurchaseOrderRet.Discount.GetValue(); } //Get value of DiscountPercent if (PurchaseOrderRet.DiscountPercent != null) { float DiscountPercent2816 = (float)PurchaseOrderRet.DiscountPercent.GetValue(); } //Get value of Fee if (PurchaseOrderRet.Fee != null) { double Fee2817 = (double)PurchaseOrderRet.Fee.GetValue(); } //Get value of Instructions if (PurchaseOrderRet.Instructions != null) { string Instructions2818 = (string)PurchaseOrderRet.Instructions.GetValue(); } //Get value of ItemsCount if (PurchaseOrderRet.ItemsCount != null) { int ItemsCount2819 = (int)PurchaseOrderRet.ItemsCount.GetValue(); } //Get value of PurchaseOrderNumber if (PurchaseOrderRet.PurchaseOrderNumber != null) { string PurchaseOrderNumber2820 = (string)PurchaseOrderRet.PurchaseOrderNumber.GetValue(); } //Get value of PurchaseOrderStatusDesc if (PurchaseOrderRet.PurchaseOrderStatusDesc != null) { string PurchaseOrderStatusDesc2821 = (string)PurchaseOrderRet.PurchaseOrderStatusDesc.GetValue(); } //Get value of QtyDue if (PurchaseOrderRet.QtyDue != null) { int QtyDue2822 = (int)PurchaseOrderRet.QtyDue.GetValue(); } //Get value of QtyOrdered if (PurchaseOrderRet.QtyOrdered != null) { int QtyOrdered2823 = (int)PurchaseOrderRet.QtyOrdered.GetValue(); } //Get value of QtyReceived if (PurchaseOrderRet.QtyReceived != null) { int QtyReceived2824 = (int)PurchaseOrderRet.QtyReceived.GetValue(); } //Get value of SalesOrderNumber if (PurchaseOrderRet.SalesOrderNumber != null) { string SalesOrderNumber2825 = (string)PurchaseOrderRet.SalesOrderNumber.GetValue(); } //Get value of ShipToStoreNumber if (PurchaseOrderRet.ShipToStoreNumber != null) { int ShipToStoreNumber2826 = (int)PurchaseOrderRet.ShipToStoreNumber.GetValue(); } //Get value of StartShipDate if (PurchaseOrderRet.StartShipDate != null) { DateTime StartShipDate2827 = (DateTime)PurchaseOrderRet.StartShipDate.GetValue(); } //Get value of StoreExchangeStatus if (PurchaseOrderRet.StoreExchangeStatus != null) { ENStoreExchangeStatus StoreExchangeStatus2828 = (ENStoreExchangeStatus)PurchaseOrderRet.StoreExchangeStatus.GetValue(); } //Get value of StoreNumber if (PurchaseOrderRet.StoreNumber != null) { int StoreNumber2829 = (int)PurchaseOrderRet.StoreNumber.GetValue(); } //Get value of Subtotal if (PurchaseOrderRet.Subtotal != null) { double Subtotal2830 = (double)PurchaseOrderRet.Subtotal.GetValue(); } //Get value of Terms if (PurchaseOrderRet.Terms != null) { string Terms2831 = (string)PurchaseOrderRet.Terms.GetValue(); } //Get value of TermsDiscount if (PurchaseOrderRet.TermsDiscount != null) { float TermsDiscount2832 = (float)PurchaseOrderRet.TermsDiscount.GetValue(); } //Get value of TermsDiscountDays if (PurchaseOrderRet.TermsDiscountDays != null) { int TermsDiscountDays2833 = (int)PurchaseOrderRet.TermsDiscountDays.GetValue(); } //Get value of TermsNetDays if (PurchaseOrderRet.TermsNetDays != null) { int TermsNetDays2834 = (int)PurchaseOrderRet.TermsNetDays.GetValue(); } //Get value of Total if (PurchaseOrderRet.Total != null) { double Total2835 = (double)PurchaseOrderRet.Total.GetValue(); } //Get value of TxnDate if (PurchaseOrderRet.TxnDate != null) { DateTime TxnDate2836 = (DateTime)PurchaseOrderRet.TxnDate.GetValue(); } //Get value of UnfilledPercent if (PurchaseOrderRet.UnfilledPercent != null) { float UnfilledPercent2837 = (float)PurchaseOrderRet.UnfilledPercent.GetValue(); } //Get value of VendorCode if (PurchaseOrderRet.VendorCode != null) { string VendorCode2838 = (string)PurchaseOrderRet.VendorCode.GetValue(); } //Get value of VendorListID if (PurchaseOrderRet.VendorListID != null) { string VendorListID2839 = (string)PurchaseOrderRet.VendorListID.GetValue(); } if (PurchaseOrderRet.PurchaseOrderItemRetList != null) { for (int i2840 = 0; i2840 < PurchaseOrderRet.PurchaseOrderItemRetList.Count; i2840++) { IPurchaseOrderItemRet PurchaseOrderItemRet = PurchaseOrderRet.PurchaseOrderItemRetList.GetAt(i2840); //Get value of ListID if (PurchaseOrderItemRet.ListID != null) { string ListID2841 = (string)PurchaseOrderItemRet.ListID.GetValue(); } //Get value of TxnLineID if (PurchaseOrderItemRet.TxnLineID != null) { int TxnLineID2842 = (int)PurchaseOrderItemRet.TxnLineID.GetValue(); } //Get value of ALU if (PurchaseOrderItemRet.ALU != null) { string ALU2843 = (string)PurchaseOrderItemRet.ALU.GetValue(); } //Get value of Attribute if (PurchaseOrderItemRet.Attribute != null) { string Attribute2844 = (string)PurchaseOrderItemRet.Attribute.GetValue(); } //Get value of Cost if (PurchaseOrderItemRet.Cost != null) { double Cost2845 = (double)PurchaseOrderItemRet.Cost.GetValue(); } //Get value of Desc1 if (PurchaseOrderItemRet.Desc1 != null) { string Desc12846 = (string)PurchaseOrderItemRet.Desc1.GetValue(); } //Get value of Desc2 if (PurchaseOrderItemRet.Desc2 != null) { string Desc22847 = (string)PurchaseOrderItemRet.Desc2.GetValue(); } //Get value of ExtendedCost if (PurchaseOrderItemRet.ExtendedCost != null) { double ExtendedCost2848 = (double)PurchaseOrderItemRet.ExtendedCost.GetValue(); } //Get value of ItemNumber if (PurchaseOrderItemRet.ItemNumber != null) { int ItemNumber2849 = (int)PurchaseOrderItemRet.ItemNumber.GetValue(); } //Get value of NumberOfBaseUnits if (PurchaseOrderItemRet.NumberOfBaseUnits != null) { int NumberOfBaseUnits2850 = (int)PurchaseOrderItemRet.NumberOfBaseUnits.GetValue(); } //Get value of Qty if (PurchaseOrderItemRet.Qty != null) { int Qty2851 = (int)PurchaseOrderItemRet.Qty.GetValue(); } //Get value of QtyReceived if (PurchaseOrderItemRet.QtyReceived != null) { int QtyReceived2852 = (int)PurchaseOrderItemRet.QtyReceived.GetValue(); } //Get value of Size if (PurchaseOrderItemRet.Size != null) { string Size2853 = (string)PurchaseOrderItemRet.Size.GetValue(); } //Get value of UnitOfMeasure if (PurchaseOrderItemRet.UnitOfMeasure != null) { string UnitOfMeasure2854 = (string)PurchaseOrderItemRet.UnitOfMeasure.GetValue(); } //Get value of UPC if (PurchaseOrderItemRet.UPC != null) { string UPC2855 = (string)PurchaseOrderItemRet.UPC.GetValue(); } } } if (PurchaseOrderRet.DataExtRetList != null) { for (int i2856 = 0; i2856 < PurchaseOrderRet.DataExtRetList.Count; i2856++) { IDataExtRet DataExtRet = PurchaseOrderRet.DataExtRetList.GetAt(i2856); //Get value of OwnerID string OwnerID2857 = (string)DataExtRet.OwnerID.GetValue(); //Get value of DataExtName string DataExtName2858 = (string)DataExtRet.DataExtName.GetValue(); //Get value of DataExtType ENDataExtType DataExtType2859 = (ENDataExtType)DataExtRet.DataExtType.GetValue(); //Get value of DataExtValue string DataExtValue2860 = (string)DataExtRet.DataExtValue.GetValue(); } } } } } |