Versions Compared

Key

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

...

try{

IntimeServiceV2_0Stub.Placement placement = new IntimeServiceV2_0Stub.Placement();


//referencing existing participants by External Id

IntimeServiceV2_0Stub.Worker worker = new IntimeServiceV2_0Stub.Worker();

worker.setExternalId("WKR_001");

placement.setWorker(worker);


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

consultant.setExternalId("CONS_001");

placement.setConsultant(consultant);


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

client.setExternalId("CLIENT_001");

placement.setClient(client);


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

manager.setExternalId("MGR_001");

placement.setManager(manager);


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

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(2017, 3, 1, 0, 0, 0);

placement.setStart(cal1);

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

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

placement.setEnd(cal2);


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

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

rate1.setName("Standard Day");

rate1.setPay(new BigDecimal(99.99));

rate1.setCharge(new BigDecimal(111.11));

rate1.setPayElementCode("001");

rate1.setPeriod("fixed");

rate1.setPeriodDuration(480);

rate1.setPriorityOrder(0);

rate1.setTimePattern("DEFAULT");

rate1.setTimesheetFields("DECIMAL");

rate1.setSelectableByWorkers(true);

rates[0] = rate1;

placement.setRates(rates);


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

request.setToken(ticket);

request.setPlacement(placement);


IntimeServiceV2_0Stub.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);

}



Read a Placement

//test

try {

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

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

request.setToken(ticket);

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());

System.out.println("PurchaseOrderNum: " + placement.getPurchaseOrderNum());

System.out.println("SalesProject: " + placement.getSalesProject());

System.out.println("PurchaseBranch: " + placement.getPurchaseBranch());

System.out.println("CurrencyForCharge: " + placement.getCurrencyForCharge());

System.out.println("CurrencyForPayExpenses: " + placement.getCurrencyForPayExpenses());

System.out.println("CurrencyForPayTimesheets: " + placement.getCurrencyForPayTimesheets());

System.out.println("Perm: " + placement.getPerm());

System.out.println("TimesheetEmailApproval: " + placement.getTimesheetEmailApproval());

System.out.println("Timesheet layout: " + placement.getLayout());

System.out.println("Internal Agency Comments: " + placement.getInternalAgencyComments());

System.out.println("Holiday Accural Rate: " + placement.getHolidayAccuralRate());

System.out.println("Expenses Template: " + placement.getExpenseTemplate());

System.out.println("Charge Tax Code Override: " + placement.getChargeTaxCodeOverride());

System.out.println("Self Bill Tax Code Override: " + placement.getSelfBillTaxCodeOverride());

System.out.println("PAYEDeductionsOnLtd: " + placement.getPAYEDeductionsOnLtd());


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

Contact contact = placement.getInvoiceContactOverride();

Address address = contact.getAddress();


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

System.out.println(" Firstname: " + contact.getFirstname());

System.out.println(" Lastname: " + contact.getLastname());

System.out.println(" Email: " + contact.getEmail());

System.out.println(" Phone: " + contact.getPhone());

System.out.println(" Fax: " + contact.getFax());

System.out.println(" Mobile: " + contact.getMobile());


System.out.println("Address:");

System.out.println(" Line 1:" + address.getLine1());

System.out.println(" Line 2:" + address.getLine2());

System.out.println(" Town:" + address.getTown());

System.out.println(" County:" + address.getCounty());

System.out.println(" Postcode: " + address.getPostcode());

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

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

}


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

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

System.out.println("Rate Name:" + rate.getName());

System.out.println("Pay:" + rate.getPay());

System.out.println("Charge:" + rate.getCharge());

System.out.println("Priority:" + rate.getPriorityOrder());

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

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

System.out.println("PeriodDuration:" + rate.getPeriodDuration());

System.out.println("SelectableByWorkers:" + rate.getSelectableByWorkers());

System.out.println("TimePattern:" + rate.getTimePattern());

System.out.println("TimesheetFields:" + rate.getTimesheetFields());

System.out.println("PayElementCode:" + rate.getPayElementCode());

System.out.println("Payable:" + rate.getPayable());

System.out.println("Chargeable:" + rate.getChargeable());

System.out.println("Taxable:" + rate.getTaxable());

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

}

}


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

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

System.out.println("\nCommission UserID:"+split.getUserId()+" Percentage:"+split.getWeight());

}

}


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

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

System.out.println("Alternative Manager:" + altMan.getFirstname() + " " + altMan.getLastname());

System.out.println("External Id: " + altMan.getExternalId() + " Internal ID:" + altMan.getId());

}

}

}

} catch (java.lang.Exception e) {

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

}


- update timesheet



- ? submitTimesheet

...