Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

RSM InTime provides a SOAP Web Service Interface that allows two-way flow of information to external systems. This enables automated and efficient transfer of data to and from your other systems reducing effort and duplication.  

...

updateTimesheet() method will create a new Timesheet or update an existing one if it exists in Draft status. The Timesheet will be saved with Draft status. The Timesheet object you supply to this method must contain all the necessary data which includes a valid Placement reference, the Period End date and one or more Shifts. Each Shift must reference a valid Rate from the Placement, the Time worker or a Decimal value and the Date on which it was worked. It will normally be necessary to retrieve the details of the Placement the Timesheet relates to in order to correctly complete all the required fields.

submitTimesheet() would then be called to submit the Timesheet for approval once it has all the necessary time (Shifts) added to it. 

rejectTimesheet() or approveTimesheet() are then used to process the approval.

revertTimesheet() can also be used to revert a Submitted or Approved status Timesheet if required. This has exactly the same result as reverting a Timesheet though the RSM InTime UI.

Single Sign On

getSingleSignOnToken() can be used to log in to RSM InTime using an existing RSM InTime User account. This method returns a token that you can then append to any valid RSM InTime URL and it will allow you to retrieve the page as if you were logged into the system directly. This means you can embed RSM InTime pages within another web site or retrieve other data.

An example SSO token would look like this:

QS5TbWl0aDoxNjk0NzY3NDI5NTM0Ojg0OThkMGY1ZTQzMzdlYzI0YjRiZjU3YzZhNDg4MDI4

So appending an SSO token for an Admin user to a URL for the summary of a Worker could look like this:

http://demo.in-time.co.uk/summary/worker?id=1&ticket=QS5TbWl0aDoxNjk0NzY3NDI5NTM0Ojg0OThkMGY1ZTQzMzdlYzI0YjRiZjU3YzZhNDg4MDI4

For the Summary screens only you can append "&embed=true" to the URL to hide the menu and footers. This does not apply to other InTime screens.

IMPORTANT: Note that once you have accessed InTime with an SSO token you are logged into InTime as that user and navigation and access rights are determined exactly as if you logged into InTime directly as that user.

Other methods

The interface also provides various other methods. Some examples:

getMissingTimesheetsForPlacement() identifies any periods within the specified range that do not contain an approved timesheet. The response will include a status that indicates if it is Missing, Draft or Submitted.

getAllPayElements() returns a list of all Pay Elements present in the system.

getURLForContractorsPayslip() retrieves the URL to viewing a workers Payslips. *InPay Linked systems only

Getting started

The RSM InTime Web Service uses the Simple Object Access Protocol (SOAP) interface as opposed to REST. This is a stricter protocol than REST which means you can only call the defined methods available and the return types will be in a fixed format. Normally you would start by building "stub" code against the WSDL file that defines the interface.

LATEST WSDL Version: https://your_system_url.com/services/IntimeServiceV3_8?wsdl

Java Example

This example was written using the WSDL file for version 3.2 of the web services on our demo system: 

https://demo.in-time.co.uk/services/IntimeServiceV3_2?wsdl

Various tools are available for building the stub code. wsdl2java in the axis 2 package works well for java development:

From the command line run:

/axis2-1.6.2/bin/wsdl2java.sh -or -uri "https://demo.in-time.co.uk/services/IntimeServiceV3_2?wsdl"

This will produce the following files:

/src/uk/co/in_time/IntimeServiceV3_2Stub.java

/src/uk/co/in_time/IntimeServiceV3_2CallbackHandler.java

/src/uk/co/in_time/IntimeServiceV3_2IntimeWebServiceException.java

Include and reference these files in your application and you will be able to make calls to the Web Services. Some examples are given below.

It is important to enclose your web service calls in try / catch blocks as Exceptions are used as the mechanism for feeding back any issues. For example if you attempt to create a placement without providing an External ID, an exception will be returned from the Web Service call with an appropriate message. 

Client Code - Pseudocode examples

RETRIEVING ENTITY DATA FROM A FRONTEND SYSTEM:

...

#Get placements and associated data from frontend system that you require in InTIME
#Consultant
def cons = getConsultantsByExternalID(consultantId);
if(cons>1)"Error"
def con = cons.first();
if(con==null)con = new Consutlant();
con*PopulateFields*
createOrUpdateConsutlant(con);
#Manager Client
def mclients = getClientsByExternalID(mclientId);
if(mclients>1)"Error"
def mclient = mclients.first();
if(mclient==null)mclient = new Client();
mclient*PopulateFields*
createOrUpdateClient(mclient);
#Manager
def mans = getManagersByExternalID(managerId);
if(mans>1)"Error"
def man = mans.first();
if(man==null)man = new Manager();
man.client = mclient
man*PopulateFields*
createOrUpdateManager(man);
#Provider
def provs = getProvidersByExternalID(providerId);
if(provs>1)"Error"
def prov = provs.first();
if(prov==null)prov = new Provider();
prov*PopulateFields*
createOrUpdateProvider(prov);
#Worker
def wkrs = getWorkersByExternalID(workerId);
if(wkrs>1)"Error"
def wkr = wkrs.first();
if(wkr==null)wkr = new Worker();
if(prov!=null)wkr.provider = prov
wkr*PopulateFields*
createOrUpdateWorker(wkr);
#Billing Client
def bclients = getClientsByExternalID(bclientId);
if(pclients>1)"Error"
def bclient = bclients.first();
if(bclient==null)bclient = new Client();
bclient*PopulateFields*
createOrUpdateClient(bclient);
#Placement
def plac = getPlacementByExternalID(placementId);
if(plac==null)plac = new Placement();
plac.consultant = con
plac.client = bclient
plac.manager = man
plac.worker = wkr
plac*PopulateFields*
createOrUpdatePlacement(plc);
RETRIEVING UPDATES FROM RSM InTime:

...

def entityList = getModifiedItemsWithRefCode(java.lang.String token, java.util.Calendar since)
for(entityList){
if(entity.getType()=="Worker")*Read full Worker and action as required*
if(entity.getType()=="Placement")*Read full Placement and action as required*
if(entity.getType()=="Timesheet")*Read full Timesheet and action as required*
if(entity.getType()=="ExpenseItem")*Read full Expense Item and action as required*
if(entity.getType()=="Client")*Read full  Client and action as required*
if(entity.getType()=="LtdCoProvider")*Read full Ltd Company Provider and action as required*
if(entity.getType()=="Consultant")*Read full Consultant and action as required*
if(entity.getType()=="Manager")*Read full Manager and action as required*
if(entity.getType()=="LtdCoUser")*Read full Ltd Company User and action as required*
if(entity.getType()=="Reckoning")*Read full Invoice, Credit Note or Advice Note and action as required*
if(entity.getType()=="ContractDocument")*Read full Contract Document and action as required*
if(entity.getType()=="PurchaseOrder")*Read full Purchase Order and action as required*
if(entity.getType()=="PaymentBatch")*Read full Payment Batch and action as required*
if(entity.getType()=="Project")*Read full Project and action as required (WS V2.9+)*
}
RETRIEVING INVOICE LINKS:

...

def entityList = getModifiedItemsWithRefCodeByType(java.lang.String token, java.util.Calendar since, java.lang.String "Reckoning")
for(entityList:entity){
    def entityRefCode = entity.getRefCode()
    def downloadlink = "https://<SERVER URL>/reckoning/collectInvoice?refCode="+entityRefCode
    Call(downloadlink)
}
RETRIEVING INVOICES TO EXPORT:

...

As of 3.12 there is a "hidden" parameter. This creates the timesheet but keeps it hidden from the UI so it can not be affected by UI processes. This can be used to create a timesheet that should only be invoiced via the web services for example. Hidden timesheets can be updated via this method while they are still in draft status but you must set the hidden parameter of the method call to true. You can unhide the timesheet by changing the "hidden" property of the timesheet to false. Hidden timesheets still have to be approved before they can be invoiced/exported - the forceApproveTimesheet can be used for this which bypasses the approval route. Hidden timesheets are automatically unhidden when first invoiced on either the Sales or Purchase side. 

submitTimesheet() would then be called to submit the Timesheet for approval once it has all the necessary time (Shifts) added to it. 

rejectTimesheet() or approveTimesheet() are then used to process the approval.

revertTimesheet() can also be used to revert a Submitted or Approved status Timesheet if required. This has exactly the same result as reverting a Timesheet though the RSM InTime UI.

Invoicing 

As of 3.12 you can generate invoices using the generateInvoices( ) method. This method requires a SearchCriteria parameter which is used to filter the items to be invoiced. This needs to be populated with appropriate criteria to select only the items you wish to invoice.

Warning: if no criteria are specified all invoiceable items in the system will be invoiced!
It is possible to specify a list of specific timesheet IDs or ExpenseItem IDs that you wish to invoice using SearchCriteria.timesheetIDs or SearchCriteria.expenseItemIDs.
You must specify the type of invoices you wish to generate from: ClientInvoice, SelfBillInvoice or AdviceNote.
You can not credit invoices using this method. However, invoicing net negative items will result in a Credit Note rather than an Invoice.

To invoice "Hidden" timesheets, set the SearchCriteria.includeHidden property to true.

Examples:


request.setInvoiceType("ClientInvoice");

searchCriteria.setIncludeTimesheets(true);
searchCriteria.setIncludeHidden(true);
long[] tsIds = new long[2];
tsIds[0] = 123L;
tsIds[1] = 456L;
searchCriteria.setTimesheetIDs(tsIds);

searchCriteria.setIncludeExpenses(false);
searchCriteria.setExpenseItemIDFrom(3001L);
searchCriteria.setExpenseItemIDTo(3009L);

request.setSearchCriteria(searchCriteria);

Calendar invDate = Calendar.getInstance();
invDate.set(2024,10,1,0,0,0);
request.setInvoiceDate(invDate);


As of 3.12 you can uploadSupplierInvoice() to an AdviceNote and accept it via acceptSupplierInvoice()

Single Sign On

getSingleSignOnToken() can be used to log in to RSM InTime using an existing RSM InTime User account. This method returns a token that you can then append to any valid RSM InTime URL and it will allow you to retrieve the page as if you were logged into the system directly. This means you can embed RSM InTime pages within another web site or retrieve other data.

An example SSO token would look like this:

QS5TbWl0aDoxNjk0NzY3NDI5NTM0Ojg0OThkMGY1ZTQzMzdlYzI0YjRiZjU3YzZhNDg4MDI4

So appending an SSO token for an Admin user to a URL for the summary of a Worker could look like this:

http://demo.in-time.co.uk/summary/worker?id=1&ticket=QS5TbWl0aDoxNjk0NzY3NDI5NTM0Ojg0OThkMGY1ZTQzMzdlYzI0YjRiZjU3YzZhNDg4MDI4

For the Summary screens only you can append "&embed=true" to the URL to hide the menu and footers. This does not apply to other InTime screens.

IMPORTANT: Note that once you have accessed InTime with an SSO token you are logged into InTime as that user and navigation and access rights are determined exactly as if you logged into InTime directly as that user.

Other methods

The interface also provides various other methods. Some examples:

getMissingTimesheetsForPlacement() identifies any periods within the specified range that do not contain an approved timesheet. The response will include a status that indicates if it is Missing, Draft or Submitted.

getAllPayElements() returns a list of all Pay Elements present in the system.

getURLForContractorsPayslip() retrieves the URL to viewing a workers Payslips. *InPay Linked systems only

Getting started

The RSM InTime Web Service uses the Simple Object Access Protocol (SOAP) interface as opposed to REST. This is a stricter protocol than REST which means you can only call the defined methods available and the return types will be in a fixed format. Normally you would start by building "stub" code against the WSDL file that defines the interface.

LATEST WSDL Version: https://your_system_url.com/services/IntimeServiceV3_8?wsdl

Java Example

This example was written using the WSDL file for version 3.2 of the web services on our demo system: 

https://demo.in-time.co.uk/services/IntimeServiceV3_2?wsdl

Various tools are available for building the stub code. wsdl2java in the axis 2 package works well for java development:

From the command line run:

/axis2-1.6.2/bin/wsdl2java.sh -or -uri "https://demo.in-time.co.uk/services/IntimeServiceV3_2?wsdl"

This will produce the following files:

/src/uk/co/in_time/IntimeServiceV3_2Stub.java

