diff --git a/TrafagSalesExporter/Components/Pages/Settings.razor b/TrafagSalesExporter/Components/Pages/Settings.razor index ecf2fd2..a0b7de5 100644 --- a/TrafagSalesExporter/Components/Pages/Settings.razor +++ b/TrafagSalesExporter/Components/Pages/Settings.razor @@ -284,18 +284,6 @@ Schreibt zusätzliche technische Fortschrittsmeldungen für HANA- und SAP-Lesevorgänge ins Dashboard und in die Logs. - - - - Schreibt nach Mapping und Transformation eine lesbare CSV-Datei je Standort. - - - - - - Zentrale Excel, Finance Summary und Management-Analyse lesen die neuesten Standort-CSV-Dateien statt CentralSalesRecords. - - @@ -304,9 +292,38 @@ - - + +
+
+ +
+ Audit-CSV / nachvollziehbarer Datenfluss + + Fuer Finance und Wirtschaftspruefung: lesbare Standort-CSV nach Mapping und Konvertierung, optional als Quelle fuer zentrale Auswertungen. + +
+
+ + + + + Schreibt beim Laenderexport je Standort eine Sales_*.csv mit den transformierten Daten. + + + + + + Dashboard, zentrale Excel-Datei und Finance-Auswertungen lesen die neuesten Standort-CSV-Dateien statt CentralSalesRecords. + + + + + Audit-CSV wird immer im gleichen Ordner wie die lokalen Standort-Dateien abgelegt. + Der Pfad wird oben bei Lokaler Standardpfad Standort-Dateien gesetzt. + + + +
+ + @code { private SharePointConfig _spConfig = new(); private ExportSettings _exportSettings = new(); diff --git a/TrafagSalesExporter/Services/ExportAuditCsvService.cs b/TrafagSalesExporter/Services/ExportAuditCsvService.cs index dd56a87..05c5137 100644 --- a/TrafagSalesExporter/Services/ExportAuditCsvService.cs +++ b/TrafagSalesExporter/Services/ExportAuditCsvService.cs @@ -123,13 +123,13 @@ public sealed class ExportAuditCsvService : IExportAuditCsvService public string ResolveAuditCsvDirectory(ExportSettings settings, string? fallbackOutputDirectory = null) { - if (!string.IsNullOrWhiteSpace(settings.LocalAuditCsvFolder)) - return settings.LocalAuditCsvFolder.Trim(); + if (!string.IsNullOrWhiteSpace(fallbackOutputDirectory)) + return fallbackOutputDirectory.Trim(); if (!string.IsNullOrWhiteSpace(settings.LocalSiteExportFolder)) - return Path.Combine(settings.LocalSiteExportFolder.Trim(), "audit-csv"); + return settings.LocalSiteExportFolder.Trim(); - return Path.Combine(AppContext.BaseDirectory, "output", "audit-csv"); + return Path.Combine(AppContext.BaseDirectory, "output"); } private static IEnumerable BuildRow(Site site, string sourceSystem, SalesRecord record) diff --git a/TrafagSalesExporter/TrafagSalesExporter.Tests/ExportAuditCsvServiceTests.cs b/TrafagSalesExporter/TrafagSalesExporter.Tests/ExportAuditCsvServiceTests.cs index 221953e..862d15c 100644 --- a/TrafagSalesExporter/TrafagSalesExporter.Tests/ExportAuditCsvServiceTests.cs +++ b/TrafagSalesExporter/TrafagSalesExporter.Tests/ExportAuditCsvServiceTests.cs @@ -29,7 +29,8 @@ public sealed class ExportAuditCsvServiceTests : IDisposable var settings = new ExportSettings { AuditCsvEnabled = true, - LocalAuditCsvFolder = _tempDirectory + LocalSiteExportFolder = _tempDirectory, + LocalAuditCsvFolder = Path.Combine(_tempDirectory, "ignored") }; var site = new Site { TSC = "TRCH", Land = "Schweiz" }; var record = new SalesRecord @@ -65,6 +66,7 @@ public sealed class ExportAuditCsvServiceTests : IDisposable var path = await service.WriteSiteAuditCsvAsync(site, settings, "SAP", _tempDirectory, [record]); Assert.True(File.Exists(path)); + Assert.Equal(_tempDirectory, Path.GetDirectoryName(path)); var records = await service.ReadLatestSiteAuditCsvRecordsAsync(settings); var roundtrip = Assert.Single(records); Assert.Equal("SAP", roundtrip.SourceSystem); @@ -84,7 +86,12 @@ public sealed class ExportAuditCsvServiceTests : IDisposable var csvService = new ExportAuditCsvService(); await csvService.WriteSiteAuditCsvAsync( new Site { TSC = "TRUK", Land = "England" }, - new ExportSettings { AuditCsvEnabled = true, LocalAuditCsvFolder = _tempDirectory }, + new ExportSettings + { + AuditCsvEnabled = true, + LocalSiteExportFolder = _tempDirectory, + LocalAuditCsvFolder = Path.Combine(_tempDirectory, "ignored") + }, "MANUAL_EXCEL", _tempDirectory, [ @@ -112,7 +119,8 @@ public sealed class ExportAuditCsvServiceTests : IDisposable db.ExportSettings.Add(new ExportSettings { UseAuditCsvAsCentralSource = true, - LocalAuditCsvFolder = _tempDirectory + LocalSiteExportFolder = _tempDirectory, + LocalAuditCsvFolder = Path.Combine(_tempDirectory, "ignored") }); db.Sites.Add(new Site {