|
Create Credit Card Charge |
Top Previous Next |
|
[Visual Basic] The following example demonstrates how to create and save a new Credit Card Charge document. (This example uses the CreditCardWebService.)
' ---------------------------------------- ' Step 1: Create an instance of the web service. ' ---------------------------------------- Dim creditCardChargeWs As New WebServices.CreditCardWebService("http://localhost/objacctwebservices/")
' ---------------------------------------- ' Step 2: Set the LoginKey. (Use Login.GetLoginKey to ' login to a specific company and generate a LoginKey.) ' For this example, the LoginKey is being stored in a ' public variable called PublicLoginKey. ' ---------------------------------------- StdLib.PopulateObjAcctSoapHeader(creditCardChargeWs, PublicLoginKey)
' ---------------------------------------- ' Step 3: Create and populate a DataSet with the new document. ' For this example, we're creating a new Credit Card Charge document, ' so we will use the ObjAcct.WebServices.DataSets.CreditCardDataSet. ' ---------------------------------------- Dim creditCardChargeDs As DataSet = New WebServices.DataSets.CreditCardDataSet()
' ------------------- ' Document Header. ' ------------------- Dim headerDr As DataRow = creditCardChargeDs.Tables("Header").NewRow
headerDr("RowID") = "" headerDr("AccountRowID") = "892.0" headerDr("ClassRowID") = "7.0" headerDr("Description") = "On-Site Development" headerDr("DocDate") = Today.ToShortDateString headerDr("DocID") = "CC5000" headerDr("DocAmount") = 1225 headerDr("EnteredDate") = Today.ToShortDateString headerDr("EntityRowID") = "5.0" headerDr("EntityType") = "Vendor" headerDr("JournalDocTypeRowID") = StdLib.DOCUMENT_Type_CREDITCARD_CHARGE
' Add the row to the Header table. creditCardChargeDs.Tables("Header").Rows.Add(headerDr)
' ------------------- ' Transaction. ' ------------------- Dim transDr As DataRow
transDr = creditCardChargeDs.Tables("Transaction").NewRow
transDr("RowID") = "" transDr("AccountRowID") = "27.0" transDr("ClassRowID") = "20.0" transDr("Description") = "Travel" transDr("DisplayOrder") = 1 transDr("TransactionAmount") = 1125
' Add the row to the Transaction table. creditCardChargeDs.Tables("Transaction").Rows.Add(transDr)
transDr = creditCardChargeDs.Tables("Transaction").NewRow
transDr("RowID") = "" transDr("AccountRowID") = "541.0" transDr("ClassRowID") = "20.0" transDr("Description") = "Food and Beverage" transDr("DisplayOrder") = 2 transDr("TransactionAmount") = 100
' Add the row to the Transaction table. creditCardChargeDs.Tables("Transaction").Rows.Add(transDr)
' ---------------------------------------- ' Step 4: Save the document. ' ---------------------------------------- Dim returnDs As DataSet = creditCardChargeWs.SaveDocument(creditCardChargeDs)
' Check for errors. If StdLib.GetErrorNumber(returnDs) < 0 Then MsgBox(StdLib.GetErrorAsString(returnDs)) End If |