Commit pending finance and Power BI work

This commit is contained in:
2026-05-13 07:33:00 +02:00
parent 1cd0ad998f
commit 001e2a73d5
44 changed files with 3210 additions and 104 deletions
@@ -25,6 +25,7 @@ public class SapCompositionService : ISapCompositionService
IReadOnlyList<SapFieldMapping> mappings,
string username,
string password,
int? preferredYear = null,
CancellationToken cancellationToken = default)
{
if (string.IsNullOrWhiteSpace(site.SapServiceUrl))
@@ -44,7 +45,8 @@ public class SapCompositionService : ISapCompositionService
{
await _appEventLogService.WriteDebugAsync("SAP", "Quelle wird gelesen", site.Id, site.Land,
$"Alias={source.Alias} | EntitySet={source.EntitySet}");
var rows = await _sapGatewayService.GetEntityRowsAsync(site.SapServiceUrl, source.EntitySet, username, password, cancellationToken);
var filter = BuildODataYearFilter(source.EntitySet, preferredYear);
var rows = await _sapGatewayService.GetEntityRowsAsync(site.SapServiceUrl, source.EntitySet, username, password, filter, cancellationToken);
sourceRows[source.Alias] = rows;
await _appEventLogService.WriteDebugAsync("SAP", "Quelle gelesen", site.Id, site.Land,
$"Alias={source.Alias} | EntitySet={source.EntitySet} | Zeilen={rows.Count}");
@@ -57,4 +59,14 @@ public class SapCompositionService : ISapCompositionService
$"SalesRecords={result.Count} | Mappings={mappings.Count(x => x.IsActive)}");
return result;
}
private static string? BuildODataYearFilter(string entitySet, int? preferredYear)
{
if (preferredYear is null)
return null;
return string.Equals(entitySet, "FinanzdataSchweizOeSet", StringComparison.OrdinalIgnoreCase)
? $"Gjahr eq '{preferredYear.Value}'"
: null;
}
}