Class WageTypeFunction
Wage type function
Inheritance
Implements
Inherited Members
Namespace: PayrollEngine.Client.Scripting.Function
Assembly: PayrollEngine.Client.Scripting.dll
Syntax
public abstract class WageTypeFunction : PayrunFunction, IDisposable
Remarks
This class extends PayrunFunction with wage-type-specific facilities. It is the common ancestor of WageTypeValueFunction (value calculation) and WageTypeResultFunction (result post-processing).
Key features:
- Identity: WageTypeNumber, WageTypeName, WageTypeDescription, WageTypeCalendar.
- Cross-wage-type access: the WageType indexer reads the computed value of another wage type by number; Collector reads a named collector value.
- Result attributes: Attribute / AttributePayrollValue store arbitrary metadata on the wage type result for downstream consumption by reports.
- Custom results: AddCustomResult(string, decimal, IEnumerable<string>, Dictionary<string, object>, ValueType?, string) writes supplementary payroll result entries (e.g. cost-centre breakdowns) alongside the primary result.
- Retro runs: ScheduleRetroPayrun(DateTime, IEnumerable<string>) triggers a correction run for a past period. Cannot be combined with Exchange-import payrun invocations.
Constructors
View SourceWageTypeFunction(object)
Initializes a new instance with the function runtime
Declaration
protected WageTypeFunction(object runtime)
Parameters
| Type | Name | Description |
|---|---|---|
| object | runtime | The runtime |
WageTypeFunction(string)
New function instance without runtime (scripting development)
Declaration
protected WageTypeFunction(string sourceFileName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sourceFileName | The name of the source file |
Properties
View SourceAttribute
Get or set a wage type result attribute value
Declaration
public ScriptDictionary<string, object> Attribute { get; }
Property Value
| Type | Description |
|---|---|
| ScriptDictionary<string, object> |
AttributePayrollValue
Get or set a wage type result attribute PayrollValue
Declaration
public ScriptDictionary<string, PayrollValue> AttributePayrollValue { get; }
Property Value
| Type | Description |
|---|---|
| ScriptDictionary<string, PayrollValue> |
Collector
Get a collector value by collector name
Declaration
public ScriptDictionary<string, decimal> Collector { get; }
Property Value
| Type | Description |
|---|---|
| ScriptDictionary<string, decimal> |
CollectorGroups
The wage type collector groups
Declaration
public string[] CollectorGroups { get; }
Property Value
| Type | Description |
|---|---|
| string[] |
Collectors
The wage type collectors
Declaration
public string[] Collectors { get; }
Property Value
| Type | Description |
|---|---|
| string[] |
WageType
Get a wage type value by wage type number
Declaration
public ScriptDictionary<decimal, decimal> WageType { get; }
Property Value
| Type | Description |
|---|---|
| ScriptDictionary<decimal, decimal> |
WageTypeCalendar
The wage type calendar
Declaration
[ActionProperty("Wage type calendar", null)]
public string WageTypeCalendar { get; }
Property Value
| Type | Description |
|---|---|
| string |
WageTypeDescription
The wage type description
Declaration
[ActionProperty("Wage type description", null)]
public string WageTypeDescription { get; }
Property Value
| Type | Description |
|---|---|
| string |
WageTypeName
The wage type name
Declaration
[ActionProperty("Wage type name", null)]
public string WageTypeName { get; }
Property Value
| Type | Description |
|---|---|
| string |
WageTypeNumber
The wage type number
Declaration
[ActionProperty("Wage type number", null)]
public decimal WageTypeNumber { get; }
Property Value
| Type | Description |
|---|---|
| decimal |
Methods
View SourceAddCustomResult(string, IEnumerable<string>, Dictionary<string, object>, ValueType?, string)
Add wage type custom result from case field values, using the current period
Declaration
public void AddCustomResult(string source, IEnumerable<string> tags = null, Dictionary<string, object> attributes = null, ValueType? valueType = null, string culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | source | The value source |
| IEnumerable<string> | tags | The result tags |
| Dictionary<string, object> | attributes | The wage type custom result attributes |
| ValueType? | valueType | The result value type (numeric), default is the wage type value type |
| string | culture | The result culture |
AddCustomResult(string, DateTime, DateTime, IEnumerable<string>, Dictionary<string, object>, ValueType?, string)
Add wage type custom result from case field values
Declaration
public void AddCustomResult(string source, DateTime startDate, DateTime endDate, IEnumerable<string> tags = null, Dictionary<string, object> attributes = null, ValueType? valueType = null, string culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | source | The value source |
| DateTime | startDate | The moment within the start period |
| DateTime | endDate | The moment within the end period |
| IEnumerable<string> | tags | The result tags |
| Dictionary<string, object> | attributes | The wage type custom result attributes |
| ValueType? | valueType | The result value type (numeric), default is the wage type value type |
| string | culture | The result culture |
AddCustomResult(string, decimal, IEnumerable<string>, Dictionary<string, object>, ValueType?, string)
Add wage type custom result from case field values, using the current period
Declaration
public void AddCustomResult(string source, decimal value, IEnumerable<string> tags = null, Dictionary<string, object> attributes = null, ValueType? valueType = null, string culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | source | The value source |
| decimal | value | The period value |
| IEnumerable<string> | tags | The result tags |
| Dictionary<string, object> | attributes | The wage type custom result attributes |
| ValueType? | valueType | The result value type (numeric), default is the wage type value type |
| string | culture | The result culture |
AddCustomResult(string, decimal, DateTime, DateTime, IEnumerable<string>, Dictionary<string, object>, ValueType?, string)
Add a wage type custom result
Declaration
public void AddCustomResult(string source, decimal value, DateTime startDate, DateTime endDate, IEnumerable<string> tags = null, Dictionary<string, object> attributes = null, ValueType? valueType = null, string culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | source | The value source |
| decimal | value | The period value |
| DateTime | startDate | The start date |
| DateTime | endDate | The end date |
| IEnumerable<string> | tags | The result tags |
| Dictionary<string, object> | attributes | The wage type custom result attributes |
| ValueType? | valueType | The result value type (numeric), default is the wage type value type |
| string | culture | The result culture |
DisableCollector(string)
Disable collector for the current employee job
Declaration
public void DisableCollector(string collectorName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | collectorName | Name of the collector |
EnableCollector(string)
Reenable disabled collector for the current employee job
Declaration
public void EnableCollector(string collectorName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | collectorName | Name of the collector |
GetCollector(string)
Gets the collector value
Declaration
public decimal GetCollector(string collectorName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | collectorName | Name of the collector |
Returns
| Type | Description |
|---|---|
| decimal | The collector value |
GetCollectorCurrentConsolidatedValue(CollectorConsolidatedResultQuery)
Get consolidated and current period employee collector results by query
Declaration
public decimal GetCollectorCurrentConsolidatedValue(CollectorConsolidatedResultQuery query)
Parameters
| Type | Name | Description |
|---|---|---|
| CollectorConsolidatedResultQuery | query | The result query |
Returns
| Type | Description |
|---|---|
| decimal | Consolidated employee collector results |
GetCollectorValue(string)
Get collector value
Declaration
[ActionParameter("name", "The collector name", new string[] { "String" }, null, null)]
[WageTypeAction("GetCollectorValue", "Get collector value", new string[] { "WageType" })]
public ActionValue GetCollectorValue(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Collector name |
Returns
| Type | Description |
|---|---|
| ActionValue |
GetResultAttribute(string)
Get wage result attribute
Declaration
public object GetResultAttribute(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The attribute name |
Returns
| Type | Description |
|---|---|
| object |
GetResultAttribute<T>(string, T)
Get wage result attribute typed value
Declaration
public T GetResultAttribute<T>(string attributeName, T defaultValue = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | attributeName | |
| T | defaultValue |
Returns
| Type | Description |
|---|---|
| T |
Type Parameters
| Name | Description |
|---|---|
| T |
GetResultTags()
Get the wage type result tags
Declaration
public List<string> GetResultTags()
Returns
| Type | Description |
|---|---|
| List<string> | The wage type result tags |
GetWageType(decimal)
Gets the wage type value
Declaration
public decimal GetWageType(decimal wageTypeNumber)
Parameters
| Type | Name | Description |
|---|---|---|
| decimal | wageTypeNumber | The wage type number |
Returns
| Type | Description |
|---|---|
| decimal | The wage type value |
GetWageType(string)
Gets the wage type value
Declaration
public decimal GetWageType(string wageTypeName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | wageTypeName | The wage type name |
Returns
| Type | Description |
|---|---|
| decimal | The wage type value |
GetWageTypeAttribute(string)
Gets a wage type attribute value
Declaration
public object GetWageTypeAttribute(string attributeName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | attributeName | The attribute name |
Returns
| Type | Description |
|---|---|
| object |
GetWageTypeAttribute<T>(string, T)
Gets a wage type attribute as a typed value
Declaration
public T GetWageTypeAttribute<T>(string attributeName, T defaultValue = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | attributeName | The attribute name |
| T | defaultValue | The default value |
Returns
| Type | Description |
|---|---|
| T |
Type Parameters
| Name | Description |
|---|---|
| T |
GetWageTypeCurrentConsolidatedValue(WageTypeConsolidatedResultQuery)
Returns the sum of historical consolidated and current-period wage type values for all wage types in the query
Declaration
public decimal GetWageTypeCurrentConsolidatedValue(WageTypeConsolidatedResultQuery query)
Parameters
| Type | Name | Description |
|---|---|---|
| WageTypeConsolidatedResultQuery | query | The result query |
Returns
| Type | Description |
|---|---|
| decimal | Total of consolidated historical results plus the current in-memory wage type values |
GetWageTypeValueByName(string)
Get wage type value by name
Declaration
[ActionParameter("name", "The wage type name", new string[] { "String" }, null, null)]
[WageTypeAction("GetWageTypeValueByName", "Get wage type value by name", new string[] { "WageType" })]
public ActionValue GetWageTypeValueByName(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Wage type number |
Returns
| Type | Description |
|---|---|
| ActionValue |
GetWageTypeValueByNumber(decimal)
Get wage type value by number
Declaration
[ActionParameter("number", "Get wage type value by number", new string[] { "Dec" }, null, null)]
[WageTypeAction("GetWageTypeValueByNumber", "Get wage type value", new string[] { "WageType" })]
public ActionValue GetWageTypeValueByNumber(decimal number)
Parameters
| Type | Name | Description |
|---|---|---|
| decimal | number | Wage type number |
Returns
| Type | Description |
|---|---|
| ActionValue |
ScheduleRetroPayrun(DateTime, IEnumerable<string>)
Schedule a retro payrun
Declaration
public void ScheduleRetroPayrun(DateTime scheduleDate, IEnumerable<string> resultTags = null)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTime | scheduleDate | The payrun schedule date, must be before the current period |
| IEnumerable<string> | resultTags | The result tags |
SetResultAttribute(string, object)
Sets the wage result attribute value
Declaration
public void SetResultAttribute(string name, object value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The attribute name |
| object | value | The attribute value |
SetResultTags(IEnumerable<string>)
Sets the wage type result tags
Declaration
public void SetResultTags(IEnumerable<string> tags)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<string> | tags | The result tags |