/src/uk/co/in_time/IntimeServiceV3_2CallbackHandler.java

/src/uk/co/in_time/IntimeServiceV3_2IntimeWebServiceException.java

Include and reference these files in your application and you will be able to make calls to the Web Services. Some examples are given below.

It is important to enclose your web service calls in try / catch blocks as Exceptions are used as the mechanism for feeding back any issues. For example if you attempt to create a placement without providing an External ID, an exception will be returned from the Web Service call with an appropriate message. 

Client Code - Pseudocode examples

RETRIEVING ENTITY DATA FROM A FRONTEND SYSTEM:
#Get placements and associated data from frontend system that you require in InTIME
#Consultant
def cons = getConsultantsByExternalID(consultantId);
if(cons>1)"Error"
def con = cons.first();
if(con==null)con = new Consutlant();
con*PopulateFields*
createOrUpdateConsutlant(con);
#Manager Client
def mclients = getClientsByExternalID(mclientId);
if(mclients>1)"Error"
def mclient = mclients.first();
if(mclient==null)mclient = new Client();
mclient*PopulateFields*
createOrUpdateClient(mclient);
#Manager
def mans = getManagersByExternalID(managerId);
if(mans>1)"Error"
def man = mans.first();
if(man==null)man = new Manager();
man.client = mclient
man*PopulateFields*
createOrUpdateManager(man);
#Provider
def provs = getProvidersByExternalID(providerId);
if(provs>1)"Error"
def prov = provs.first();
if(prov==null)prov = new Provider();
prov*PopulateFields*
createOrUpdateProvider(prov);
#Worker
def wkrs = getWorkersByExternalID(workerId);
if(wkrs>1)"Error"
def wkr = wkrs.first();
if(wkr==null)wkr = new Worker();
if(prov!=null)wkr.provider = prov
wkr*PopulateFields*
createOrUpdateWorker(wkr);
#Billing Client
def bclients = getClientsByExternalID(bclientId);
if(pclients>1)"Error"
def bclient = bclients.first();
if(bclient==null)bclient = new Client();
bclient*PopulateFields*
createOrUpdateClient(bclient);
#Placement
def plac = getPlacementByExternalID(placementId);
if(plac==null)plac = new Placement();
plac.consultant = con
plac.client = bclient
plac.manager = man
plac.worker = wkr
plac*PopulateFields*
createOrUpdatePlacement(plc);
RETRIEVING UPDATES FROM RSM InTime:
def entityList = getModifiedItemsWithRefCode(java.lang.String token, java.util.Calendar since
, java.lang.String "Reckoning"

Read a Placement

try {

IntimeServiceV3_2Stub.GetPlacementByExternalId request=new IntimeServiceV3_2Stub.GetPlacementByExternalId();

request.setId("WEB-PLC-001");

request.setToken(ticket);    //from authenticate call

GetPlacementByExternalIdResponse placementResponse=stub.getPlacementByExternalId(request);

Placement placement=placementResponse.get_return();

if (placement != null) {

System.out.println("Read Placement with External Id: " + placement.getExternalId() + " Internal Id: " + placement.getId());

System.out.println("RefCode: " + placement.getRefCode());

System.out.println("Worker:" + placement.getWorker().getExternalId() + " " + placement.getWorker().getLastname());

System.out.println("Consultant: " + placement.getConsultant().getExternalId() + " " + placement.getConsultant().getLastname());

System.out.println("Manager: " + placement.getManager().getExternalId() + " " + placement.getManager().getLastname());

System.out.println("Client: " + placement.getClient().getExternalId() + " " + placement.getClient().getName());

System.out.println("Start: " + placement.getStart().getTime());

if (placement.getEnd() != null) {

System.out.println("End: " + placement.getEnd().getTime());

}

System.out.println("Created: " + placement.getCreated().getTime());

System.out.println("Modified: " + placement.getModified().getTime());

System.out.println("TimesheetDateCalculatorName: " + placement.getTimesheetDateCalculatorName());

System.out.println("Timesheeet Approval Route: " + placement.getTimesheetApprovalRoute());

System.out.println("Chargeable Expense Approval Route: " + placement.getChargeableExpenseApprovalRoute());

System.out.println("Non-Chargeable Expense Approval Route: " + placement.getNonChargeableExpenseApprovalRoute());

System.out.println("ContractedHours: " + placement.getContractedHours());

System.out.println("JobDescription :" + placement.getJobDescription());

System.out.println("JobTitle: " + placement.getJobTitle());

System.out.println("NoCommunications: " + placement.getNoCommunications
)
for(entityList){
    def entityRefCode = entity.getRefCode()
    def invoiceInfo = getInvoiceByRefCode(java.lang.String token, java.lang.String entityRefCode)
    def invoicingAccount
    def accountCode
    def nominalCode //Note - Nominal codes aren't always stored on the invoicing entity it depends on the accounts system and nominal requirements
    def entityType = invoiceInfo.getEntityType()
    def entityRefCode = invoiceInfo.getEntityRefCode()
    if(entityType="Client"){
        invoicingAccount = getClientByRefCode(java.lang.String entityRefCode)
        accountCode = invoicingAccount.getAccountsRef()
        nominalCode = invoicingAccount.getNominalCode()
    {
    if(entityType="Worker"){
        invoicingAccount = getWorkerByRefCode(java.lang.String entityRefCode)
        accountCode = invoicingAccount.getAccountsReference()
        nominalCode = invoicingAccount.getNominalCode()
    }
    if(entityType="Provider"){
        invoicingAccount = getProviderByRefCode(java.lang.String entityRefCode)
        accountCode = invoicingAccount.getAccountsRef()
        nominalCode = invoicingAccount.getNominalCode()
    }
    //Get any other details from invocing entities requied above to create / update sales or purchase account in accounts package.
    if(!(invoiceInfo.getExported)){
        for(invoiceInfo.getInvoiceLineInfo():InvoiceLineInfo invoiceLineInfo){
            def invoiceLineInfoPlacementId = invoiceLineInfo.getPlacementId
            def invoiceLineInfoTimesheetId = invoiceLineInfo.getTimesheetId
            def placement = getPlacementById(java.lang.String token, java.lang.Long invoiceLineInfoPlacementId)
            def timesheet = getTimesheetById(java.lang.String token, java.lang.Long invoiceLineInfoTimesheetId)
            
            if(needRatePayElementCode){
                def invoiceInfoShiftId = invoiceinfo.getShiftId()
                def invoiceInfoTimesheetId = invoiceinfo.getTimesheetId()
                def timesheet = webservice.getTimesheetById(invoiceInfoTimesheetId)
                def shifts = timesheet.getShifts()
                def wantedShift
                for(shifts s where s.id=invoiceInfoShiftId) wantedShift = s
                if(wantedShift){
                    def rate = wantedShift.getRate()
                    def payElementCode = rate.getPayElementCode()
                }
            }
            //Collect details from InvoiceInfo, InvoiceLineInfo, Placement, Timesheet, Rate, Pay Element as required for transaction
        }
        def exportSuccessful = false;
        #Attempt to export details to Accounts System and if successfull exportSuccessful=true
        if(exportSuccessful)markInvoiceAsExported(java.lang.String token, java.lang.String invoiceInfo.getRefCode(), java.lang.String now())
    }
}
RETRIEVING TIMESHEETS:

...

def entityList = getModifiedItemsWithRefCodeByType(java.lang.String token, java.util.Calendar since, java.lang.String "Timesheet")
for(entity:entityList){
  def entityRefCode = entity.getRefCode()
  def timesheet = getTimesheetByRefCode(java.lang.String token, java.lang.String entityRefCode)
    for(shift:timesheet.getShifts(){
    def date = new Date(shift.getDay())
    def start = new Date(shift.getStartTime())
    def start = new Date(shift.getEndTime())
    def start = new Date(shift.getMealBreak())
    def hours = new Date(shift.getHours())
    def hoursDecimal = shift.getDecimal()
    def rateName = shift.getRateName()
    def ratePay = getRate().getPay()
    def rateCharge = getRate().getCharge()
    //PUT INFORMATION COLLECTED HERE WHERE YOU WANT TO PUT IT
  }
}
UPDATING FINANCIAL TAG VALUES:

...

def fiancialTags = ws.getAllFinancialTags
def requiredTg
for(fiancialTags:TagCategory tg){
  if(tg.name == "financialName")requiredTg = tg
}
def tagValues = requiredTg.getTagCategoryValues()
def requiredValue = "tagValue"
def matched = false
for(tagValues:TagCategoryValue tcv){
  if(tcv==requiredValue)matched=true
}
if(!matched){
  def tv = new TagCategoryValue()
  tv.setValue(requiredValue)
  tagValues.add(tv)
  requiredTg.setTagCategoryValues(tagValues)
  ws.createOrUpdateFinancialTag(requiredTg)
}

Java Code

Authenticate

try {

//Create an instance of the stub

IntimeServiceV3_2Stub stub = new IntimeServiceV3_2Stub("https://demo.in-time.co.uk/services/IntimeServiceV3_2?wsdl");

//Get an authentication token

IntimeServiceV3_2Stub.Authenticate auth=new IntimeServiceV3_2Stub.Authenticate();

auth.setAgencyRefCode("<supplied_credentials>");

auth.setUsername("<supplied_credentials>");

auth.setPassword("<supplied_credentials>");

IntimeServiceV3_2Stub.AuthenticateResponse authResp=stub.authenticate(auth);

String ticket=authResp.get_return();

System.out.println("Authentication token:" + ticket);

//Use this authentication token (ticket) to pass in to any of the other WebService calls

} catch (java.lang.Exception e) {

System.out.println("Exception occurred: " + e);

}

if(entity.getType()=="Worker")*Read full Worker and action as required*
if(entity.getType()=="Placement")*Read full Placement and action as required*
if(entity.getType()=="Timesheet")*Read full Timesheet and action as required*
if(entity.getType()=="ExpenseItem")*Read full Expense Item and action as required*
if(entity.getType()=="Client")*Read full  Client and action as required*
if(entity.getType()=="LtdCoProvider")*Read full Ltd Company Provider and action as required*
if(entity.getType()=="Consultant")*Read full Consultant and action as required*
if(entity.getType()=="Manager")*Read full Manager and action as required*
if(entity.getType()=="LtdCoUser")*Read full Ltd Company User and action as required*
if(entity.getType()=="Reckoning")*Read full Invoice, Credit Note or Advice Note and action as required*
if(entity.getType()=="ContractDocument")*Read full Contract Document and action as required*
if(entity.getType()=="PurchaseOrder")*Read full Purchase Order and action as required*
if(entity.getType()=="PaymentBatch")*Read full Payment Batch and action as required*
if(entity.getType()=="Project")*Read full Project and action as required (WS V2.9+)*
}
RETRIEVING INVOICE LINKS:
def entityList = getModifiedItemsWithRefCodeByType(java.lang.String token, java.util.Calendar since, java.lang.String "Reckoning")
for(entityList:entity){
    def entityRefCode = entity.getRefCode()
    def downloadlink = "https://<SERVER URL>/reckoning/collectInvoice?refCode="+entityRefCode
    Call(downloadlink)
}
RETRIEVING INVOICES TO EXPORT:
def needRatePayElementCode = false //Not usually needed but if required change to true
def entityList = getModifiedItemsWithRefCodeByType(java.lang.String token, java.util.Calendar since, java.lang.String "Reckoning")
for(entityList){
    def entityRefCode = entity.getRefCode()
    def invoiceInfo = getInvoiceByRefCode(java.lang.String token, java.lang.String entityRefCode)
    def invoicingAccount
    def accountCode
    def nominalCode //Note - Nominal codes aren't always stored on the invoicing entity it depends on the accounts system and nominal requirements
    def entityType = invoiceInfo.getEntityType()
    def entityRefCode = invoiceInfo.getEntityRefCode()
    if(entityType="Client"){
        invoicingAccount = getClientByRefCode(java.lang.String entityRefCode)
        accountCode = invoicingAccount.getAccountsRef()
        nominalCode = invoicingAccount.getNominalCode()
    {
    if(entityType="Worker"){
        invoicingAccount = getWorkerByRefCode(java.lang.String entityRefCode)
        accountCode = invoicingAccount.getAccountsReference()
        nominalCode = invoicingAccount.getNominalCode()
    }
    if(entityType="Provider"){
        invoicingAccount = getProviderByRefCode(java.lang.String entityRefCode)
        accountCode = invoicingAccount.getAccountsRef()
        nominalCode = invoicingAccount.getNominalCode()
    }
    //Get any other details from invocing entities requied above to create / update sales or purchase account in accounts package.
    if(!(invoiceInfo.getExported)){
        for(invoiceInfo.getInvoiceLineInfo():InvoiceLineInfo invoiceLineInfo){
            def invoiceLineInfoPlacementId = invoiceLineInfo.getPlacementId
            def invoiceLineInfoTimesheetId = invoiceLineInfo.getTimesheetId
            def invoiceLineInfoShiftId = invoiceLineInfo.getShiftId
            def invoiceLineInfoExpenseItemId = invoiceLineInfo.getExpenseId
            def invoiceLineInfoAdjustmentId = invoiceLineInfo.getAdjustmentId
            def placement = getPlacementById(java.lang.String token, java.lang.Long invoiceLineInfoPlacementId)
            def timesheet = getTimesheetById(java.lang.String token, java.lang.Long invoiceLineInfoTimesheetId)
            def expenseItem = getExpenseItemById(java.lang.String token, java.lang.Long invoiceLineInfoExpenseItemId)
            def adjustment = getAdjustmentById(java.lang.String token, java.lang.Long invoiceLineInfoAdjustmentId)

            if(needRatePayElementCode){
                def invoiceLineInfoShiftId = invoiceLineInfo.getShiftId
                def shifts = timesheet.getShifts()
                def wantedShift
                for(shifts s where s.id=invoiceLineInfoShiftId) wantedShift = s
                    if(wantedShift){
                    def rate = wantedShift.getRate()
                    def payElementCode = rate.getPayElementCode()
                }
            }
        //Collect details from InvoiceInfo, InvoiceLineInfo, Placement, Timesheet, ExpenseItem, Adjustment, Shift, Rate, Pay Element as required for transaction in Accounts System
        }
        def exportSuccessful = false;
        #Attempt to export details to Accounts System and if successfull exportSuccessful=true
        if(exportSuccessful)markInvoiceAsExported(java.lang.String token, java.lang.String invoiceInfo.getRefCode(), java.lang.String now())
    }
}

RETRIEVING TIMESHEETS:
def entityList = getModifiedItemsWithRefCodeByType(java.lang.String token, java.util.Calendar since, java.lang.String "Timesheet")
for(entity:entityList){
  def entityRefCode = entity.getRefCode()
  def timesheet = getTimesheetByRefCode(java.lang.String token, java.lang.String entityRefCode)
    for(shift:timesheet.getShifts(){
    def date = new Date(shift.getDay())
    def start = new Date(shift.getStartTime())
    def start = new Date(shift.getEndTime())
    def start = new Date(shift.getMealBreak())
    def hours = new Date(shift.getHours())
    def hoursDecimal = shift.getDecimal()
    def rateName = shift.getRateName()
    def ratePay = getRate().getPay()
    def rateCharge = getRate().getCharge()
    //PUT INFORMATION COLLECTED HERE WHERE YOU WANT TO PUT IT
  }
}
UPDATING FINANCIAL TAG VALUES:
def fiancialTags = ws.getAllFinancialTags
def requiredTg
for(fiancialTags:TagCategory tg){
  if(tg.name == "financialName")requiredTg = tg
}
def tagValues = requiredTg.getTagCategoryValues()
def requiredValue = "tagValue"
def matched = false
for(tagValues:TagCategoryValue tcv){
  if(tcv==requiredValue)matched=true
}
if(!matched){
  def tv = new TagCategoryValue()
  tv.setValue(requiredValue)
  tagValues.add(tv)
  requiredTg.setTagCategoryValues(tagValues)
  ws.createOrUpdateFinancialTag(requiredTg)
}
UPDATING ONCOSTS ON A PLACEMENT (example below is purchase oncosts but same for sales):
def plc = getPlacementByExternalId(token,xxxxx) – xxxx being unique placement Ref
def onCostConfig = new OnCost()
onCostConfig.description = “xxxx” //Must match existing OnCosts Config
def placementOnCost = new OnCostsInstance()
placementOnCost.onCost = onCostConfig
placementOnCost.amount = xxxx //As required
def exists = false
for(def currentOnCostInstance:placement.purchaseOnCosts){
if(currentOnCostInstance.onCost.description == “xxxx”)exists=true //Match description above
}
if(!exists) plc.purchaseOnCosts.add(placementOnCost)
createOrUpdatePlacement(plc)

Java Code

Authenticate

try {

//Create an instance of the stub

IntimeServiceV3_2Stub stub = new IntimeServiceV3_2Stub("https://demo.in-time.co.uk/services/IntimeServiceV3_2?wsdl");


//Get an authentication token

IntimeServiceV3_2Stub.Authenticate auth=new IntimeServiceV3_2Stub.Authenticate();

auth.setAgencyRefCode("<supplied_credentials>");

auth.setUsername("<supplied_credentials>");

auth.setPassword("<supplied_credentials>");

IntimeServiceV3_2Stub.AuthenticateResponse authResp=stub.authenticate(auth);

String ticket=authResp.get_return();

System.out.println("Authentication token:" + ticket);

//Use this authentication token (ticket) to pass in to any of the other WebService calls

} catch (java.lang.Exception e) {

System.out.println("Exception occurred: " + e);

}

Read a Placement

try {

IntimeServiceV3_2Stub.GetPlacementByExternalId request=new IntimeServiceV3_2Stub.GetPlacementByExternalId();

request.setId("WEB-PLC-001");

request.setToken(ticket);    //from authenticate call

GetPlacementByExternalIdResponse placementResponse=stub.getPlacementByExternalId(request);

Placement placement=placementResponse.get_return();

if (placement != null) {

System.out.println("Read Placement with External Id: " + placement.getExternalId() + " Internal Id: " + placement.getId());

System.out.println("PurchaseOrderNumRefCode: " + placement.getPurchaseOrderNumgetRefCode());

System.out.println("SalesProjectWorker:" + placement.getSalesProjectgetWorker());System.out.println("PurchaseBranch: .getExternalId() + " " + placement.getPurchaseBranchgetWorker().getLastname());

System.out.println("CurrencyForChargeConsultant: " + placement.getCurrencyForChargegetConsultant());System.out.println("CurrencyForPayExpenses: .getExternalId() + " " + placement.getCurrencyForPayExpensesgetConsultant().getLastname());

System.out.println("CurrencyForPayTimesheetsManager: " + placement.getCurrencyForPayTimesheetsgetManager().getExternalId() + " " + placement.getManager().getLastname());

System.out.println("PermClient: " + placement.getPermgetClient());System.out.println("TimesheetEmailApproval: .getExternalId() + " " + placement.getTimesheetEmailApprovalgetClient().getName());


System.out.println("Timesheet layoutStart: " + placement.getLayoutgetStart().getTime());

if (placement.getEnd() != null) {

System.out.println("

Internal Agency Comments

End: " + placement.getEnd().

getInternalAgencyComments

getTime());

}

System.out.println("Holiday Accural RateCreated: " + placement.getCreated().getHolidayAccuralRategetTime());

System.out.println("Expenses TemplateModified: " + placement.getExpenseTemplategetModified().getTime());

System.out.println("Charge Tax Code OverrideTimesheetDateCalculatorName: " + placement.getChargeTaxCodeOverridegetTimesheetDateCalculatorName());

System.out.println("Self Bill Tax Code OverrideTimesheeet Approval Route: " + placement.getSelfBillTaxCodeOverridegetTimesheetApprovalRoute());

System.out.println("PAYEDeductionsOnLtdChargeable Expense Approval Route: " + placement.getPAYEDeductionsOnLtdgetChargeableExpenseApprovalRoute());

if (placement.getInvoiceContactOverride() != null) {

Contact contact = placement.getInvoiceContactOverride();

Address address = contact.getAddress(

System.out.println("Non-Chargeable Expense Approval Route: " + placement.getNonChargeableExpenseApprovalRoute());

System.out.println("

Placement charge invoice contact override

ContractedHours: " + placement.getContractedHours());

System.out.println("

Firstname

JobDescription :" +

contact

placement.

getFirstname

getJobDescription());

System.out.println("

Lastname

JobTitle: " +

contact

placement.

getLastname

getJobTitle());

System.out.println("

Email

NoCommunications: " +

contact

placement.

getEmail

getNoCommunications());

System.out.println("

Phone

PurchaseOrderNum: " +

contact

placement.

getPhone

getPurchaseOrderNum());

System.out.println("

Fax

SalesProject: " +

contact

placement.

getFax

getSalesProject());

System.out.println("

Mobile

PurchaseBranch: " +

contact

placement.

getMobile

getPurchaseBranch());

System.out.println("

Address

CurrencyForCharge: " + placement.getCurrencyForCharge());

System.out.println("

Line 1

CurrencyForPayExpenses: " +

address

placement.

getLine1

getCurrencyForPayExpenses());

System.out.println("

Line 2

CurrencyForPayTimesheets: " +

address

placement.

getLine2

getCurrencyForPayTimesheets());

System.out.println("

Town

Perm: " +

address

placement.

getTown

getPerm());

System.out.println("

County

TimesheetEmailApproval: " +

address

placement.

getCounty

getTimesheetEmailApproval());

System.out.println("

Postcode

Timesheet layout: " +

address

placement.

getPostcode

getLayout());

System.out.println("

Country

Internal Agency Comments: " +

address

placement.

getCountry

getInternalAgencyComments());

System.out.println("

Country Code

Holiday Accural Rate: " +

address

placement.

getCountryCode

getHolidayAccuralRate());

}

if (placement.getRates() != null) {

for (Rate rate : placement.getRates()) {

System.out.println("

Rate Name

Expenses Template: " +

rate

placement.

getName

getExpenseTemplate());

System.out.println("

Pay

Charge Tax Code Override: " +

rate

placement.

getPay

getChargeTaxCodeOverride());

System.out.println("

Charge

Self Bill Tax Code Override: " +

rate

placement.

getCharge

getSelfBillTaxCodeOverride());

System.out.println("

Priority

PAYEDeductionsOnLtd: " +

rate

placement.

getPriorityOrder

getPAYEDeductionsOnLtd());

System.out.println("ID:" + rate.getId());

System.out.println("Period:" + rate.getPeriod()

if (placement.getInvoiceContactOverride() != null) {

Contact contact = placement.getInvoiceContactOverride();

Address address = contact.getAddress();

System.out.println("Placement charge invoice contact override: ");

System.out.println("

PeriodDuration

Firstname: " +

rate

contact.

getPeriodDuration

getFirstname());

System.out.println("

SelectableByWorkers

Lastname: " +

rate

contact.

getSelectableByWorkers

getLastname());

System.out.println("

TimePattern

Email: " +

rate

contact.

getTimePattern

getEmail());

System.out.println("

TimesheetFields

Phone: " +

rate

contact.

getTimesheetFields

getPhone());

System.out.println("

PayElementCode

Fax: " +

rate

contact.

getPayElementCode

getFax());

System.out.println("

Payable

Mobile: " +

rate

contact.

getPayable

getMobile());

System.out.println("

Chargeable

Address:"

+ rate.getChargeable()

);

System.out.println("

Taxable

Line 1:" +

rate

address.

getTaxable

getLine1());

System.out.println("

RefCode

Line 2:" +

rate

address.

getRefCode

getLine2());

}

}

if (placement.getSplitCommissions() != null) {

for (SplitCommission split : placement.getSplitCommissions()) {System.out.println(" Town:" + address.getTown());

System.out.println("

\nCommission UserID

County:" +

split

address.

getUserId

getCounty());

System.out.println(" Postcode: " +

" Percentage

address.getPostcode());

System.out.println(" Country:" +

split

address.

getWeight

getCountry());}

System.out.println(" Country Code:" + address.getCountryCode());

}

if (placement.getAlternativeManagersgetRates() != null) {

for (User altMan Rate rate : placement.getAlternativeManagersgetRates()) {

System.out.println("Alternative ManagerRate Name:" + altManrate.getFirstnamegetName() + " );

System.out.println("Pay:" + altManrate.getLastnamegetPay());

System.out.println("External IdCharge:" + altManrate.getExternalIdgetCharge() + " Internal ID));

System.out.println("Priority:" + altManrate.getIdgetPriorityOrder());

}

}

}

} catch (java.lang.Exception e) {

System.out.println("ID:" + rate.getId());

System.out.println("

Exception occurred

Period:" +

e);

}

Read a Timesheet including any invoices

try {

IntimeServiceV3_2Stub.GetTimesheetById request=new IntimeServiceV3_2Stub.GetTimesheetById();

request.setId(<timesheet_id>);

request.setToken(ticket);   //from authenticate call

GetTimesheetByIdResponse timesheetResp=stub.getTimesheetById(request);

Timesheet timesheet = timesheetResp.get_return();

rate.getPeriod());

System.out.println("

Read Timesheet ID

PeriodDuration:" +

timesheet

rate.

getId

getPeriodDuration());

System.out.println("

Status

SelectableByWorkers:" +

timesheet

rate.

getStatus

getSelectableByWorkers());

System.out.println("

Placement

TimePattern:" +

timesheet

rate.

getPlacementId

getTimePattern());

if (timesheet.getPeriodEndDate() != null)

System.out.println("

End Date

TimesheetFields:" +

timesheet

rate.

getPeriodEndDate

getTimesheetFields());

if (timesheet.getCreated() != null)

System.out.println("

Created

PayElementCode:" +

timesheet

rate.

getCreated

getPayElementCode()

.getTime(

)

)

;

if (timesheet.getModified() != null)

System.out.println("

Modified

Payable:" +

timesheet.getModified().getTime

rate.getPayable());

if (timesheet.getSubmitted() != null)

System.out.println("

Submitted

Chargeable:" +

timesheet

rate.

getSubmitted

getChargeable()

.getTime()

);

if (timesheet.getApproved() != null)

System.out.println("

Approved

Taxable:" +

timesheet

rate.

getApproved

getTaxable()

.getTime()

);

System.out.println("

timesheetPay

RefCode:" +

timesheet

rate.

getTimesheetPay

getRefCode());

System.out.println("timesheetCharge: " + timesheet.getTimesheetCharge());

}

}

if (placement.getSplitCommissions() != null) {

for (SplitCommission split : placement.getSplitCommissions()) {

System.out.println("

ERNI

\nCommission UserID:"+

timesheet

split.

getErni

getUserId()

);System.out.println("Pension

+" Percentage:"+

timesheet

split.

getPension

getWeight());

System.out.println("Holiday: " + timesheet.getHoliday());

}

}

if (placement.getAlternativeManagers() != null) {

for (User altMan : placement.getAlternativeManagers()) {

System.out.println("

getFullyInvoiced

Alternative Manager:" +

timesheet

altMan.

getFullyInvoiced

getFirstname()

);System.out.println("getPurchaseWrittenOff:

+ " " +

timesheet

altMan.

getPurchaseWrittenOff

getLastname());

System.out.println("

getSalesWrittenOff

External Id: " +

timesheet

altMan.

getSalesWrittenOff

getExternalId()

);System.out.println("Worker

+ " Internal ID:" +

timesheet

altMan.

getWorkerId

getId());

}

}

}

} catch (java.lang.Exception e) {

System.out.println("AdjustsException occurred: " + timesheet.getAdjustsRefCode(e));

//Shifts

if (timesheet.getShifts() != null && timesheet.getShifts().length > 0) {

for (Shift shift : timesheet.getShifts()) {

System.out.println("Shift ID:"+shift.getId());

}

Read a Timesheet including any invoices

try {

IntimeServiceV3_2Stub.GetTimesheetById request=new IntimeServiceV3_2Stub.GetTimesheetById();

request.setId(<timesheet_id>);

request.setToken(ticket);   //from authenticate call

GetTimesheetByIdResponse timesheetResp=stub.getTimesheetById(request);

Timesheet timesheet = timesheetResp.get_return();


System.out.println("

hours

Read Timesheet ID:" +

shift

timesheet.

getHours

getId());

System.out.println("

Decimal

Status:" +

shift

timesheet.

getDecimal

getStatus());

System.out.println("

Day

Placement:" +

new Date(shift.getDay

timesheet.getPlacementId())

+ " (" + shift.getDay()+ ")");

;

if (timesheet.getPeriodEndDate() != null) System.out.println("

PO

End Date:" +

shift

timesheet.

getPurchaseOrderNumber

getPeriodEndDate());

if (timesheet.getCreated() != null) System.out.println("

Start

Created:" +

new Date(shift.getStartTime()) +" (" + shift.getStartTime()+ ")");

System.out.println("Rate Name:"+shift.getRateName());

timesheet.getCreated().getTime());

if (timesheet.getModified() != null) System.out.println("

Rate Pay

Modified:" +

shift

timesheet.

getRate

getModified().

getPay

getTime());

if (timesheet.getSubmitted() != null) System.out.println("

Rate Charge

Submitted:" +

shift

timesheet.

getRate

getSubmitted().

getCharge

getTime());

}

}

//Associated Invoices & credits

if (timesheet.getInvoiceInfogetApproved() != null) {

for (InvoiceInfo invoice : timesheet.getInvoiceInfo()){

System.out.println("

Invoice Number

Approved:" +

invoice.getInvoiceNumber

timesheet.getApproved().getTime());


System.out.println("

Invoice date

timesheetPay: " +

invoice.getInvoiceDate().getTime

timesheet.getTimesheetPay());

System.out.println("

Invoice Type

timesheetCharge: " +

invoice

timesheet.

getInvoiceDescription

getTimesheetCharge());

System.out.println("

Invoice GUID

ERNI: " +

invoice

timesheet.

getInvoiceGUID

getErni());

System.out.println("

Invoice Net

Pension: " +

invoice

timesheet.

getNet

getPension());

System.out.println("

Invoice Gross

Holiday: " +

invoice

timesheet.

getGross

getHoliday());

System.out.println("

Invoice VAT

getFullyInvoiced: " +

invoice

timesheet.

getVat

getFullyInvoiced());

System.out.println("

Invoice Currency

getPurchaseWrittenOff: " +

invoice

timesheet.

getCurrency

getPurchaseWrittenOff());

if (invoice.getExported() != null) {

System.out.println("getSalesWrittenOff: " + timesheet.getSalesWrittenOff());

System.out.println("

Exported date

Worker:" +

invoice

timesheet.

getExported

getWorkerId()

.getTime

);

System.out.println("Adjusts:" + timesheet.getAdjustsRefCode());

}

}

}

} catch (Exception e


//Shifts

if (timesheet.getShifts() != null && timesheet.getShifts().length > 0) {

for (Shift shift : timesheet.getShifts()) {

System.out.println("

Exception occurred

Shift ID:"+

e

shift.getId());

}

Create or update a Worker

try {

//Attempt to read the worker first as it may already exist

IntimeServiceV3_2Stub.GetWorkerByExternalId getWorkerRequest=new IntimeServiceV3_2Stub.GetWorkerByExternalId();

getWorkerRequest.setId("WEB-WKR01");

getWorkerRequest.setToken(ticket);   //from authenticate call

GetWorkerByExternalIdResponse workerResponse=stub.getWorkerByExternalId(getWorkerRequest);

Worker worker=workerResponse.get_return();

if (worker == null) {

    //Worker did not exist

    worker.setExternalId("WEB-WKR01");

}

//set or update any fields as required

worker.setFirstname("Ltd");

worker.setLastname("Worker");

worker.setEmail("x@x.com");

worker.setTitle("Mrs");

worker.setWorkerType("ltd");

worker.setGender("F");

worker.setSelfBilling(false);

worker.setAccountsReference("ACC_REF");

worker.setPaymentFrequency("Monthly");

String[] wConsolidation = new String[] { "destination","source","pay-currency","purchase-tax-code","worker" };

worker.setConsolidation(wConsolidation);

String[] wGrouping = new String[] { "sheet-rate" };

worker.setGrouping(wGrouping);

Calendar cal = Calendar.getInstance(java.util.TimeZone.getTimeZone("GMT"));

cal.set(1980, 0, 1, 0, 0, 0);

cal.set(Calendar.MILLISECOND, 0);

worker.setDateOfBirth(cal);

Calendar cal2 = Calendar.getInstance(java.util.TimeZone.getTimeZone("GMT"));

cal2.set(2017, 0, 1, 0, 0, 0);

cal2.set(Calendar.MILLISECOND, 0);

worker.setDateOfJoining(cal2);

IntimeServiceV3_2Stub.Address address = new IntimeServiceV3_2Stub.Address();

address.setLine1("Address1");

address.setLine2("Add2");

address.setTown("Town");

address.setCounty("County");

address.setCountry("UK");

address.setPostcode("AB1 2CD");

address.setCountryCode("GB");

worker.setAddress(address);

BankAccount bank = new BankAccount();

bank.setAccountName("Ltd Wkr");

bank.setAccountNumber("12345678");

bank.setBank("bank");

bank.setSortCode("11-22-33");

worker.setBankAccount(bank);

Company ltdCompany = new Company();

ltdCompany.setName("Ltd Co Name");

ltdCompany.setCompanyNo("123456789");

ltdCompany.setCompanyVatNo("1234567890");

ltdCompany.setVatCode("T0");

worker.setLimitedCompany(ltdCompany);

IntimeServiceV3_2Stub.CreateOrUpdateWorker request = new IntimeServiceV3_2Stub.CreateOrUpdateWorker();

request.setToken(ticket);   //from authenticate call

request.setWorker(worker);

IntimeServiceV3_2Stub.CreateOrUpdateWorkerResponse result=stub.createOrUpdateWorker(request);

if (result != null) {

System.out.println("Created/updated Worker with ID:" + result.get_return());

}

} catch (java.lang.Exception e) {

System.out.println("Exception occurred: " + e);

Create a Placement

try{

//Attempt to read the placement first to check if it already exists

IntimeServiceV3_2Stub.GetPlacementByExternalId getPlacementRequest=new IntimeServiceV3_2Stub.GetPlacementByExternalId();

getPlacementRequest.setId("WEB-PLC-001");

getPlacementRequest.setToken(ticket);

GetPlacementByExternalIdResponse placementResponse=stub.getPlacementByExternalId(getPlacementRequest);

IntimeServiceV3_2Stub.Placement placement=placementResponse.get_return();

if (placement == null) {

    //placement does not exist

    placement = new IntimeServiceV3_2Stub.Placement();

    placement.setExternalId("WEB-PLC-001");

}

//Consultant

IntimeServiceV3_2Stub.Consultant consultant= new IntimeServiceV3_2Stub.Consultant();

IntimeServiceV3_2Stub.GetConsultantsByExternalId getConsultantRequest=new IntimeServiceV3_2Stub.GetConsultantsByExternalId();

getConsultantRequest.setId("WEB-CON01");

getConsultantRequest.setToken(ticket);   //from authenticate call

GetConsultantsByExternalIdResponse consultantResponse=stub.getConsultantsByExternalId(getConsultantRequest);

IntimeServiceV3_2Stub.Consultant[] cons=consultantResponse.get_return();

if (cons== null || cons.size() < 1) {

    //consultant did not exist    

    consultant.setExternalId("WEB-CON01");

    consultant.setFirstname("Web");

    consultant.setLastname("Consultant");

    consultant.setEmail("C@c.com");

    IntimeServiceV3_2Stub.CreateOrUpdateConsultant createConsultantRequest = new IntimeServiceV3_2Stub.CreateOrUpdateConsultant();

    createConsultantRequest.setToken(ticket);

    createConsultantRequest.setConsultant(consultant);

    IntimeServiceV3_2Stub.CreateOrUpdateConsultantResponse createConsultantResult=stub.createOrUpdateConsultant(createConsultantRequest);

    if (createConsultantResult

System.out.println("hours:"+shift.getHours());

System.out.println("Decimal:"+shift.getDecimal());

System.out.println("Day:" + new Date(shift.getDay()) + " (" + shift.getDay()+ ")");

System.out.println("PO:" + shift.getPurchaseOrderNumber());

System.out.println("Start:"+new Date(shift.getStartTime()) +" (" + shift.getStartTime()+ ")");

System.out.println("Rate Name:"+shift.getRateName());

System.out.println("Rate Pay:"+shift.getRate().getPay());

System.out.println("Rate Charge:"+shift.getRate().getCharge());

}

}

//Associated Invoices & credits

if (timesheet.getInvoiceInfo() != null) {

for (InvoiceInfo invoice : timesheet.getInvoiceInfo()){

System.out.println("Invoice Number:" + invoice.getInvoiceNumber());

System.out.println("Invoice date:" + invoice.getInvoiceDate().getTime());

System.out.println("Invoice Type:" + invoice.getInvoiceDescription());

System.out.println("Invoice GUID:" + invoice.getInvoiceGUID());

System.out.println("Invoice Net:" + invoice.getNet());

System.out.println("Invoice Gross:" + invoice.getGross());

System.out.println("Invoice VAT:" + invoice.getVat());

System.out.println("Invoice Currency:" + invoice.getCurrency());

if (invoice.getExported() != null) {

System.out.println("Exported date:" + invoice.getExported().getTime());

}

}

}

} catch (Exception e) {

System.out.println("Exception occurred: " + e);

}

Create or update a Worker

try {

//Attempt to read the worker first as it may already exist

IntimeServiceV3_2Stub.GetWorkerByExternalId getWorkerRequest=new IntimeServiceV3_2Stub.GetWorkerByExternalId();

getWorkerRequest.setId("WEB-WKR01");

getWorkerRequest.setToken(ticket);   //from authenticate call

GetWorkerByExternalIdResponse workerResponse=stub.getWorkerByExternalId(getWorkerRequest);

Worker worker=workerResponse.get_return();

if (worker == null) {

    //Worker did not exist

    worker.setExternalId("WEB-WKR01");

}

//set or update any fields as required

worker.setFirstname("Ltd");

worker.setLastname("Worker");

worker.setEmail("x@x.com");

worker.setTitle("Mrs");

worker.setWorkerType("ltd");

worker.setGender("F");

worker.setSelfBilling(false);

worker.setAccountsReference("ACC_REF");

worker.setPaymentFrequency("Monthly");


String[] wConsolidation = new String[] { "destination","source","pay-currency","purchase-tax-code","worker" };

worker.setConsolidation(wConsolidation);

String[] wGrouping = new String[] { "sheet-rate" };

worker.setGrouping(wGrouping);


Calendar cal = Calendar.getInstance(java.util.TimeZone.getTimeZone("GMT"));

cal.set(1980, 0, 1, 0, 0, 0);

cal.set(Calendar.MILLISECOND, 0);

worker.setDateOfBirth(cal);

Calendar cal2 = Calendar.getInstance(java.util.TimeZone.getTimeZone("GMT"));

cal2.set(2017, 0, 1, 0, 0, 0);

cal2.set(Calendar.MILLISECOND, 0);

worker.setDateOfJoining(cal2);


IntimeServiceV3_2Stub.Address address = new IntimeServiceV3_2Stub.Address();

address.setLine1("Address1");

address.setLine2("Add2");

address.setTown("Town");

address.setCounty("County");

address.setCountry("UK");

address.setPostcode("AB1 2CD");

address.setCountryCode("GB");

worker.setAddress(address);


BankAccount bank = new BankAccount();

bank.setAccountName("Ltd Wkr");

bank.setAccountNumber("12345678");

bank.setBank("bank");

bank.setSortCode("11-22-33");

worker.setBankAccount(bank);


Company ltdCompany = new Company();

ltdCompany.setName("Ltd Co Name");

ltdCompany.setCompanyNo("123456789");

ltdCompany.setCompanyVatNo("1234567890");

ltdCompany.setVatCode("T0");

worker.setLimitedCompany(ltdCompany);


IntimeServiceV3_2Stub.CreateOrUpdateWorker request = new IntimeServiceV3_2Stub.CreateOrUpdateWorker();

request.setToken(ticket);   //from authenticate call

request.setWorker(worker);


IntimeServiceV3_2Stub.CreateOrUpdateWorkerResponse result=stub.createOrUpdateWorker(request);

if (result != null) {

System.out.println("Created/updated Consultant Worker with ID:" + createConsultantResultresult.get_return());

    }

}

else {    consultant = cons[0]

catch (java.lang.Exception e) {

System.out.println("Exception occurred: " + e);

}

placement.setConsultant(consultant);

//Client

 


Create a Placement

try{

//Attempt to read the placement first to check if it already exists

IntimeServiceV3_2Stub.Client client GetPlacementByExternalId getPlacementRequest=new IntimeServiceV3_2Stub.ClientGetPlacementByExternalId();

IntimeServiceV3_2Stub.GetClientsByExternalId getClientRequest=new IntimeServiceV3_2Stub.GetClientsByExternalId();

getClientRequestgetPlacementRequest.setId("WEB-PLC-CLI01001");

getClientRequestgetPlacementRequest.setToken(ticket);   //from authenticate callGetClientsByExternalIdResponse clientResponse

GetPlacementByExternalIdResponse placementResponse=stub.getClientsByExternalIdgetPlacementByExternalId(getClientRequestgetPlacementRequest);

IntimeServiceV3_2Stub.Client[] clients=clientResponsePlacement placement=placementResponse.get_return();

if (clientsplacement == null || clients.size() < 1) {

      //client did not exist    placement does not exist

    client.setExternalId("WEB-CLI01");   placement = new IntimeServiceV3_2Stub.Placement();

    clientplacement.setNamesetExternalId("Web Client WEB-PLC-001");

    client.setTermsTemplateName("Default Charge Terms");

    //populate other fields

    }


//Consultant

IntimeServiceV3_2Stub.Consultant consultant= new IntimeServiceV3_2Stub.Consultant();

IntimeServiceV3_2Stub.CreateOrUpdateClient createClientRequest GetConsultantsByExternalId getConsultantRequest=new IntimeServiceV3_2Stub.CreateOrUpdateClient(.GetConsultantsByExternalId();

getConsultantRequest.setId("WEB-CON01");

    createClientRequestgetConsultantRequest.setToken(ticket);    createClientRequest.setClient(client//from authenticate call

GetConsultantsByExternalIdResponse consultantResponse=stub.getConsultantsByExternalId(getConsultantRequest);

    IntimeServiceV3_2Stub.CreateOrUpdateClientResponse createClientResult=stub.createOrUpdateClient(createClientRequestConsultant[] cons=consultantResponse.get_return();   

if (createClientResult !cons== null || cons.size() < 1) {

System.out.println("Created/updated Client with ID:" + createClientResult.get_return()

    //consultant did not exist    

    consultant.setExternalId("WEB-CON01");

    consultant.setFirstname("Web");

    }} else {consultant.setLastname("Consultant");

    client = clients[0];

}

placement.setClient(client);

//Manager

consultant.setEmail("C@c.com");

    IntimeServiceV3_2Stub.Manager manager CreateOrUpdateConsultant createConsultantRequest = new IntimeServiceV3_2Stub.ManagerCreateOrUpdateConsultant();

IntimeServiceV3_2Stub.GetManagersByExternalId getManagerRequest=new IntimeServiceV3_2Stub.GetManagersByExternalId(    createConsultantRequest.setToken(ticket);getManagerRequest

    createConsultantRequest.setId("WEB-MAN01"setConsultant(consultant);

getManagerRequest.setToken(ticket);   //from authenticate call
GetManagersByExternalIdResponse managerResponse=stub.getManagersByExternalId(getManagerRequest);
    IntimeServiceV3_2Stub.Manager[] mgrs=managerResponse.get_return(CreateOrUpdateConsultantResponse createConsultantResult=stub.createOrUpdateConsultant(createConsultantRequest);

    if (mgrs=createConsultantResult != null || mgrs.size() < 1) {    //manager did not exist    
    manager.setExternalId("WEB-MAN01"

System.out.println("Created/updated Consultant with ID:" + createConsultantResult.get_return());

    manager.setFirstname("Web");
    manager.setLastname("Manager");
    manager.setEmail("m@m.com");
    manager.setClient(client);
    IntimeServiceV3_2Stub.CreateOrUpdateManager createManagerRequest }

} else {

    consultant = cons[0];

}

placement.setConsultant(consultant);


//Client

IntimeServiceV3_2Stub.Client client = new IntimeServiceV3_2Stub.Client();

IntimeServiceV3_2Stub.GetClientsByExternalId getClientRequest=new IntimeServiceV3_2Stub.CreateOrUpdateManager(GetClientsByExternalId();

getClientRequest.setId("WEB-CLI01");   

createManagerRequestgetClientRequest.setToken(ticket);
    createManagerRequest.setManager(manager//from authenticate call

GetClientsByExternalIdResponse clientResponse=stub.getClientsByExternalId(getClientRequest);

    IntimeServiceV3_2Stub.CreateOrUpdateManagerResponse createManagerResult=stub.createOrUpdateManager(createManagerRequestClient[] clients=clientResponse.get_return();

    if (createManagerResult !clients== null || clients.size() < 1) {

     //client did not exist    

    Systemclient.out.printlnsetExternalId("Created/updated Manager with ID:" + createManagerResult.get_return());
    }
} else {
    manager = mgrs[0];
}
placement.setManager(manager);

//Worker

IntimeServiceV3_2Stub.GetWorkersByExternalId getWorkerRequestWEB-CLI01");   

    client.setName("Web Client 001");

    client.setTermsTemplateName("Default Charge Terms");

    //populate other fields

    IntimeServiceV3_2Stub.CreateOrUpdateClient createClientRequest = new IntimeServiceV3_2Stub.GetWorkersByExternalIdCreateOrUpdateClient();getWorkerRequest

    createClientRequest.setId("WEB-WKR01"setToken(ticket);getWorkerRequest

    createClientRequest.setTokensetClient(ticketclient);   //from authenticate call
GetWorkersByExternalIdResponse workerResponse=stub.getWorkersByExternalId(getWorkerRequest);
IntimeServiceV3

    IntimeServiceV3_2Stub.Worker[] wkrs=workerResponse.get_return(CreateOrUpdateClientResponse createClientResult=stub.createOrUpdateClient(createClientRequest);

    if (wkrs=createClientResult != null || wkrs.size() < 1) {
    //worker did not exist    
    worker.setExternalId("WEB-WKR01"{

System.out.println("Created/updated Client with ID:" + createClientResult.get_return());

    worker.setFirstname("Web");}

} else {

    worker.setLastname("Worker");
    worker.setEmail("w@w.com");
    //populate other details    IntimeServiceV3_2Stub.CreateOrUpdateWorker createWorkerRequest client = clients[0];

}

placement.setClient(client);


//Manager

IntimeServiceV3_2Stub.Manager manager = new IntimeServiceV3_2Stub.Manager();

IntimeServiceV3_2Stub.GetManagersByExternalId getManagerRequest=new IntimeServiceV3_2Stub.CreateOrUpdateWorkerGetManagersByExternalId();
    createWorkerRequestgetManagerRequest.setId("WEB-MAN01");
getManagerRequest.setToken(ticket);
    createWorkerRequest.setWorker(worker  //from authenticate call
GetManagersByExternalIdResponse managerResponse=stub.getManagersByExternalId(getManagerRequest);
    IntimeServiceV3_2Stub.CreateOrUpdateWorkerResponse createWorkerResult=stub.createOrUpdateWorker(createWorkerRequestManager[] mgrs=managerResponse.get_return();
    if (createWorkerResult !mgrs== null || mgrs.size() < 1) {
    //manager did not exist    
    Systemmanager.out.printlnsetExternalId("Created/updated Worker with ID:" + createWorkerResult.get_return())WEB-MAN01");
    }
} else {
    worker = wkrs[0];
}
placement.setWorker(worker);

//set/update other placement fields

placement.setContractedHours(new BigDecimal(37.5));

placement.setCurrencyForCharge("GBP");

placement.setCurrencyForPayExpenses("GBP");

placement.setCurrencyForPayTimesheets("GBP");

placement.setChargeableExpenseApprovalRoute("Client Manager Approval");

placement.setNonChargeableExpenseApprovalRoute("Auto Approval");

placement.setTimesheetApprovalRoute("Auto Approval");

placement.setExpenseTemplate("Default");

placement.setHolidayAccuralRate(0.12);

placement.setJobDescription("Web Placement 1");

placement.setJobTitle("Web Test 001");

placement.setNoCommunications("");

placement.setPurchaseOrderNum("po_num");

placement.setSalesCostCentre("scc");

placement.setTimesheetDateCalculatorName("weekly");

placement.setPerm(false);

Calendar cal1 = Calendar.getInstance(java.util.TimeZone.getTimeZone("GMT"));

cal1.set(2021, 3, 1, 0, 0, 0);

placement.setStart(cal1);

Calendar cal2 = Calendar.getInstance(java.util.TimeZone.getTimeZone("GMT"));

cal2.set(2023, 3, 1, 0, 0, 0);

placement.setEnd(cal2);

IntimeServiceV3_2Stub.Rate[] rates = new IntimeServiceV3_2Stub.Rate[1];

IntimeServiceV3_2Stub.Rate rate1 = new IntimeServiceV3_2Stub.Rate();

rate1.setName("Standard Hours");

rate1.setPay(new BigDecimal(9.99));

rate1.setCharge(new BigDecimal(11.11));

rate1.setPayElementCode("001");

rate1.setPeriod("Hourly");

rate1.setPeriodDuration(60);

rate1.setPriorityOrder(0);

rate1.setTimePattern("DEFAULT");

rate1.setTimesheetFields("START_FINISH_BREAK");

rate1.setSelectableByWorkers(true);

rates[0] = rate1;

placement.setRates(rates);

IntimeServiceV3_2Stub.CreateOrUpdatePlacement request = new IntimeServiceV3_2Stub.CreateOrUpdatePlacement();

request.setToken(ticket);

request.setPlacement(placement);

IntimeServiceV3_2Stub.CreateOrUpdatePlacementResponse result=stub.createOrUpdatePlacement(request);

if (result != null) {

System.out.println("Created/updated Placement with ID:" + result.get_return());

}

} catch (java.lang.Exception e) {

System.out.println("Exception occurred: " + e);

}

Update a Placement

try{

//Attempt to read the placement first 

IntimeServiceV3_2Stub.GetPlacementByExternalId getPlacementRequest=new IntimeServiceV3_2Stub.GetPlacementByExternalId();

getPlacementRequest.setId("WEB-PLC-001");

getPlacementRequest.setToken(ticket);

GetPlacementByExternalIdResponse placementResponse=stub.getPlacementByExternalId(getPlacementRequest);

IntimeServiceV3_2Stub.Placement placement=placementResponse.get_return();

if (placement == null) {

    //placement does not exist

    placement = new IntimeServiceV3_2Stub.Placement();

    //refer to create placement process

}

//Apply any Consultant changes

IntimeServiceV3_2Stub.Consultant consultant=placement.getConsultant();

consultant.setDepartment("Web testing");

//Apply any Client changes

IntimeServiceV3_2Stub.Client client=placement.getClient();

client.getInvoicingContact().getAddress().setLine1("123 Test Street");

//Apply any Manager changes

IntimeServiceV3_2Stub.Manager manager=placement.getManager();
manager.setLastname("Modified");

//Apply any Worker changes

IntimeServiceV3_2Stub.Worker worker=placement.getWorker();

worker.getLimitedCompany().setCompanyVatNo("67896789");

worker.setDefaultPaymentCurrency("GBP");

//set/update other placement fields

placement.setPurchaseOrderNum("po_num 2");

placement.setSalesCostCentre("scc mod");

for (IntimeServiceV3_2Stub.Rate rate : placement.getRates()) {

   if(rate.getName() == "Standard Hours") {

      //update pay/charge rate

      rate1.setPay(new BigDecimal(15));

      rate1.setCharge(new BigDecimal(22.50));

   }

}

manager.setFirstname("Web");
    manager.setLastname("Manager");
    manager.setEmail("m@m.com");
    manager.setClient(client);
    IntimeServiceV3_2Stub.CreateOrUpdateManager createManagerRequest = new IntimeServiceV3_2Stub.CreateOrUpdateManager();
    createManagerRequest.setToken(ticket);
    createManagerRequest.setManager(manager);
    IntimeServiceV3_2Stub.CreateOrUpdateManagerResponse createManagerResult=stub.createOrUpdateManager(createManagerRequest);
    if (createManagerResult != null) {
        System.out.println("Created/updated Manager with ID:" + createManagerResult.get_return());
    }
} else {
    manager = mgrs[0];
}
placement.setManager(manager);


//Worker

IntimeServiceV3_2Stub.GetWorkersByExternalId getWorkerRequest=new IntimeServiceV3_2Stub.GetWorkersByExternalId();
getWorkerRequest.setId("WEB-WKR01");
getWorkerRequest.setToken(ticket);   //from authenticate call
GetWorkersByExternalIdResponse workerResponse=stub.getWorkersByExternalId(getWorkerRequest);
IntimeServiceV3_2Stub.Worker[] wkrs=workerResponse.get_return();
if (wkrs== null || wkrs.size() < 1) {
    //worker did not exist    
    worker.setExternalId("WEB-WKR01");
    worker.setFirstname("Web");
    worker.setLastname("Worker");
    worker.setEmail("w@w.com");
    //populate other details


    IntimeServiceV3_2Stub.CreateOrUpdateWorker createWorkerRequest = new IntimeServiceV3_2Stub.CreateOrUpdateWorker();
    createWorkerRequest.setToken(ticket);
    createWorkerRequest.setWorker(worker);
    IntimeServiceV3_2Stub.CreateOrUpdateWorkerResponse createWorkerResult=stub.createOrUpdateWorker(createWorkerRequest);
    if (createWorkerResult != null) {
        System.out.println("Created/updated Worker with ID:" + createWorkerResult.get_return());
    }
} else {
    worker = wkrs[0];
}
placement.setWorker(worker);


//set/update other placement fields

placement.setContractedHours(new BigDecimal(37.5));

placement.setCurrencyForCharge("GBP");

placement.setCurrencyForPayExpenses("GBP");

placement.setCurrencyForPayTimesheets("GBP");

placement.setChargeableExpenseApprovalRoute("Client Manager Approval");

placement.setNonChargeableExpenseApprovalRoute("Auto Approval");

placement.setTimesheetApprovalRoute("Auto Approval");

placement.setExpenseTemplate("Default");

placement.setHolidayAccuralRate(0.12);

placement.setJobDescription("Web Placement 1");

placement.setJobTitle("Web Test 001");

placement.setNoCommunications("");

placement.setPurchaseOrderNum("po_num");

placement.setSalesCostCentre("scc");

placement.setTimesheetDateCalculatorName("weekly");

placement.setPerm(false);


Calendar cal1 = Calendar.getInstance(java.util.TimeZone.getTimeZone("GMT"));

cal1.set(2021, 3, 1, 0, 0, 0);

placement.setStart(cal1);

Calendar cal2 = Calendar.getInstance(java.util.TimeZone.getTimeZone("GMT"));

cal2.set(2023, 3, 1, 0, 0, 0);

placement.setEnd(cal2);


IntimeServiceV3_2Stub.Rate[] rates = new IntimeServiceV3_2Stub.Rate[1];

IntimeServiceV3_2Stub.Rate rate1 = new IntimeServiceV3_2Stub.Rate();

rate1.setName("Standard Hours");

rate1.setPay(new BigDecimal(9.99));

rate1.setCharge(new BigDecimal(11.11));

rate1.setPayElementCode("001");

rate1.setPeriod("Hourly");

rate1.setPeriodDuration(60);

rate1.setPriorityOrder(0);

rate1.setTimePattern("DEFAULT");

rate1.setTimesheetFields("START_FINISH_BREAK");

rate1.setSelectableByWorkers(true);

rates[0] = rate1;

placement.setRates(rates);


IntimeServiceV3_2Stub.CreateOrUpdatePlacement request = new IntimeServiceV3_2Stub.CreateOrUpdatePlacement();

request.setToken(ticket);

request.setPlacement(placement);


IntimeServiceV3_2Stub.CreateOrUpdatePlacementResponse result=stub.createOrUpdatePlacement(request);

if (result != null) {

System.out.println("Created/updated Placement with ID:" + result.get_return());

}

} catch (java.lang.Exception e) {

System.out.println("Exception occurred: " + e);

}

...


Update a

...

Placement

Limited Company Details

Limited Company type workers have additional information that relate to their limited company. To provide access to this an associated LimitedCompany object and a LtdCompanyContact  object were added to the Worker object.

The following RSM InTime data fields appear in both the Worker object and the associated LimitedCompany Object: AccountsReference (AccountsRef), VATCode, DefaultPaymentCurrency (Currency), NominalCode, ExpensesNominalCode, Consolidation and Grouping.

Version 2.9 and earlier: Both the LtdCompanyContact object and the LimitedCompany.InvoiceContact are populated when reading a Worker from RSM InTime. When creating or updating RSM InTime you should set the fields in the ltdCompanyContact object for the contact name, email, phone and address details.

The following fields should be read from and updated on the Worker base object: AccountsRef, DefaultPaymentCurrency, NominalCode, ExpensesNominalCode, Consolidation and Grouping.

The VAT Code should be read from and updated via the associated LimitedCompany object.

Version 3.0 as of this version the situation is simplified. There is no LtdCompanyContact object on the worker. The Limited Company Contact details (name, email, address) should be read and updated via the LimitedCompany.InvoiceContact object. All the following fields can only be read from and updated from the Worker base object: AccountsRef, VATCode, DefaultPaymentCurrency, NominalCode, ExpensesNominalCode, Consolidation and Grouping. Note: Both Worker and LimitedCompany objects have timesheetsOnInvoices field - the one specified in the LimitedCompany will take precedence over Worker. 

Constants

Whilst using the RSM InTime Web Services, some fields have expected values from a range of constants. These are detailed below.

FieldConstant

Comment

NotesClient

try{

//Read Attempt to read the associated placement so we can reference the rates & participantsplacement first 

IntimeServiceV3_2Stub.GetPlacementByExternalId getPlacementRequest=new IntimeServiceV3_2Stub.GetPlacementByExternalId();

getPlacementRequest.setId("WEB-PLC-001");

getPlacementRequest.setToken(ticket);

GetPlacementByExternalIdResponse placementResponse=stub.getPlacementByExternalId(getPlacementRequest);

IntimeServiceV3_2Stub.Placement placement=placementResponse.get_return();

//identify the required rate

Rate rate1 = null;

for (Rate rate : placement.getRates()) {

if (rate.getName().equals("Standard Hours")) {

rate1 = rate;

}

}

Calendar cal = Calendar.getInstance(java.util.TimeZone.getTimeZone("GMT"));

cal.set(2017,9,1,0,0,0);

cal.set(Calendar.MILLISECOND, 0);

//create a timesheetSubmission

IntimeServiceV3_2Stub.Timesheet timesheetSubmission = new IntimeServiceV3_2Stub.Timesheet();

timesheetSubmission.setPlacementExternalRef(placement.getExternalId());

timesheetSubmission.setSubmitterId(placement.getWorker().getId()); //Whoever is creating the Timesheet

timesheetSubmission.setPeriodEndDate(cal.getTime());

//Add the Shifts

IntimeServiceV3_2Stub.Shift shift = new IntimeServiceV3_2Stub.Shift();

shift.setComment("Shift 1 comment");

shift.setDay(cal.getTimeInMillis()); //set the day the shift relates to

shift.setRateId(rate1.getId());

if (rate1.getTimesheetFields().equals("START_FINISH_BREAK")) {

//This rate requires start, finish and break times entered for the shift

Calendar calStart = Calendar.getInstance(java.util.TimeZone.getTimeZone("GMT"));

calStart.set(2017,9,1,0,0,0);

calStart.set(Calendar.MILLISECOND, 0);

calStart.set(Calendar.HOUR_OF_DAY, 8);

shift.setStartTime(calStart.getTimeInMillis());

Calendar calEnd = Calendar.getInstance(java.util.TimeZone.getTimeZone("GMT"));

calEnd.set(2017,9,1,0,0,0);

calStart.set(Calendar.MILLISECOND, 0);

calEnd.set(Calendar.HOUR_OF_DAY, 17);

shift.setFinishTime(calEnd.getTimeInMillis());

shift.setMealBreak(3600000L); //1 hour in milliseconds

} else if (rate1.getTimesheetFields().equals("HOURS")) {

shift.setHours(8 * 60 * 60 * 1000L);

} else if (rate1.getTimesheetFields().equals("DECIMAL")) {

shift.setDecimal(new BigDecimal(1));

} else if (rate1.getTimesheetFields().equals("DAY")) {

shift.setDecimal(new BigDecimal(1));

}

Shift[] shifts = new Shift[1];

shifts[0] = shift;

timesheetSubmission.setShifts(shifts);

IntimeServiceV3_2Stub.UpdateTimesheet updateTimesheetRequest=new IntimeServiceV3_2Stub.UpdateTimesheet();

updateTimesheetRequest.setToken(ticket);

updateTimesheetRequest.setTimesheet(timesheetSubmission);

UpdateTimesheetResponse updateTimesheetResponse=stub.updateTimesheet(updateTimesheetRequest);

Long timesheetId=updateTimesheetResponse.get_return();

System.out.println("Update Timesheet returned:"+timesheetId);

} catch (Exception e) {

System.out.println("Exception occurred: " + e);

}

Submit a Timesheet

...

try {

IntimeServiceV3_2Stub.SubmitTimesheet submitTimesheetRequest=new IntimeServiceV3_2Stub.SubmitTimesheet();

submitTimesheetRequest.setToken(ticket);

submitTimesheetRequest.setTimesheetId(<timesheet_id>);

SubmitTimesheetResponse submitTimesheetResponse=stub.submitTimesheet(submitTimesheetRequest);

System.out.println("Submit Timesheet returned: "+submitTimesheetResponse.get_return());

} catch (Exception e) {

System.out.println("Exception occurred: " + e);

}

Get a Single Sign-on token

...

try {

GetSingleSignOnToken ss=new GetSingleSignOnToken();

ss.setToken(ticket);

ss.setUsername(<username>);

ss.setTimeToLiveSeconds(360);

GetSingleSignOnTokenResponse ssResp=stub.getSingleSignOnToken(ss);

if (ssResp!=null) {

System.out.println("Single Sign on Token: " + ssResp.get_return());

}

//Can now append the token to any InTime URL to use access it without logging in. E.g.

//https://demo.in-time.co.uk/placement/show?placement=<placement_id>&ticket=<token>

} catch (Exception e) {

System.out.println("Exception occurred: " + e);

}

if (placement == null) {

    //placement does not exist

    placement = new IntimeServiceV3_2Stub.Placement();

    //refer to create placement process

}


//Apply any Consultant changes

IntimeServiceV3_2Stub.Consultant consultant=placement.getConsultant();

consultant.setDepartment("Web testing");


//Apply any Client changes

IntimeServiceV3_2Stub.Client client=placement.getClient();

client.getInvoicingContact().getAddress().setLine1("123 Test Street");


//Apply any Manager changes

IntimeServiceV3_2Stub.Manager manager=placement.getManager();
manager.setLastname("Modified");


//Apply any Worker changes

IntimeServiceV3_2Stub.Worker worker=placement.getWorker();

worker.getLimitedCompany().setCompanyVatNo("67896789");

worker.setDefaultPaymentCurrency("GBP");


//set/update other placement fields

placement.setPurchaseOrderNum("po_num 2");

placement.setSalesCostCentre("scc mod");


for (IntimeServiceV3_2Stub.Rate rate : placement.getRates()) {

   if(rate.getName() == "Standard Hours") {

      //update pay/charge rate

      rate1.setPay(new BigDecimal(15));

      rate1.setCharge(new BigDecimal(22.50));

   }

}


IntimeServiceV3_2Stub.CreateOrUpdatePlacement request = new IntimeServiceV3_2Stub.CreateOrUpdatePlacement();

request.setToken(ticket);

request.setPlacement(placement);

IntimeServiceV3_2Stub.CreateOrUpdatePlacementResponse result=stub.createOrUpdatePlacement(request);

if (result != null) {

System.out.println("Created/updated Placement with ID:" + result.get_return());

}

} catch (java.lang.Exception e) {

System.out.println("Exception occurred: " + e);

}

Create or update a Timesheet

try{

//Read the associated placement so we can reference the rates & participants

IntimeServiceV3_2Stub.GetPlacementByExternalId getPlacementRequest=new IntimeServiceV3_2Stub.GetPlacementByExternalId();

getPlacementRequest.setId("WEB-PLC-001");

getPlacementRequest.setToken(ticket);

GetPlacementByExternalIdResponse placementResponse=stub.getPlacementByExternalId(getPlacementRequest);

Placement placement=placementResponse.get_return();


//identify the required rate

Rate rate1 = null;

for (Rate rate : placement.getRates()) {

if (rate.getName().equals("Standard Hours")) {

rate1 = rate;

}

}

Calendar cal = Calendar.getInstance(java.util.TimeZone.getTimeZone("GMT"));

cal.set(2017,9,1,0,0,0);

cal.set(Calendar.MILLISECOND, 0);


//create a timesheetSubmission

IntimeServiceV3_2Stub.Timesheet timesheetSubmission = new IntimeServiceV3_2Stub.Timesheet();

timesheetSubmission.setPlacementExternalRef(placement.getExternalId());

timesheetSubmission.setSubmitterId(placement.getWorker().getId()); //Whoever is creating the Timesheet

timesheetSubmission.setPeriodEndDate(cal.getTime());


//Add the Shifts

IntimeServiceV3_2Stub.Shift shift = new IntimeServiceV3_2Stub.Shift();

shift.setComment("Shift 1 comment");

shift.setDay(cal.getTimeInMillis()); //set the day the shift relates to

shift.setRateId(rate1.getId());


if (rate1.getTimesheetFields().equals("START_FINISH_BREAK")) {

//This rate requires start, finish and break times entered for the shift

Calendar calStart = Calendar.getInstance(java.util.TimeZone.getTimeZone("GMT"));

calStart.set(2017,9,1,0,0,0);

calStart.set(Calendar.MILLISECOND, 0);

calStart.set(Calendar.HOUR_OF_DAY, 8);

shift.setStartTime(calStart.getTimeInMillis());


Calendar calEnd = Calendar.getInstance(java.util.TimeZone.getTimeZone("GMT"));

calEnd.set(2017,9,1,0,0,0);

calStart.set(Calendar.MILLISECOND, 0);

calEnd.set(Calendar.HOUR_OF_DAY, 17);

shift.setFinishTime(calEnd.getTimeInMillis());

shift.setMealBreak(3600000L); //1 hour in milliseconds

} else if (rate1.getTimesheetFields().equals("HOURS")) {

shift.setHours(8 * 60 * 60 * 1000L);

} else if (rate1.getTimesheetFields().equals("DECIMAL")) {

shift.setDecimal(new BigDecimal(1));

} else if (rate1.getTimesheetFields().equals("DAY")) {

shift.setDecimal(new BigDecimal(1));

}

Shift[] shifts = new Shift[1];

shifts[0] = shift;

timesheetSubmission.setShifts(shifts);


IntimeServiceV3_2Stub.UpdateTimesheet updateTimesheetRequest=new IntimeServiceV3_2Stub.UpdateTimesheet();

updateTimesheetRequest.setToken(ticket);

updateTimesheetRequest.setTimesheet(timesheetSubmission);

UpdateTimesheetResponse updateTimesheetResponse=stub.updateTimesheet(updateTimesheetRequest);

Long timesheetId=updateTimesheetResponse.get_return();

System.out.println("Update Timesheet returned:"+timesheetId);

} catch (Exception e) {

System.out.println("Exception occurred: " + e);

}

Submit a Timesheet

try {

IntimeServiceV3_2Stub.SubmitTimesheet submitTimesheetRequest=new IntimeServiceV3_2Stub.SubmitTimesheet();

submitTimesheetRequest.setToken(ticket);

submitTimesheetRequest.setTimesheetId(<timesheet_id>);

SubmitTimesheetResponse submitTimesheetResponse=stub.submitTimesheet(submitTimesheetRequest);

System.out.println("Submit Timesheet returned: "+submitTimesheetResponse.get_return());

} catch (Exception e) {

System.out.println("Exception occurred: " + e);

}

Get a Single Sign-on token

try {

GetSingleSignOnToken ss=new GetSingleSignOnToken();

ss.setToken(ticket);

ss.setUsername(<username>);

ss.setTimeToLiveSeconds(360);

GetSingleSignOnTokenResponse ssResp=stub.getSingleSignOnToken(ss);

if (ssResp!=null) {

System.out.println("Single Sign on Token: " + ssResp.get_return());

}

//Can now append the token to any InTime URL to use access it without logging in. E.g.

//https://demo.in-time.co.uk/placement/show?placement=<placement_id>&ticket=<token>

} catch (Exception e) {

System.out.println("Exception occurred: " + e);

}


Limited Company Details

Limited Company type workers have additional information that relate to their limited company. To provide access to this an associated LimitedCompany object and a LtdCompanyContact  object were added to the Worker object.

The following RSM InTime data fields appear in both the Worker object and the associated LimitedCompany Object: AccountsReference (AccountsRef), VATCode, DefaultPaymentCurrency (Currency), NominalCode, ExpensesNominalCode, Consolidation and Grouping.

Version 2.9 and earlier: Both the LtdCompanyContact object and the LimitedCompany.InvoiceContact are populated when reading a Worker from RSM InTime. When creating or updating RSM InTime you should set the fields in the ltdCompanyContact object for the contact name, email, phone and address details.

The following fields should be read from and updated on the Worker base object: AccountsRef, DefaultPaymentCurrency, NominalCode, ExpensesNominalCode, Consolidation and Grouping.

The VAT Code should be read from and updated via the associated LimitedCompany object.

Version 3.0 as of this version the situation is simplified. There is no LtdCompanyContact object on the worker. The Limited Company Contact details (name, email, address) should be read and updated via the LimitedCompany.InvoiceContact object. All the following fields can only be read from and updated from the Worker base object: AccountsRef, VATCode, DefaultPaymentCurrency, NominalCode, ExpensesNominalCode, Consolidation and Grouping. Note: Both Worker and LimitedCompany objects have timesheetsOnInvoices field - the one specified in the LimitedCompany will take precedence over Worker. 

Constants

Whilst using the RSM InTime Web Services, some fields have expected values from a range of constants. These are detailed below.

FieldConstant

Comment

Notes
Client


invoicePeriod0Weekly

1Two-Weekly

2Four-Weekly

3Calendar Monthly

44-4-5

5Other




InvoiceDeliveryMethod (howSendInvoices)0PostInvoice delivery method

1Email

2Fax

3Not sent




timesheetsOnInvoices0Timesheets On Invoices

1Timesheets Not On Invoices




paperOnInvoices-1Agency Default

0No Attachments

1Attach Paper Timesheets

2Attach Expense Group Paper

4Attach Expense Receipts Paper

<sum of the above>Attach the appropriate paperFor example, 5 to attach timesheets and receipts




consolidation

Code Required

String[] cConsolidation = new String[] { "charge-payment-term","destination","source","charge-currency","sales-tax-code","client" };
client.setConsolidation(cConsolidation);

Everything Goes On One Invoice



Code Required

String[] cConsolidation = new String[] { "charge-payment-term","destination","source","charge-currency","sales-tax-code","client","sheet-type" };
client.setConsolidation(cConsolidation);

Expenses Go On On Invoice And Expenses Go On Another



Code Required

String[] cConsolidation = new String[] { "charge-payment-term","destination","source","charge-currency","sales-tax-code","client","placement" };
client.setConsolidation(cConsolidation);

Each Placement is Invoiced Separately



Code Required

String[] cConsolidation = new String[] { "charge-payment-term","destination","source","charge-currency","sales-tax-code","client","sheet" };
client.setConsolidation(cConsolidation);

Each Timesheet Or Expense Item Is Invoiced Separately



Code Required

String[] cConsolidation = new String[] { "charge-payment-term","destination","source","charge-currency","sales-tax-code","client",”worker” };
client.setConsolidation(cConsolidation);

Each Candidate Is Invoiced Separately






grouping

Code Required

String[] cGrouping = new String[] { "sheet-rate" };

client.setGrouping(cGrouping);

Sheet Rate




Worker


workerTypepayeFor PAYE Workers

ltdFor Ltd Company Workers

external-contractorFor Non Ltd Company Workers

cisFor CIS Workers

umbFor Workers operating through an UmbrellaYou must also reference the umbrella against the worker, otherwise the worker will appear as LTD.

ir35For workers inside scope of IR35 (deemed)




cisBusinessTypeSoleTrader


Company


Trust


Partnership





cisPercentage0


20


30





paymentFrequencyweekly


monthly


<InPay Payroll Name>If InPay connected, for PAYE workers, use the InPay Payroll Name




limitedCompany.timesheetsOnInvoices

0Timesheets On Invoices

1Timesheets Not On Invoices




limitedCompany.paperOnInvoices-1Agency Default

0No Attachments

1Attach Paper Timesheets

2Attach Expense Group Paper

4Attach Expense Receipts Paper

<sum of the above>Attach the appropriate paperFor example, 5 to attach timesheets and receipts




genderM


F





limitedCompany.invoicePeriod0Weekly

1Two-Weekly

2Four-Weekly

3Calendar Monthly

44-4-5

5Other
InvoiceDeliveryMethod (howSendInvoices)0PostInvoice delivery method1Email2Fax3Not senttimesheetsOnInvoices0Timesheets On Invoices1Timesheets Not On InvoicespaperOnInvoices-1Agency Default0No Attachments1Attach Paper Timesheets2Attach Expense Group Paper4Attach Expense Receipts Paper<sum of the above>Attach the appropriate paperFor example, 5 to attach timesheets and receipts





Payment Methodbacs
NOT CASE SENSITIVE

cheque
NOT CASE SENSITIVE

cash
NOT CASE SENSITIVE

chaps
NOT CASE SENSITIVE

ach
NOT CASE SENSITIVE

international
NOT CASE SENSITIVE

building society
NOT CASE SENSITIVE




sendLtdCompanyTimesheets0

Do not send a copy of the timesheets to the worker or provider 



1Only send a copy of timesheets to the worker's ltd company email address

2Send a copy of timesheets to the worker's provider if they have one, otherwise send it to the worker

3Send copies to both the worker and provider




consolidation

Code Required

String[]

cConsolidation

wConsolidation = new String[] {

"charge-payment-term",

"destination","source","

charge

pay-currency","

sales

purchase-tax-code","

client

worker" };

client

worker.setConsolidation(

cConsolidation

wConsolidation);

Everything Goes On One Invoice



Code Required

String[]

cConsolidation

wConsolidation = new String[] {

"charge-payment-term

"

,"

destination","source","

charge

pay-currency","

sales

purchase-tax-code","

client

worker","sheet-type" };

client

worker.setConsolidation(

cConsolidation

wConsolidation);

Expenses Go On On Invoice And Expenses Go On Another



Code Required

String[]

cConsolidation = new String[] { "charge-payment-term","destination","source","charge-currency","sales-tax-code","client","placement" };
client.setConsolidation(cConsolidation);

Each Placement is Invoiced Separately

Code Required

String[] cConsolidation

wConsolidation = new String[] {

"charge-payment-term

"

,"

destination","source","

charge

pay-currency","

sales

purchase-tax-code","

client

worker","

sheet

placement" };

client

worker.setConsolidation(

cConsolidation

wConsolidation);

Each

Timesheet Or Expense Item Is

Placement is Invoiced Separately



Code Required

String[]

cConsolidation

wConsolidation = new String[] { "

charge-payment-term","

destination","source","

charge

pay-currency","

sales

purchase-tax-code","

client

worker",

”worker”

"sheet" };

client

worker.setConsolidation(

cConsolidation

wConsolidation);

Each

Candidate

Timesheet Or Expense Item Is Invoiced Separately






grouping

Code Required

String[]

cGrouping

wGrouping = new String[

] { "sheet-rate" };

client.setGrouping(cGrouping);

Sheet RateWorkerworkerTypepayeFor PAYE WorkersltdFor Ltd Company Workersexternal-contractorFor Non Ltd Company WorkerscisFor CIS WorkersumbFor Workers operating through an UmbrellaYou must also reference the umbrella against the worker, otherwise the worker will appear as LTD.ir35For workers inside scope of IR35 (deemed)cisBusinessTypeSoleTraderCompanyTrustPartnershipcisPercentage02030paymentFrequencyweeklymonthly<InPay Payroll Name>If InPay connected, for PAYE workers, use the InPay Payroll Name

limitedCompany.timesheetsOnInvoices

0Timesheets On Invoices1Timesheets Not On InvoiceslimitedCompany.paperOnInvoices-1Agency Default0No Attachments1Attach Paper Timesheets2Attach Expense Group Paper4Attach Expense Receipts Paper<sum of the above>Attach the appropriate paperFor example, 5 to attach timesheets and receiptsgenderMFlimitedCompany.invoicePeriod0Weekly1Two-Weekly2Four-Weekly3Calendar Monthly44-4-55OtherPayment MethodbacsNOT CASE SENSITIVEchequeNOT CASE SENSITIVEcashNOT CASE SENSITIVEchapsNOT CASE SENSITIVEachNOT CASE SENSITIVEinternationalNOT CASE SENSITIVEbuilding societyNOT CASE SENSITIVEsendLtdCompanyTimesheets0

Do not send a copy of the timesheets to the worker or provider 

1Only send a copy of timesheets to the worker's ltd company email address2Send a copy of timesheets to the worker's provider if they have one, otherwise send it to the worker3Send copies to both the worker and providerconsolidation

Code Required

String[] wConsolidation = new String[] { "destination","source","pay-currency","purchase-tax-code","worker" };
worker.setConsolidation(wConsolidation);

Everything Goes On One Invoice

Code Required

String[] wConsolidation = new String[] { "destination","source","pay-currency","purchase-tax-code","worker","sheet-type" };
worker.setConsolidation(wConsolidation);

Expenses Go On On Invoice And Expenses Go On Another

Code Required

String[] wConsolidation = new String[] { "destination","source","pay-currency","purchase-tax-code","worker","placement" };
worker.setConsolidation(wConsolidation);

Each Placement is Invoiced Separately

Code Required

String[] wConsolidation = new String[] { "destination","source","pay-currency","purchase-tax-code","worker","sheet" };
worker.setConsolidation(wConsolidation);

Each Timesheet Or Expense Item Is Invoiced Separately

grouping

Code Required

String[] wGrouping = new String[] { "sheet","sheet-rate" };

worker.setGrouping(wGrouping);

Sheet RatePlacementlayoutstandardSee Maintaining PlacementscalendartimesheetDateCalculatorweeklySee Maintaining Placements. You can see all possible values for this in the ui.monthly<many more>See UI for all options.

] { "sheet","sheet-rate" };

worker.setGrouping(wGrouping);

Sheet Rate
statementA

StatementA
The 8 values represent the following:
Starter Declaration A B or C
Student Loan Not Repaid Y or N
Student Loan Monthly Payments Y or N
Student Loan Type 1,2,4 or Space
Student Loan Before April 6 Y or N
Post Graduate Loan Not Repaid Y or N
Post Graduate Loan Monthly Payments Y or N
Post Graduate Loan Before April 6 Y or N

Example: "ANN NN"
Means....
Starter Declaration: A
Student Loan Not Repaid: N
Student Loan Monthly Payments: N
Student Loan Type: Space (None)
Student Loan Before April 6: N
Post Graduate Loan Not Repaid: N
Post Graduate Loan Monthly Payments: N
Post Graduate Loan Before April 6: N


statementDAlways NN
engagementTypeNone/N,A,B,C,D,E,F,Z





Placement


layoutstandard
See Maintaining Placements

calendar





timesheetDateCalculator

Usual:

weekly (Default: Monday - Sunday)

monthly (Calendar: 1st - 28/29/30/31th)


Others:

weekly_tue-mon

weekly_wed-tue

weekly_thurs-wed

weekly_fri-thurs

weekly_sat-fri

weekly_sun-sat

two-weekly

two-weekly_tue-mon

two-weekly_wed-tue

two-weekly_thurs-wed

two-weekly_fri-thurs

two-weekly_sat-fri

two-weekly_sun-sat

two-weekly_timeplan

four-weekly

half-monthly-16th

monthly2nd

monthly3rd

monthly4th

monthly5th

monthly6th

monthly7th

monthly8th

monthly9th

monthly10th

monthly11th

monthly12th

monthly13th

monthly14th

monthly15th

monthly16th

monthly17th

monthly18th

monthly19th

monthly20th

monthly21st

monthly22th

monthly23th

monthly24th

monthly25th

monthly26th

monthly27th

monthly28th

half-monthly-15th

four-four-five

four-four-five-lastFri-old

four-four-five-lastFri

weekly-split

four-four-five-2ndLastFri

weekly_tue-mon-split

weekly_wed-tue-split

weekly_thurs-wed-split

weekly_fri-thurs-split

weekly_sat-fri-split

weekly_sun-sat-split

two-weekly-split

two-weekly-alt

four-weekly-split

two-weekly-split-alt


See Maintaining Placements




Rates


period60 / HFor hourly rates entered in hours format (hours only or start, break, finish).

1440 / FFor fixed rates of a specified duration entered in decimal format (decimal or tickbox)




periodDuration<any integer>The duration in minutes for the fixed rate (e.g. 60 for hourly rates, 480 for a daily rates (if daily rate it worth 8 hours)).




timePatterndefaultWill use the selected default time pattern

<any string>The string should match the name of a time pattern in the system




timesheetFieldsSTART_FINISH_BREAKEnter start, break, finishOnly when period above is 60

HOURSEnter hours onlyOnly when period above is 60

DECIMALEnter time as a decimalOnly when period above is 1440

DAYTickbox only (equivalent to entering decimals as 1.00)Only when period above is 1440

InvoiceAdjustmentSettings

(Company / Worker)




AdjustBy0Fixed Amount

1Percentage
AdjustPer0Per Worker

1Per Timesheet

2Per Invoice
AdjustType0Addition

1Deduction
ExpenseType


EntryMethod

0Gross valuePopulate the GrossValue and optionally the VatAmount field on an ExpenseItem with this entry method

1Net ValuePopulate the NetValue field on an ExpenseItem with this entry method

2Units and Unit netPopulate the Unit and UnitNet fields on an ExpenseItem with this entry method. E.g. Set Unit = 30 and UnitNet = 0.45 to claim 30 miles at 45p per mile.

3Units and NetPopulate the Unit and Net Value fields on an ExpenseItem with this entry method.




Timesheet


StatusgetTimesheetStatus()getStatus()

-1

DELETED



1

INCOMPLETE



2

SUBMITTED



3

APPROVED



5

COMPLETED



-2

MISSING



-3

REVERTED






InvoiceInfo (Invoice)


Invoice TypegetInvoiceDescription()


Advice Note


Client Invoice


Client Credit Note


Self Bill Invoice


Self Bill Credit Note


Supplier Invoice


Supplier Credit Note





Provider


consolidation

Code Required

String[] pConsolidation = new String[] { "destination","source","pay-currency","purchase-tax-code","ltd-co-provider" };
provider.setConsolidation(pConsolidation);

Everything Goes On One Invoice



Code Required

String[] pConsolidation = new String[] { "destination","source","pay-currency","purchase-tax-code","ltd-co-provider","sheet-type" };
provider.setConsolidation(pConsolidation);

Expenses Go On On Invoice And Expenses Go On Another



Code Required

String[] pConsolidation = new String[] { "destination","source","pay-currency","purchase-tax-code","ltd-co-provider","placement" };
provider.setConsolidation(pConsolidation);

Each Placement is Invoiced Separately



Code Required

String[] pConsolidation = new String[] { "destination","source","pay-currency","purchase-tax-code","ltd-co-provider","sheet" };
provider.setConsolidation(pConsolidation);

Each Timesheet Or Expense Item Is Invoiced Separately



Code Required

String[] pConsolidation = new String[] { "destination","source","pay-currency","purchase-tax-code","ltd-co-provider",”worker” };
provider.setConsolidation(pConsolidation);

Each Candidate Is Invoiced Separately






grouping

Code Required

String[] pGrouping = new String[] { "sheet-rate" };

provider.setGrouping(pGrouping);

Sheet Rate




invoicePeriod

0

Weekly

1

Two-Weekly

2

Four-Weekly

3

Calendar Monthly

4

4-4-5

5Other




timesheetsOnInvoices0Timesheets On Invoices

1Timesheets Not On Invoices




paperOnInvoices-1Agency Default

0No Attachments

1Attach Paper Timesheets

2Attach Expense Group Paper

4Attach Expense Receipts Paper

<sum of the above>Attach the appropriate paperFor example, 5 to attach timesheets and receipts