Used to create and modify tax rates for the specified (and existing) tax code and tax category. A tax record is mainly an SDK concept/device rather than one you see in the UI. A tax record contains all the tax rate data for a specific tax category/tax code pair, and can contain a maximum of three tax rates per tax code. You can query for all of the tax records in the company using the Company query; however, no filters are provided, and the tax records have no name or list IDs.
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 | <?xml version="1.0" encoding="utf-8"?> <?qbposxml version="4.0"?> <QBPOSXML> <QBPOSXMLMsgsRq onError="stopOnError"> <TaxRecordModRq> <TaxRecordMod> <!-- required --> <TaxRecord> <!-- required --> <TaxCategoryListID >IDTYPE</TaxCategoryListID> <!-- required --> <TaxCategory >STRTYPE</TaxCategory> <!-- optional --> <POSTaxCodeListID >IDTYPE</POSTaxCodeListID> <!-- required --> <POSTaxCode >STRTYPE</POSTaxCode> <!-- optional --> <TaxPercent >PERCENTTYPE</TaxPercent> <!-- optional --> <TaxRate> <!-- must occur 0 - 3 times --> <TaxPercent >PERCENTTYPE</TaxPercent> <!-- optional --> <TaxRateName >STRTYPE</TaxRateName> <!-- optional --> <TaxAgency >STRTYPE</TaxAgency> <!-- optional --> <TaxLowRange >AMTTYPE</TaxLowRange> <!-- optional --> <TaxHighRange >AMTTYPE</TaxHighRange> <!-- optional --> <IsTaxAppliedOnlyWithinRange >BOOLTYPE</IsTaxAppliedOnlyWithinRange> <!-- optional --> <QBTaxGroup >STRTYPE</QBTaxGroup> <!-- optional --> </TaxRate> <QBTaxGroup >STRTYPE</QBTaxGroup> <!-- optional --> <QBTaxCode >STRTYPE</QBTaxCode> <!-- optional --> </TaxRecord> </TaxRecordMod> </TaxRecordModRq> <TaxRecordModRs statusCode="INTTYPE" statusSeverity="STRTYPE" statusMessage="STRTYPE"> <TaxRecordRet> <!-- optional --> <TaxRecord> <!-- required --> <TaxCategoryListID >IDTYPE</TaxCategoryListID> <!-- required --> <TaxCategory >STRTYPE</TaxCategory> <!-- optional --> <POSTaxCodeListID >IDTYPE</POSTaxCodeListID> <!-- required --> <POSTaxCode >STRTYPE</POSTaxCode> <!-- optional --> <TaxPercent >PERCENTTYPE</TaxPercent> <!-- optional --> <TaxRate> <!-- must occur 0 - 3 times --> <TaxPercent >PERCENTTYPE</TaxPercent> <!-- optional --> <TaxRateName >STRTYPE</TaxRateName> <!-- optional --> <TaxAgency >STRTYPE</TaxAgency> <!-- optional --> <TaxLowRange >AMTTYPE</TaxLowRange> <!-- optional --> <TaxHighRange >AMTTYPE</TaxHighRange> <!-- optional --> <IsTaxAppliedOnlyWithinRange >BOOLTYPE</IsTaxAppliedOnlyWithinRange> <!-- optional --> <QBTaxGroup >STRTYPE</QBTaxGroup> <!-- optional --> </TaxRate> <QBTaxGroup >STRTYPE</QBTaxGroup> <!-- optional --> <QBTaxCode >STRTYPE</QBTaxCode> <!-- optional --> </TaxRecord> </TaxRecordRet> </TaxRecordModRs> </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 | '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 SampleTaxRecordMod
Public Sub DoTaxRecordMod()
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
BuildTaxRecordModRq(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
WalkTaxRecordModRs(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 BuildTaxRecordModRq(requestMsgSet as IMsgSetRequest)
Dim TaxRecordModRq as ITaxRecordMod
TaxRecordModRq= requestMsgSet.AppendTaxRecordModRq()
'Set field value for TaxCategoryListID
TaxRecordModRq.TaxRecord.TaxCategoryListID.SetValue("200000-1011023419")
'Set field value for TaxCategory
TaxRecordModRq.TaxRecord.TaxCategory.SetValue("ab")
'Set field value for POSTaxCodeListID
TaxRecordModRq.TaxRecord.POSTaxCodeListID.SetValue("200000-1011023419")
'Set field value for POSTaxCode
TaxRecordModRq.TaxRecord.POSTaxCode.SetValue("ab")
'Set field value for TaxPercent
TaxRecordModRq.TaxRecord.TaxPercent.SetValue(20.00)
Dim TaxRate4205 as ITaxRate
TaxRate4205=TaxRecordModRq.TaxRecord.TaxRateList.Append()
'Set field value for TaxPercent
TaxRate4205.TaxPercent.SetValue(20.00)
'Set field value for TaxRateName
TaxRate4205.TaxRateName.SetValue("ab")
'Set field value for TaxAgency
TaxRate4205.TaxAgency.SetValue("ab")
'Set field value for TaxLowRange
TaxRate4205.TaxLowRange.SetValue(10.01)
'Set field value for TaxHighRange
TaxRate4205.TaxHighRange.SetValue(10.01)
'Set field value for IsTaxAppliedOnlyWithinRange
TaxRate4205.IsTaxAppliedOnlyWithinRange.SetValue(True)
'Set field value for QBTaxGroup
TaxRate4205.QBTaxGroup.SetValue("ab")
'Set field value for QBTaxGroup
TaxRecordModRq.TaxRecord.QBTaxGroup.SetValue("ab")
'Set field value for QBTaxCode
TaxRecordModRq.TaxRecord.QBTaxCode.SetValue("ab")
End Sub
Public Sub WalkTaxRecordModRs( 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.rtTaxRecordModRs) then
'upcast to more specific type here, this is safe because we checked with response.Type check above
Dim TaxRecordRet as ITaxRecordRet
TaxRecordRet = CType(response.Detail,ITaxRecordRet)
WalkTaxRecordRet(TaxRecordRet)
End If
End If
End If
Next j
End Sub
Public Sub WalkTaxRecordRet(TaxRecordRet as ITaxRecordRet)
if (TaxRecordRet is nothing) then
Exit Sub
End If
'Go through all the elements of ITaxRecordRet
'Get value of TaxCategoryListID
Dim TaxCategoryListID4206 as String
TaxCategoryListID4206 = TaxRecordRet.TaxRecord.TaxCategoryListID.GetValue()
'Get value of TaxCategory
if ( not TaxRecordRet.TaxRecord.TaxCategory is nothing) then
Dim TaxCategory4207 as String
TaxCategory4207 = TaxRecordRet.TaxRecord.TaxCategory.GetValue()
End If
'Get value of POSTaxCodeListID
Dim POSTaxCodeListID4208 as String
POSTaxCodeListID4208 = TaxRecordRet.TaxRecord.POSTaxCodeListID.GetValue()
'Get value of POSTaxCode
if ( not TaxRecordRet.TaxRecord.POSTaxCode is nothing) then
Dim POSTaxCode4209 as String
POSTaxCode4209 = TaxRecordRet.TaxRecord.POSTaxCode.GetValue()
End If
'Get value of TaxPercent
if ( not TaxRecordRet.TaxRecord.TaxPercent is nothing) then
Dim TaxPercent4210 as Double
TaxPercent4210 = TaxRecordRet.TaxRecord.TaxPercent.GetValue()
End If
if (not TaxRecordRet.TaxRecord.TaxRateList is nothing)
Dim i4211 as Integer
for i4211 = 0 to TaxRecordRet.TaxRecord.TaxRateList.Count - 1
Dim TaxRate as ITaxRate
TaxRate = TaxRecordRet.TaxRecord.TaxRateList.GetAt(i4211)
'Get value of TaxPercent
if ( not TaxRate.TaxPercent is nothing) then
Dim TaxPercent4212 as Double
TaxPercent4212 = TaxRate.TaxPercent.GetValue()
End If
'Get value of TaxRateName
if ( not TaxRate.TaxRateName is nothing) then
Dim TaxRateName4213 as String
TaxRateName4213 = TaxRate.TaxRateName.GetValue()
End If
'Get value of TaxAgency
if ( not TaxRate.TaxAgency is nothing) then
Dim TaxAgency4214 as String
TaxAgency4214 = TaxRate.TaxAgency.GetValue()
End If
'Get value of TaxLowRange
if ( not TaxRate.TaxLowRange is nothing) then
Dim TaxLowRange4215 as Double
TaxLowRange4215 = TaxRate.TaxLowRange.GetValue()
End If
'Get value of TaxHighRange
if ( not TaxRate.TaxHighRange is nothing) then
Dim TaxHighRange4216 as Double
TaxHighRange4216 = TaxRate.TaxHighRange.GetValue()
End If
'Get value of IsTaxAppliedOnlyWithinRange
if ( not TaxRate.IsTaxAppliedOnlyWithinRange is nothing) then
Dim IsTaxAppliedOnlyWithinRange4217 as Boolean
IsTaxAppliedOnlyWithinRange4217 = TaxRate.IsTaxAppliedOnlyWithinRange.GetValue()
End If
'Get value of QBTaxGroup
if ( not TaxRate.QBTaxGroup is nothing) then
Dim QBTaxGroup4218 as String
QBTaxGroup4218 = TaxRate.QBTaxGroup.GetValue()
End If
Next i4211
End If
'Get value of QBTaxGroup
if ( not TaxRecordRet.TaxRecord.QBTaxGroup is nothing) then
Dim QBTaxGroup4219 as String
QBTaxGroup4219 = TaxRecordRet.TaxRecord.QBTaxGroup.GetValue()
End If
'Get value of QBTaxCode
if ( not TaxRecordRet.TaxRecord.QBTaxCode is nothing) then
Dim QBTaxCode4220 as String
QBTaxCode4220 = TaxRecordRet.TaxRecord.QBTaxCode.GetValue()
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 | //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 SampleTaxRecordMod { public void DoTaxRecordMod() { 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; BuildTaxRecordModRq(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; WalkTaxRecordModRs(responseMsgSet); } catch (Exception e) { MessageBox.Show(e.Message, "Error"); if (sessionBegun) { sessionManager.EndSession(); } if (connectionOpen) { sessionManager.CloseConnection(); } } } void BuildTaxRecordModRq(IMsgSetRequest requestMsgSet) { ITaxRecordMod TaxRecordModRq= requestMsgSet.AppendTaxRecordModRq(); //Set field value for TaxCategoryListID TaxRecordModRq.TaxRecord.TaxCategoryListID.SetValue("200000-1011023419"); //Set field value for TaxCategory TaxRecordModRq.TaxRecord.TaxCategory.SetValue("ab"); //Set field value for POSTaxCodeListID TaxRecordModRq.TaxRecord.POSTaxCodeListID.SetValue("200000-1011023419"); //Set field value for POSTaxCode TaxRecordModRq.TaxRecord.POSTaxCode.SetValue("ab"); //Set field value for TaxPercent TaxRecordModRq.TaxRecord.TaxPercent.SetValue(20.00); ITaxRate TaxRate4221=TaxRecordModRq.TaxRecord.TaxRateList.Append(); //Set field value for TaxPercent TaxRate4221.TaxPercent.SetValue(20.00); //Set field value for TaxRateName TaxRate4221.TaxRateName.SetValue("ab"); //Set field value for TaxAgency TaxRate4221.TaxAgency.SetValue("ab"); //Set field value for TaxLowRange TaxRate4221.TaxLowRange.SetValue(10.01); //Set field value for TaxHighRange TaxRate4221.TaxHighRange.SetValue(10.01); //Set field value for IsTaxAppliedOnlyWithinRange TaxRate4221.IsTaxAppliedOnlyWithinRange.SetValue(true); //Set field value for QBTaxGroup TaxRate4221.QBTaxGroup.SetValue("ab"); //Set field value for QBTaxGroup TaxRecordModRq.TaxRecord.QBTaxGroup.SetValue("ab"); //Set field value for QBTaxCode TaxRecordModRq.TaxRecord.QBTaxCode.SetValue("ab"); } void WalkTaxRecordModRs(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.rtTaxRecordModRs) { //upcast to more specific type here, this is safe because we checked with response.Type check above ITaxRecordRet TaxRecordRet = (ITaxRecordRet)response.Detail; WalkTaxRecordRet(TaxRecordRet); } } } } } void WalkTaxRecordRet(ITaxRecordRet TaxRecordRet) { if (TaxRecordRet == null) return; //Go through all the elements of ITaxRecordRet //Get value of TaxCategoryListID string TaxCategoryListID4222 = (string)TaxRecordRet.TaxRecord.TaxCategoryListID.GetValue(); //Get value of TaxCategory if (TaxRecordRet.TaxRecord.TaxCategory != null) { string TaxCategory4223 = (string)TaxRecordRet.TaxRecord.TaxCategory.GetValue(); } //Get value of POSTaxCodeListID string POSTaxCodeListID4224 = (string)TaxRecordRet.TaxRecord.POSTaxCodeListID.GetValue(); //Get value of POSTaxCode if (TaxRecordRet.TaxRecord.POSTaxCode != null) { string POSTaxCode4225 = (string)TaxRecordRet.TaxRecord.POSTaxCode.GetValue(); } //Get value of TaxPercent if (TaxRecordRet.TaxRecord.TaxPercent != null) { double TaxPercent4226 = (double)TaxRecordRet.TaxRecord.TaxPercent.GetValue(); } if (TaxRecordRet.TaxRecord.TaxRateList != null) { for (int i4227 = 0; i4227 < TaxRecordRet.TaxRecord.TaxRateList.Count; i4227++) { ITaxRate TaxRate = TaxRecordRet.TaxRecord.TaxRateList.GetAt(i4227); //Get value of TaxPercent if (TaxRate.TaxPercent != null) { double TaxPercent4228 = (double)TaxRate.TaxPercent.GetValue(); } //Get value of TaxRateName if (TaxRate.TaxRateName != null) { string TaxRateName4229 = (string)TaxRate.TaxRateName.GetValue(); } //Get value of TaxAgency if (TaxRate.TaxAgency != null) { string TaxAgency4230 = (string)TaxRate.TaxAgency.GetValue(); } //Get value of TaxLowRange if (TaxRate.TaxLowRange != null) { double TaxLowRange4231 = (double)TaxRate.TaxLowRange.GetValue(); } //Get value of TaxHighRange if (TaxRate.TaxHighRange != null) { double TaxHighRange4232 = (double)TaxRate.TaxHighRange.GetValue(); } //Get value of IsTaxAppliedOnlyWithinRange if (TaxRate.IsTaxAppliedOnlyWithinRange != null) { bool IsTaxAppliedOnlyWithinRange4233 = (bool)TaxRate.IsTaxAppliedOnlyWithinRange.GetValue(); } //Get value of QBTaxGroup if (TaxRate.QBTaxGroup != null) { string QBTaxGroup4234 = (string)TaxRate.QBTaxGroup.GetValue(); } } } //Get value of QBTaxGroup if (TaxRecordRet.TaxRecord.QBTaxGroup != null) { string QBTaxGroup4235 = (string)TaxRecordRet.TaxRecord.QBTaxGroup.GetValue(); } //Get value of QBTaxCode if (TaxRecordRet.TaxRecord.QBTaxCode != null) { string QBTaxCode4236 = (string)TaxRecordRet.TaxRecord.QBTaxCode.GetValue(); } } } } |