Skip to content

Commit 09d7460

Browse files
author
Jani Giannoudis
committed
payroll runtime: added lookup apply range value
updated third party nugets updated version to 0.9.0-beta.12
1 parent a7613a1 commit 09d7460

File tree

4 files changed

+36
-5
lines changed

4 files changed

+36
-5
lines changed

Client.Services/PayrollEngine.Client.Services.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
</PropertyGroup>
1515

1616
<ItemGroup>
17-
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.9" />
18-
<PackageReference Include="PayrollEngine.Client.Scripting" Version="0.9.0-beta.11" />
19-
<PackageReference Include="PayrollEngine.Client.Test" Version="0.9.0-beta.11" />
17+
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.10" />
18+
<PackageReference Include="PayrollEngine.Client.Scripting" Version="0.9.0-beta.12" />
19+
<PackageReference Include="PayrollEngine.Client.Test" Version="0.9.0-beta.12" />
2020
</ItemGroup>
2121

2222
<!-- include xml documention files and json schemas to the nuget package -->

Client.Services/PayrollEngine.Client.Services.xml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Client.Services/Scripting.Runtime.Api/PayrollRuntime.cs

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
using System;
22
using System.Linq;
3-
using System.Collections.Generic;
43
using System.Text.Json;
54
using System.Threading.Tasks;
5+
using System.Collections.Generic;
66
using PayrollEngine.Client.Model;
77
using PayrollEngine.Client.Service;
88
using PayrollEngine.Client.Service.Api;
@@ -519,6 +519,34 @@ public virtual string GetRangeLookup(string lookupName, decimal rangeValue,
519519
return value?.Value;
520520
}
521521

522+
/// <inheritdoc />
523+
public decimal ApplyRangeValue(string lookupName, decimal rangeValue, string valueFieldName = null)
524+
{
525+
// lookup
526+
var lookups = PayrollService.GetLookupsAsync<LookupSet>(new(TenantId, PayrollId),
527+
lookupNames: [lookupName],
528+
regulationDate: RegulationDate,
529+
evaluationDate: EvaluationDate).Result;
530+
var lookup = lookups.FirstOrDefault();
531+
if (lookup == null)
532+
{
533+
return 0;
534+
}
535+
536+
// lookup values
537+
var values = PayrollService.GetLookupValuesAsync<LookupValue>(new(TenantId, PayrollId),
538+
lookupNames: [lookupName],
539+
regulationDate: RegulationDate,
540+
evaluationDate: EvaluationDate).Result;
541+
if (!values.Any())
542+
{
543+
return 0;
544+
}
545+
lookup.Values.AddRange(values);
546+
547+
return lookup.ApplyRangeValue(rangeValue, valueFieldName);
548+
}
549+
522550
#endregion
523551

524552
}

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFramework>net9.0</TargetFramework>
5-
<Version>0.9.0-beta.11</Version>
5+
<Version>0.9.0-beta.12</Version>
66
<FileVersion>0.9.0</FileVersion>
77
<InformationalVersion></InformationalVersion>
88
<Authors>Jani Giannoudis</Authors>

0 commit comments

Comments
 (0)