Adds a new time entry similar to what you can do in the QBPOS UI by using the New Employee Time Entry form. The time entries added through the SDK can be modified and queried. However, the QBPOS time clock reports and the weekly time sheet are not currently accessible through the SDK, although those reports do reflect time entry Adds and Mods performed via the SDK. Also, no time entries, whether created via the QBPOS SDK or via the QBPOS UI, can be sent to QuickBooks Financial Software (QBFS): there is no way, currently, for QBPOS time entries to be automatically reflected in QuickBooks. You should be aware that the QBPOS administrator can turn off the time clock feature in the QBPOS company preferences (this feature is turned on by default), in which case the various time clock and time entry UI forms may not be visible to your user. However, the SDK can Add, Modify, or Query time entries, whether time clock features are turned on in company preferences or not.
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 | <?xml version="1.0" encoding="utf-8"?> <?qbposxml version="4.0"?> <QBPOSXML> <QBPOSXMLMsgsRq onError="stopOnError"> <TimeEntryAddRq> <TimeEntryAdd defMacro="MACROTYPE"> <!-- required --> <ClockInTime >DATETIMETYPE</ClockInTime> <!-- optional --> <ClockOutTime >DATETIMETYPE</ClockOutTime> <!-- optional --> <CreatedBy >STRTYPE</CreatedBy> <!-- optional --> <!-- QuickBooksFlag may have one of the following values: NotPosted, Completed, Error, UnbilledPurchases --> <QuickBooksFlag >ENUMTYPE</QuickBooksFlag> <!-- optional --> <EmployeeListID useMacro="MACROTYPE">IDTYPE</EmployeeListID> <!-- optional --> <StoreNumber >INTTYPE</StoreNumber> <!-- optional --> </TimeEntryAdd> <IncludeRetElement >STRTYPE</IncludeRetElement> <!-- optional, may repeat --> </TimeEntryAddRq> <TimeEntryAddRs statusCode="INTTYPE" statusSeverity="STRTYPE" statusMessage="STRTYPE"> <TimeEntryRet> <!-- optional --> <ListID >IDTYPE</ListID> <!-- optional --> <ClockInTime >DATETIMETYPE</ClockInTime> <!-- optional --> <ClockOutTime >DATETIMETYPE</ClockOutTime> <!-- optional --> <CreatedBy >STRTYPE</CreatedBy> <!-- optional --> <EmployeeListID >IDTYPE</EmployeeListID> <!-- optional --> <EmployeeLoginName >STRTYPE</EmployeeLoginName> <!-- optional --> <FirstName >STRTYPE</FirstName> <!-- optional --> <LastName >STRTYPE</LastName> <!-- optional --> <StoreNumber >INTTYPE</StoreNumber> <!-- optional --> <!-- QuickBooksFlag may have one of the following values: NotPosted, Completed, Error, UnbilledPurchases --> <QuickBooksFlag >ENUMTYPE</QuickBooksFlag> <!-- optional --> <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> </TimeEntryRet> </TimeEntryAddRs> </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 | '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 SampleTimeEntryAdd
Public Sub DoTimeEntryAdd()
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
BuildTimeEntryAddRq(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
WalkTimeEntryAddRs(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 BuildTimeEntryAddRq(requestMsgSet as IMsgSetRequest)
Dim TimeEntryAddRq as ITimeEntryAdd
TimeEntryAddRq= requestMsgSet.AppendTimeEntryAddRq()
'Set field value for ClockInTime
TimeEntryAddRq.ClockInTime.SetValue(DateTime.Parse("12/15/2007 12:15:12"),false)
'Set field value for ClockOutTime
TimeEntryAddRq.ClockOutTime.SetValue(DateTime.Parse("12/15/2007 12:15:12"),false)
'Set field value for CreatedBy
TimeEntryAddRq.CreatedBy.SetValue("ab")
'Set field value for QuickBooksFlag
TimeEntryAddRq.QuickBooksFlag.SetValue(ENQuickBooksFlag.qbfNotPosted)
'Set field value for EmployeeListID
TimeEntryAddRq.EmployeeListID.SetValue("200000-1011023419")
'Set attributes
'Set field value for EmployeeListID to use Macro
TimeEntryAddRq.EmployeeListID.SetValueUseMacro("200000-1011023419")
'Set field value for StoreNumber
TimeEntryAddRq.StoreNumber.SetValue(6)
'Set field value for IncludeRetElementList
'May create more than one of these if needed
TimeEntryAddRq.IncludeRetElementList.Add("ab")
End Sub
Public Sub WalkTimeEntryAddRs( 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.rtTimeEntryAddRs) then
'upcast to more specific type here, this is safe because we checked with response.Type check above
Dim TimeEntryRet as ITimeEntryRet
TimeEntryRet = CType(response.Detail,ITimeEntryRet)
WalkTimeEntryRet(TimeEntryRet)
End If
End If
End If
Next j
End Sub
Public Sub WalkTimeEntryRet(TimeEntryRet as ITimeEntryRet)
if (TimeEntryRet is nothing) then
Exit Sub
End If
'Go through all the elements of ITimeEntryRet
'Get value of ListID
if ( not TimeEntryRet.ListID is nothing) then
Dim ListID4237 as String
ListID4237 = TimeEntryRet.ListID.GetValue()
End If
'Get value of ClockInTime
if ( not TimeEntryRet.ClockInTime is nothing) then
Dim ClockInTime4238 as DateTime
ClockInTime4238 = TimeEntryRet.ClockInTime.GetValue()
End If
'Get value of ClockOutTime
if ( not TimeEntryRet.ClockOutTime is nothing) then
Dim ClockOutTime4239 as DateTime
ClockOutTime4239 = TimeEntryRet.ClockOutTime.GetValue()
End If
'Get value of CreatedBy
if ( not TimeEntryRet.CreatedBy is nothing) then
Dim CreatedBy4240 as String
CreatedBy4240 = TimeEntryRet.CreatedBy.GetValue()
End If
'Get value of EmployeeListID
if ( not TimeEntryRet.EmployeeListID is nothing) then
Dim EmployeeListID4241 as String
EmployeeListID4241 = TimeEntryRet.EmployeeListID.GetValue()
End If
'Get value of EmployeeLoginName
if ( not TimeEntryRet.EmployeeLoginName is nothing) then
Dim EmployeeLoginName4242 as String
EmployeeLoginName4242 = TimeEntryRet.EmployeeLoginName.GetValue()
End If
'Get value of FirstName
if ( not TimeEntryRet.FirstName is nothing) then
Dim FirstName4243 as String
FirstName4243 = TimeEntryRet.FirstName.GetValue()
End If
'Get value of LastName
if ( not TimeEntryRet.LastName is nothing) then
Dim LastName4244 as String
LastName4244 = TimeEntryRet.LastName.GetValue()
End If
'Get value of StoreNumber
if ( not TimeEntryRet.StoreNumber is nothing) then
Dim StoreNumber4245 as Integer
StoreNumber4245 = TimeEntryRet.StoreNumber.GetValue()
End If
'Get value of QuickBooksFlag
if ( not TimeEntryRet.QuickBooksFlag is nothing) then
Dim QuickBooksFlag4246 as ENQuickBooksFlag
QuickBooksFlag4246 = TimeEntryRet.QuickBooksFlag.GetValue()
End If
if (not TimeEntryRet.DataExtRetList is nothing)
Dim i4247 as Integer
for i4247 = 0 to TimeEntryRet.DataExtRetList.Count - 1
Dim DataExtRet as IDataExtRet
DataExtRet = TimeEntryRet.DataExtRetList.GetAt(i4247)
'Get value of OwnerID
Dim OwnerID4248 as String
OwnerID4248 = DataExtRet.OwnerID.GetValue()
'Get value of DataExtName
Dim DataExtName4249 as String
DataExtName4249 = DataExtRet.DataExtName.GetValue()
'Get value of DataExtType
Dim DataExtType4250 as ENDataExtType
DataExtType4250 = DataExtRet.DataExtType.GetValue()
'Get value of DataExtValue
Dim DataExtValue4251 as String
DataExtValue4251 = DataExtRet.DataExtValue.GetValue()
Next i4247
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 | //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 SampleTimeEntryAdd { public void DoTimeEntryAdd() { 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; BuildTimeEntryAddRq(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; WalkTimeEntryAddRs(responseMsgSet); } catch (Exception e) { MessageBox.Show(e.Message, "Error"); if (sessionBegun) { sessionManager.EndSession(); } if (connectionOpen) { sessionManager.CloseConnection(); } } } void BuildTimeEntryAddRq(IMsgSetRequest requestMsgSet) { ITimeEntryAdd TimeEntryAddRq= requestMsgSet.AppendTimeEntryAddRq(); //Set attributes //Set field value for defMacro TimeEntryAddRq.defMacro.SetValue("IQBStringType"); //Set field value for ClockInTime TimeEntryAddRq.ClockInTime.SetValue(DateTime.Parse("12/15/2007 12:15:12"),false); //Set field value for ClockOutTime TimeEntryAddRq.ClockOutTime.SetValue(DateTime.Parse("12/15/2007 12:15:12"),false); //Set field value for CreatedBy TimeEntryAddRq.CreatedBy.SetValue("ab"); //Set field value for QuickBooksFlag TimeEntryAddRq.QuickBooksFlag.SetValue(ENQuickBooksFlag.qbfNotPosted); //Set field value for EmployeeListID TimeEntryAddRq.EmployeeListID.SetValue("200000-1011023419"); //Set attributes //Set field value for EmployeeListID to use Macro TimeEntryAddRq.EmployeeListID.SetValueUseMacro("200000-1011023419"); //Set field value for StoreNumber TimeEntryAddRq.StoreNumber.SetValue(6); //Set field value for IncludeRetElementList //May create more than one of these if needed TimeEntryAddRq.IncludeRetElementList.Add("ab"); } void WalkTimeEntryAddRs(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.rtTimeEntryAddRs) { //upcast to more specific type here, this is safe because we checked with response.Type check above ITimeEntryRet TimeEntryRet = (ITimeEntryRet)response.Detail; WalkTimeEntryRet(TimeEntryRet); } } } } } void WalkTimeEntryRet(ITimeEntryRet TimeEntryRet) { if (TimeEntryRet == null) return; //Go through all the elements of ITimeEntryRet //Get value of ListID if (TimeEntryRet.ListID != null) { string ListID4252 = (string)TimeEntryRet.ListID.GetValue(); } //Get value of ClockInTime if (TimeEntryRet.ClockInTime != null) { DateTime ClockInTime4253 = (DateTime)TimeEntryRet.ClockInTime.GetValue(); } //Get value of ClockOutTime if (TimeEntryRet.ClockOutTime != null) { DateTime ClockOutTime4254 = (DateTime)TimeEntryRet.ClockOutTime.GetValue(); } //Get value of CreatedBy if (TimeEntryRet.CreatedBy != null) { string CreatedBy4255 = (string)TimeEntryRet.CreatedBy.GetValue(); } //Get value of EmployeeListID if (TimeEntryRet.EmployeeListID != null) { string EmployeeListID4256 = (string)TimeEntryRet.EmployeeListID.GetValue(); } //Get value of EmployeeLoginName if (TimeEntryRet.EmployeeLoginName != null) { string EmployeeLoginName4257 = (string)TimeEntryRet.EmployeeLoginName.GetValue(); } //Get value of FirstName if (TimeEntryRet.FirstName != null) { string FirstName4258 = (string)TimeEntryRet.FirstName.GetValue(); } //Get value of LastName if (TimeEntryRet.LastName != null) { string LastName4259 = (string)TimeEntryRet.LastName.GetValue(); } //Get value of StoreNumber if (TimeEntryRet.StoreNumber != null) { int StoreNumber4260 = (int)TimeEntryRet.StoreNumber.GetValue(); } //Get value of QuickBooksFlag if (TimeEntryRet.QuickBooksFlag != null) { ENQuickBooksFlag QuickBooksFlag4261 = (ENQuickBooksFlag)TimeEntryRet.QuickBooksFlag.GetValue(); } if (TimeEntryRet.DataExtRetList != null) { for (int i4262 = 0; i4262 < TimeEntryRet.DataExtRetList.Count; i4262++) { IDataExtRet DataExtRet = TimeEntryRet.DataExtRetList.GetAt(i4262); //Get value of OwnerID string OwnerID4263 = (string)DataExtRet.OwnerID.GetValue(); //Get value of DataExtName string DataExtName4264 = (string)DataExtRet.DataExtName.GetValue(); //Get value of DataExtType ENDataExtType DataExtType4265 = (ENDataExtType)DataExtRet.DataExtType.GetValue(); //Get value of DataExtValue string DataExtValue4266 = (string)DataExtRet.DataExtValue.GetValue(); } } } } } |