Send employee hours transaction to CentralSquare (single row)
This Fusion API can be used by the third-party to create a single row inside the Employee Hours (PRHOURS) table.
Name | Type | Length | Description |
---|---|---|---|
empUnqKey | System.String | 10 | [Required] Employee unique key (numeric) |
hrsTyp | System.String | 2 | [Required] Hours type code |
hrsQty | System.String | 8 | [Required] Hours quantity (numeric – 0000.000 format) |
dateCen | System.String | 1 | [Required] Daily hours date – century (numeric) |
dateYr | System.String | 2 | [Required] Daily hours date – year (numeric) |
dateMth | System.String | 2 | [Required] Daily hours date – month (numeric) |
dateDay | System.String | 2 | [Required] Daily hours date – day (numeric) |
payFreq | System.String | 2 | Pay frequency code |
payPrd | System.String | 2 | Pay period number (numeric) |
rate | System.String | 8 | Current hourly rate (numeric – 000.0000 format) |
hrsAmt | System.String | 9 | Hours amount (numeric – 000000.00 format) |
dept | System.String | 2 | Department number (numeric) |
div | System.String | 2 | Division number (numeric) |
act | System.String | 2 | Activity number (numeric) |
proj | System.String | 6 | Project |
app | System.String | 2 | Application prefix |
wrkReq | System.String | 9 | Work request number - Used for in conjunction with WF application |
jobOrd | System.String | 3 | Job order number (numeric) - Used in conjunction with WF application |
shift | System.String | 1 | Shift (numeric) |
shfAmt | System.String | 8 | Shift amount (numeric – 00000.00 format) |
fund | System.String | 3 | Fund number (numeric) |
element | System.String | 2 | Element number (numeric) |
object | System.String | 2 | Object number (numeric) |
cycle | System.String | 4 | FLSA cycle number (numeric) |
subSSN | System.String | 9 | Substitute SSN (numeric) |
subFlg | System.String | 1 | Substitute flag |
hrsAOvr | System.String | 50 | Hours G/L account override |
adRtFlg | System.String | 1 | Additional rate flag |
trnPos | System.String | 5 | Transaction position number (numeric) |
equipNo | System.String | 5 | Equipment number (numeric) |
equipSq | System.String | 5 | Equipment sequence (numeric) |
cmtKey | System.String | 7 | Comment key (numeric) |
POST http://localhost/FusionServices/v3/Naviline/Payroll/EmpHoursTable
Name | Description |
---|---|
ErrorCode | 0000 |
ErrorDescription | Successful completion - row added. |
Error Code | Error Message |
---|---|
0000 | Successful completion – row added |
0001 | Invalid environment parameters |
0002 | Invalid pay frequency |
0003 | Invalid employee unique key |
0004 | Invalid hours type |
0005 | Hours quantity cannot be zero |
0006 | Daily hours date (CYYMMDD – combination of date values is invalid) |
0007 | Employee unique key is required |
using System.Net;
using Newtonsoft.Json.Linq;
public void MethodName(parms)
{
string uri = "http://localhost/FusionServices/v3/Naviline/Payroll/EmpHoursTable";
System.Collections.Specialized.NameValueCollection postParms =
new System.Collections.Specialized.NameValueCollection();
// Set paramater values
postParms.Add("empUnqKey",System.Web.HttpUtility.UrlEncode("584"));
postParms.Add("hrsTyp",System.Web.HttpUtility.UrlEncode("AD"));
postParms.Add("hrsQty",System.Web.HttpUtility.UrlEncode("8.000"));
postParms.Add("dateCen",System.Web.HttpUtility.UrlEncode("1"));
postParms.Add("dateYr",System.Web.HttpUtility.UrlEncode("25"));
postParms.Add("dateMth",System.Web.HttpUtility.UrlEncode("02"));
postParms.Add("dateDay",System.Web.HttpUtility.UrlEncode("28"));
WebClient req = new WebClient();
wc.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
wc.Headers.Set("X-APPID", "YOURID");
wc.Headers.Set("X-APPKEY", "YOURKEY");
byte[] responseBytes = wc.UploadValues(new Uri(uri), "POST", postParms);
string stringResult = Encoding.UTF8.GetString(responseBytes);
JObject response = JObject.Parse(stringResult);
string error = response["OutputParms"]["ErrorCode"].ToString();
if (error == "0000")
{
// TODO - YOUR CODE HERE
}
}
using System;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.Collections.Specialized;
using FusionServiceHelper.Models;
// NOTE: Use the namespace generated when you add the class, so that it is correct.
namespace FusionRazor.Models
{
public class PostEmpHoursTable
{
// Add property for each input param in order to map a field to it
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,10}$).*", ErrorMessage = "Must be 10 characters or less. ")]
public string empUnqKey{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,2}$).*", ErrorMessage = "Must be 2 characters or less. ")]
public string hrsTyp{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,8}$).*", ErrorMessage = "Must be 8 characters or less. ")]
public string hrsQty{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,1}$).*", ErrorMessage = "Must be 1 characters or less. ")]
public string dateCen{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,2}$).*", ErrorMessage = "Must be 2 characters or less. ")]
public string dateYr{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,2}$).*", ErrorMessage = "Must be 2 characters or less. ")]
public string dateMth{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,2}$).*", ErrorMessage = "Must be 2 characters or less. ")]
public string dateDay{get; set;}
[RegularExpression("^(?=.{0,2}$).*", ErrorMessage = "Must be 2 characters or less. ")]
public string payFreq{get; set;}
[RegularExpression("^(?=.{0,2}$).*", ErrorMessage = "Must be 2 characters or less. ")]
public string payPrd{get; set;}
[RegularExpression("^(?=.{0,8}$).*", ErrorMessage = "Must be 8 characters or less. ")]
public string rate{get; set;}
[RegularExpression("^(?=.{0,9}$).*", ErrorMessage = "Must be 9 characters or less. ")]
public string hrsAmt{get; set;}
[RegularExpression("^(?=.{0,2}$).*", ErrorMessage = "Must be 2 characters or less. ")]
public string dept{get; set;}
[RegularExpression("^(?=.{0,2}$).*", ErrorMessage = "Must be 2 characters or less. ")]
public string div{get; set;}
[RegularExpression("^(?=.{0,2}$).*", ErrorMessage = "Must be 2 characters or less. ")]
public string act{get; set;}
[RegularExpression("^(?=.{0,6}$).*", ErrorMessage = "Must be 6 characters or less. ")]
public string proj{get; set;}
[RegularExpression("^(?=.{0,2}$).*", ErrorMessage = "Must be 2 characters or less. ")]
public string app{get; set;}
[RegularExpression("^(?=.{0,9}$).*", ErrorMessage = "Must be 9 characters or less. ")]
public string wrkReq{get; set;}
[RegularExpression("^(?=.{0,3}$).*", ErrorMessage = "Must be 3 characters or less. ")]
public string jobOrd{get; set;}
[RegularExpression("^(?=.{0,1}$).*", ErrorMessage = "Must be 1 characters or less. ")]
public string shift{get; set;}
[RegularExpression("^(?=.{0,8}$).*", ErrorMessage = "Must be 8 characters or less. ")]
public string shfAmt{get; set;}
[RegularExpression("^(?=.{0,3}$).*", ErrorMessage = "Must be 3 characters or less. ")]
public string fund{get; set;}
[RegularExpression("^(?=.{0,2}$).*", ErrorMessage = "Must be 2 characters or less. ")]
public string element{get; set;}
[RegularExpression("^(?=.{0,2}$).*", ErrorMessage = "Must be 2 characters or less. ")]
public string object{get; set;}
[RegularExpression("^(?=.{0,4}$).*", ErrorMessage = "Must be 4 characters or less. ")]
public string cycle{get; set;}
[RegularExpression("^(?=.{0,9}$).*", ErrorMessage = "Must be 9 characters or less. ")]
public string subSSN{get; set;}
[RegularExpression("^(?=.{0,1}$).*", ErrorMessage = "Must be 1 characters or less. ")]
public string subFlg{get; set;}
[RegularExpression("^(?=.{0,50}$).*", ErrorMessage = "Must be 50 characters or less. ")]
public string hrsAOvr{get; set;}
[RegularExpression("^(?=.{0,1}$).*", ErrorMessage = "Must be 1 characters or less. ")]
public string adRtFlg{get; set;}
[RegularExpression("^(?=.{0,5}$).*", ErrorMessage = "Must be 5 characters or less. ")]
public string trnPos{get; set;}
[RegularExpression("^(?=.{0,5}$).*", ErrorMessage = "Must be 5 characters or less. ")]
public string equipNo{get; set;}
[RegularExpression("^(?=.{0,5}$).*", ErrorMessage = "Must be 5 characters or less. ")]
public string equipSq{get; set;}
[RegularExpression("^(?=.{0,7}$).*", ErrorMessage = "Must be 7 characters or less. ")]
public string cmtKey{get; set;}
public PostEmpHoursTable()
{
//Set any defaults here
}
}
}
@* NOTE: Use Add->View to add the View. *@
@* NOTE: Check the 'Create strongly-typed view checkbox, and select the PostEmpHoursTable class. *@
@* NOTE: Select Edit as the Scaffold template. *@
@* NOTE: Use the @model line that is generated at the top. Replace the rest with the lines below.
@model FusionRazor.Models.PostEmpHoursTable
@{
ViewBag.Title = "PostEmpHoursTable";
}
<h2>PostEmpHoursTable</h2>
@using (Html.BeginForm()) {
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<fieldset>
<legend>PostEmpHoursTable</legend>
<div class="editor-label">
@Html.LabelFor(model => model.empUnqKey)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.empUnqKey)
@Html.ValidationMessageFor(model => model.empUnqKey)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.hrsTyp)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.hrsTyp)
@Html.ValidationMessageFor(model => model.hrsTyp)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.hrsQty)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.hrsQty)
@Html.ValidationMessageFor(model => model.hrsQty)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.dateCen)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.dateCen)
@Html.ValidationMessageFor(model => model.dateCen)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.dateYr)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.dateYr)
@Html.ValidationMessageFor(model => model.dateYr)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.dateMth)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.dateMth)
@Html.ValidationMessageFor(model => model.dateMth)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.dateDay)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.dateDay)
@Html.ValidationMessageFor(model => model.dateDay)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.payFreq)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.payFreq)
@Html.ValidationMessageFor(model => model.payFreq)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.payPrd)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.payPrd)
@Html.ValidationMessageFor(model => model.payPrd)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.rate)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.rate)
@Html.ValidationMessageFor(model => model.rate)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.hrsAmt)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.hrsAmt)
@Html.ValidationMessageFor(model => model.hrsAmt)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.dept)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.dept)
@Html.ValidationMessageFor(model => model.dept)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.div)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.div)
@Html.ValidationMessageFor(model => model.div)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.act)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.act)
@Html.ValidationMessageFor(model => model.act)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.proj)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.proj)
@Html.ValidationMessageFor(model => model.proj)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.app)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.app)
@Html.ValidationMessageFor(model => model.app)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.wrkReq)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.wrkReq)
@Html.ValidationMessageFor(model => model.wrkReq)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.jobOrd)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.jobOrd)
@Html.ValidationMessageFor(model => model.jobOrd)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.shift)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.shift)
@Html.ValidationMessageFor(model => model.shift)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.shfAmt)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.shfAmt)
@Html.ValidationMessageFor(model => model.shfAmt)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.fund)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.fund)
@Html.ValidationMessageFor(model => model.fund)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.element)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.element)
@Html.ValidationMessageFor(model => model.element)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.object)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.object)
@Html.ValidationMessageFor(model => model.object)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.cycle)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.cycle)
@Html.ValidationMessageFor(model => model.cycle)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.subSSN)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.subSSN)
@Html.ValidationMessageFor(model => model.subSSN)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.subFlg)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.subFlg)
@Html.ValidationMessageFor(model => model.subFlg)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.hrsAOvr)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.hrsAOvr)
@Html.ValidationMessageFor(model => model.hrsAOvr)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.adRtFlg)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.adRtFlg)
@Html.ValidationMessageFor(model => model.adRtFlg)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.trnPos)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.trnPos)
@Html.ValidationMessageFor(model => model.trnPos)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.equipNo)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.equipNo)
@Html.ValidationMessageFor(model => model.equipNo)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.equipSq)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.equipSq)
@Html.ValidationMessageFor(model => model.equipSq)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.cmtKey)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.cmtKey)
@Html.ValidationMessageFor(model => model.cmtKey)
</div>
<p>
<input type="submit" value="Submit"/>
</p>
</fieldset>
}
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}
using System;
using System.Collections.Specialized;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using FusionServiceHelper.Models;
// NOTE: Replace 'MyController' with the name of your controller.
//
// GET: /MyController/PostEmpHoursTable
public ActionResult PostEmpHoursTable()
{
// Create a new instance of the model to pick up any default values.
PostEmpHoursTable model = new PostEmpHoursTable();
// pass model to set to default values
// NOTE: Change 'MyFolderPath' to the path to the .cshtml file.
return View("~/Views/MyFolderPath/PostEmpHoursTable.cshtml", model);
}
//
// POST: /MyController/PostEmpHoursTable
[HttpPost]
public ActionResult PostEmpHoursTable(FormCollection collection)
{
string url = "v3/Naviline/Payroll/EmpHoursTable";
// Get the value from each input field
NameValueCollection inputParms = new NameValueCollection();
inputParms.Add("empUnqKey", collection["empUnqKey"]);
inputParms.Add("hrsTyp", collection["hrsTyp"]);
inputParms.Add("hrsQty", collection["hrsQty"]);
inputParms.Add("dateCen", collection["dateCen"]);
inputParms.Add("dateYr", collection["dateYr"]);
inputParms.Add("dateMth", collection["dateMth"]);
inputParms.Add("dateDay", collection["dateDay"]);
inputParms.Add("payFreq", collection["payFreq"]);
inputParms.Add("payPrd", collection["payPrd"]);
inputParms.Add("rate", collection["rate"]);
inputParms.Add("hrsAmt", collection["hrsAmt"]);
inputParms.Add("dept", collection["dept"]);
inputParms.Add("div", collection["div"]);
inputParms.Add("act", collection["act"]);
inputParms.Add("proj", collection["proj"]);
inputParms.Add("app", collection["app"]);
inputParms.Add("wrkReq", collection["wrkReq"]);
inputParms.Add("jobOrd", collection["jobOrd"]);
inputParms.Add("shift", collection["shift"]);
inputParms.Add("shfAmt", collection["shfAmt"]);
inputParms.Add("fund", collection["fund"]);
inputParms.Add("element", collection["element"]);
inputParms.Add("object", collection["object"]);
inputParms.Add("cycle", collection["cycle"]);
inputParms.Add("subSSN", collection["subSSN"]);
inputParms.Add("subFlg", collection["subFlg"]);
inputParms.Add("hrsAOvr", collection["hrsAOvr"]);
inputParms.Add("adRtFlg", collection["adRtFlg"]);
inputParms.Add("trnPos", collection["trnPos"]);
inputParms.Add("equipNo", collection["equipNo"]);
inputParms.Add("equipSq", collection["equipSq"]);
inputParms.Add("cmtKey", collection["cmtKey"]);
try
{
// Send the request
FusionServiceRequest request = new FusionServiceRequest();
FusionServiceResult result = request.Post(url, inputParms);
return View("Result", result);
}
catch(Exception e)
{
HandleErrorInfo info = new HandleErrorInfo(e, "MyController", "PostEmpHoursTable");
return View("Error", info);
}
}