Compare commits

...

48 Commits

Author SHA1 Message Date
Developer01
ceb688fc3f Jobs Sichtbeleg Anpassung 2025-11-19 16:41:36 +01:00
Developer01
aa5742a529 MS Änderungen lokal PC Mirko 2025-11-18 16:15:22 +01:00
Developer01
79267e6bd9 GD Picture und Verweise 2025-11-17 12:50:52 +01:00
Developer01
cf63fd8c39 Update GDPIcture 2025-11-17 12:42:17 +01:00
Developer01
ec3a677ca8 MS Jobs Sichtbeleg 2025-11-11 17:42:08 +01:00
Developer01
48406884ca Merge branch 'master' of http://git.dd:3000/AppStd/Modules 2025-09-15 08:46:37 +02:00
204aaaeb4e Korrektur 2025-09-12 12:55:41 +02:00
ec378ba3b4 Modules.Interfaces: Version 2.3.7.0 2025-09-12 11:12:38 +02:00
35b19cde82 Modules.Interfaces: Fehlende Elemente der Codeliste UNTDID 7161 (Charge codes) nachgetragen, passend zur Version 2.3.x 2025-09-12 11:11:52 +02:00
Developer01
f7c0a29676 v3.1. Änderung Sichtbeleg Version 1 vor Abstimmung WISAG 2025-09-05 10:59:39 +02:00
9ae5465c48 Modules.Jobs: Version 3.0.3.0 2025-09-02 11:22:03 +02:00
82139fc30d Modules.Jobs: 4000 Zeichen-Grenze 2025-09-02 11:20:14 +02:00
f4ba4d9e1d Modules.Interface: Listen-Items Handling (Item_Type = 4) 2025-08-20 14:21:50 +02:00
0aabc12f49 Modules.Jobs: Version 3.0.2.0 2025-08-19 12:39:00 +02:00
adbd0fe99b Modules.Jobs: Kürzen der ITEM_VALUE-Werte entfernt. Tabelle muss VARCHAR(max) vorsehen. 2025-08-19 12:37:38 +02:00
2d6a2df48a Modules.Jobs: Version 3.0.1.0 2025-08-08 11:48:03 +02:00
e7ccb74828 Modules.Interfaces: Version 2.3.6.0 2025-08-08 11:47:33 +02:00
05355c93a5 Readonly Property 2025-08-08 11:46:52 +02:00
2007bb91f3 Modules.Interfaces & Modules.Jobs: Weitergabe der ErrorCodes in den Exceptions, um sie im WebService auswerten zu können. 2025-08-08 11:46:21 +02:00
d7d2ecf8a0 Modules.Jobs: Replace Case-Insensitiv 2025-08-04 14:13:20 +02:00
447c7ea600 Modules.Jobs: Version 3.0.0.0 2025-08-04 13:07:19 +02:00
32bb14db06 Modules.Jobs: Strings-Vergleiche sollten unbedingt mit string.equals() erfolgen! 2025-08-04 13:06:04 +02:00
a5226a8101 Modules.Interfaces: Try/Catch und logging 2025-07-25 13:01:45 +02:00
b534c4c799 Modules.Interfaces: Version 2.3.5.0 2025-07-23 11:51:47 +02:00
dc80138311 Modules.Jobs: Version 2.9.9.0 2025-07-23 11:51:14 +02:00
477bb511c4 Modules.Interfaces & Modules.Jobs: ZUGFeRD 2.3.x-Logik angepasst. Auswertung der XML-Tabelle korrigiert, das Dictionary wird erst später erstellt. 2025-07-23 11:50:40 +02:00
0b66b80591 Modules.Jobs: Version 2.9.8.0 2025-07-07 10:50:23 +02:00
5fd924d413 Modules.Interfaces: Version 2.3.4.0 2025-07-07 10:49:50 +02:00
e8ebc30225 Modules.Interface + Modules.Jobs: ITEM_TYPE = 4 / Description enthält jetzt BT-Feld-Info / Kommentare / Abfrage BT-Felder 2025-07-07 10:49:15 +02:00
262805d112 Modules.Interface: Datumsformat immer 8-stellig (yyyyMMdd) aufbereiten 2025-07-04 14:02:27 +02:00
623807c55d Modules.Interfaces: Version 2.3.3 2025-07-04 13:39:29 +02:00
aee7997cb3 Modules.Interfaces: Date/DateTime (yyyy-MM-dd) und Decimal/Numeric-Werte mit CultureInfo.Invariant.Culture speichern. 2025-07-04 13:23:57 +02:00
82a95faaaf Modules.Jobs: Version 2.9.7.0 2025-07-01 10:11:38 +02:00
af7534df48 Modules.Interfaces: Version 2.3.2.0 2025-07-01 10:11:05 +02:00
fa2c2a6417 Modules.Jobs: Keine Hochkomma-Ersetzung mehr bei Bulk-Insert 2025-07-01 10:09:32 +02:00
390a524736 Modules.Interfaces: Belegarten in ZUGFeRD 2.3.x korrigiert und fehlende nachgetragen.
Vorbereitung BT-Felder-Anzeige
2025-06-27 10:48:48 +02:00
0ed996100d Leere Strings (item_type = 0) nicht mehr in die DB schreiben
Kommentare korrigiert
2025-06-26 14:47:30 +02:00
2e0ae13a77 Modules.Jobs: Version 2.9.6.0 2025-06-12 10:46:39 +02:00
267e038725 Modules.Jobs: Prüfe ob Value überhaupt einen Wert hat, sonst wird auch keine Datei erstellt 2025-06-12 10:41:31 +02:00
2673755b14 Jobs: base64 / varbinary 2025-06-05 13:51:24 +02:00
5052ce4f14 Modules.Jobs: Version 2.9.5.0 2025-06-05 10:50:45 +02:00
717909d7e8 Modules.Jobs: MIME-Typen (pdf, xlsx, odt) - Fehlerhandling ergänzt, wenn Dateien nicht erstellt werden können. 2025-06-05 10:49:49 +02:00
04a408ab97 Jobs: MIME-Types + File-Extension + xlsx-Dateien 2025-06-03 15:23:22 +02:00
face3c76fb Modules.Database: Version 2.3.6.0 2025-06-03 08:48:26 +02:00
2d3a1cd25c Korrektur von MS in master nachgezogen 2025-06-03 08:47:17 +02:00
43e95a20b9 Modules.Jobs: Version 2.9.4.0 2025-06-02 11:50:32 +02:00
05d0bd60ab Modules.Interfaces: Version 2.3.1.0 2025-06-02 11:49:43 +02:00
7e70c059b6 Auslesen von embedded Files aus einer XML-Datei 2025-06-02 11:47:15 +02:00
36 changed files with 4797 additions and 3309 deletions

View File

@ -45,8 +45,8 @@
<OptionInfer>On</OptionInfer> <OptionInfer>On</OptionInfer>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="DigitalData.Modules.Logging, Version=2.6.5.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="DigitalData.Modules.Logging">
<HintPath>..\packages\DigitalData.Modules.Logging.2.6.5\lib\net462\DigitalData.Modules.Logging.dll</HintPath> <HintPath>..\Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
</Reference> </Reference>
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL"> <Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="DigitalData.Modules.Logging" version="2.6.5" targetFramework="net462" />
<package id="NLog" version="5.0.5" targetFramework="net461" /> <package id="NLog" version="5.0.5" targetFramework="net461" />
<package id="NuGet.CommandLine" version="6.13.2" targetFramework="net462" developmentDependency="true" /> <package id="NuGet.CommandLine" version="6.13.2" targetFramework="net462" developmentDependency="true" />
</packages> </packages>

View File

@ -47,17 +47,19 @@
<OptionInfer>On</OptionInfer> <OptionInfer>On</OptionInfer>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="DigitalData.Modules.Base, Version=1.3.8.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="DigitalData.Modules.Base">
<HintPath>..\packages\DigitalData.Modules.Base.1.3.8\lib\net462\DigitalData.Modules.Base.dll</HintPath> <HintPath>..\Base\bin\Debug\DigitalData.Modules.Base.dll</HintPath>
</Reference> </Reference>
<Reference Include="DigitalData.Modules.Database, Version=2.3.5.4, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="DigitalData.Modules.Config, Version=1.3.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\DigitalData.Modules.Database.2.3.5.4\lib\net462\DigitalData.Modules.Database.dll</HintPath> <SpecificVersion>False</SpecificVersion>
<HintPath>bin\Debug\DigitalData.Modules.Config.dll</HintPath>
</Reference> </Reference>
<Reference Include="DigitalData.Modules.Encryption, Version=1.3.1.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="DigitalData.Modules.Database">
<HintPath>..\packages\DigitalData.Modules.Encryption.1.3.1\lib\net462\DigitalData.Modules.Encryption.dll</HintPath> <HintPath>..\Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
</Reference> </Reference>
<Reference Include="DigitalData.Modules.Logging, Version=2.6.5.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="DigitalData.Modules.Logging, Version=2.6.5.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\DigitalData.Modules.Logging.2.6.5\lib\net462\DigitalData.Modules.Logging.dll</HintPath> <SpecificVersion>False</SpecificVersion>
<HintPath>..\Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
</Reference> </Reference>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath> <HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
@ -148,9 +150,6 @@
</None> </None>
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Content Include="README.txt" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<PropertyGroup> <PropertyGroup>
<PostBuildEvent>powershell.exe -command "&amp; { &amp;'$(SolutionDir)copy-binary.ps1' '$(TargetPath)' '$(TargetFileName)' '$(ConfigurationName)' '$(ProjectName)' }"</PostBuildEvent> <PostBuildEvent>powershell.exe -command "&amp; { &amp;'$(SolutionDir)copy-binary.ps1' '$(TargetPath)' '$(TargetFileName)' '$(ConfigurationName)' '$(ProjectName)' }"</PostBuildEvent>

View File

@ -1,5 +0,0 @@
BASE MODULE
===========
This module is intended for often used constants and datastructures.
Therefor it is important that this module does not have any dependencies on other modules!!

View File

@ -1,9 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="DigitalData.Modules.Base" version="1.3.8" targetFramework="net462" />
<package id="DigitalData.Modules.Database" version="2.3.5.4" targetFramework="net462" />
<package id="DigitalData.Modules.Encryption" version="1.3.1" targetFramework="net462" />
<package id="DigitalData.Modules.Logging" version="2.6.5" targetFramework="net462" />
<package id="EntityFramework" version="6.4.4" targetFramework="net462" /> <package id="EntityFramework" version="6.4.4" targetFramework="net462" />
<package id="EntityFramework.Firebird" version="6.4.0" targetFramework="net462" /> <package id="EntityFramework.Firebird" version="6.4.0" targetFramework="net462" />
<package id="FirebirdSql.Data.FirebirdClient" version="7.5.0" targetFramework="net462" /> <package id="FirebirdSql.Data.FirebirdClient" version="7.5.0" targetFramework="net462" />

View File

@ -652,6 +652,11 @@ Public Class MSSQLServer
Select(Function(p) $"({p.ParameterName}={p.Value})"). Select(Function(p) $"({p.ParameterName}={p.Value})").
ToList() ToList()
Return String.Join(",", oList) Dim oParamString = String.Join(",", oList)
If oParamString.Length > 1000 Then
oParamString = oParamString.Substring(1, 1000)
End If
Return oParamString
End Function End Function
End Class End Class

View File

@ -47,11 +47,12 @@
<OptionInfer>On</OptionInfer> <OptionInfer>On</OptionInfer>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="DigitalData.Modules.Encryption, Version=1.3.1.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="DigitalData.Modules.Encryption">
<HintPath>..\packages\DigitalData.Modules.Encryption.1.3.1\lib\net462\DigitalData.Modules.Encryption.dll</HintPath> <HintPath>..\Encryption\bin\Debug\DigitalData.Modules.Encryption.dll</HintPath>
</Reference> </Reference>
<Reference Include="DigitalData.Modules.Logging, Version=2.6.5.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="DigitalData.Modules.Logging, Version=2.6.5.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\DigitalData.Modules.Logging.2.6.5\lib\net462\DigitalData.Modules.Logging.dll</HintPath> <SpecificVersion>False</SpecificVersion>
<HintPath>..\Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
</Reference> </Reference>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath> <HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>

View File

@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices
<Assembly: AssemblyCompany("Digital Data")> <Assembly: AssemblyCompany("Digital Data")>
<Assembly: AssemblyProduct("Modules.Database")> <Assembly: AssemblyProduct("Modules.Database")>
<Assembly: AssemblyCopyright("Copyright © 2025")> <Assembly: AssemblyCopyright("Copyright © 2025")>
<Assembly: AssemblyTrademark("")> <Assembly: AssemblyTrademark("2.3.6.0")>
<Assembly: ComVisible(False)> <Assembly: ComVisible(False)>
@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben: ' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")> ' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.3.5.4")> <Assembly: AssemblyVersion("2.3.6.0")>
<Assembly: AssemblyFileVersion("2.3.5.4")> <Assembly: AssemblyFileVersion("2.3.6.0")>

View File

@ -1,7 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="DigitalData.Modules.Encryption" version="1.3.1" targetFramework="net462" />
<package id="DigitalData.Modules.Logging" version="2.6.5" targetFramework="net462" />
<package id="EntityFramework" version="6.4.4" targetFramework="net461" /> <package id="EntityFramework" version="6.4.4" targetFramework="net461" />
<package id="EntityFramework.Firebird" version="6.4.0" targetFramework="net461" /> <package id="EntityFramework.Firebird" version="6.4.0" targetFramework="net461" />
<package id="FirebirdSql.Data.FirebirdClient" version="7.5.0" targetFramework="net461" /> <package id="FirebirdSql.Data.FirebirdClient" version="7.5.0" targetFramework="net461" />

View File

@ -46,7 +46,8 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="DigitalData.Modules.Logging, Version=2.6.5.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="DigitalData.Modules.Logging, Version=2.6.5.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\DigitalData.Modules.Logging.2.6.5\lib\net462\DigitalData.Modules.Logging.dll</HintPath> <SpecificVersion>False</SpecificVersion>
<HintPath>..\Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
</Reference> </Reference>
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL"> <Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="DigitalData.Modules.Logging" version="2.6.5" targetFramework="net462" />
<package id="NLog" version="5.0.5" targetFramework="net461" /> <package id="NLog" version="5.0.5" targetFramework="net461" />
</packages> </packages>

View File

@ -45,7 +45,8 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="DigitalData.Modules.Logging, Version=2.6.5.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="DigitalData.Modules.Logging, Version=2.6.5.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\DigitalData.Modules.Logging.2.6.5\lib\net462\DigitalData.Modules.Logging.dll</HintPath> <SpecificVersion>False</SpecificVersion>
<HintPath>..\Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
</Reference> </Reference>
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL"> <Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="DigitalData.Modules.Logging" version="2.6.5" targetFramework="net48" />
<package id="NLog" version="5.0.5" targetFramework="net48" /> <package id="NLog" version="5.0.5" targetFramework="net48" />
<package id="NuGet.CommandLine" version="6.13.2" targetFramework="net48" developmentDependency="true" /> <package id="NuGet.CommandLine" version="6.13.2" targetFramework="net48" developmentDependency="true" />
<package id="protobuf-net" version="2.4.0" targetFramework="net461" /> <package id="protobuf-net" version="2.4.0" targetFramework="net461" />

View File

@ -49,6 +49,15 @@
<Reference Include="BouncyCastle.Cryptography, Version=2.0.0.0, Culture=neutral, PublicKeyToken=072edcf4a5328938, processorArchitecture=MSIL"> <Reference Include="BouncyCastle.Cryptography, Version=2.0.0.0, Culture=neutral, PublicKeyToken=072edcf4a5328938, processorArchitecture=MSIL">
<HintPath>..\packages\BouncyCastle.Cryptography.2.5.0\lib\net461\BouncyCastle.Cryptography.dll</HintPath> <HintPath>..\packages\BouncyCastle.Cryptography.2.5.0\lib\net461\BouncyCastle.Cryptography.dll</HintPath>
</Reference> </Reference>
<Reference Include="DigitalData.Modules.Base">
<HintPath>..\Base\bin\Debug\DigitalData.Modules.Base.dll</HintPath>
</Reference>
<Reference Include="DigitalData.Modules.Database">
<HintPath>..\Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
</Reference>
<Reference Include="DigitalData.Modules.Logging">
<HintPath>..\Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
</Reference>
<Reference Include="DocumentFormat.OpenXml, Version=3.2.0.0, Culture=neutral, PublicKeyToken=8fb06cb64d019a17, processorArchitecture=MSIL"> <Reference Include="DocumentFormat.OpenXml, Version=3.2.0.0, Culture=neutral, PublicKeyToken=8fb06cb64d019a17, processorArchitecture=MSIL">
<HintPath>..\packages\DocumentFormat.OpenXml.3.2.0\lib\net46\DocumentFormat.OpenXml.dll</HintPath> <HintPath>..\packages\DocumentFormat.OpenXml.3.2.0\lib\net46\DocumentFormat.OpenXml.dll</HintPath>
</Reference> </Reference>
@ -185,8 +194,8 @@
<Reference Include="System.Text.Encodings.Web, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> <Reference Include="System.Text.Encodings.Web, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Encodings.Web.8.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath> <HintPath>..\packages\System.Text.Encodings.Web.8.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath>
</Reference> </Reference>
<Reference Include="System.Text.Json, Version=8.0.0.5, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> <Reference Include="System.Text.Json, Version=8.0.0.6, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Json.8.0.5\lib\net462\System.Text.Json.dll</HintPath> <HintPath>..\packages\System.Text.Json.8.0.6\lib\net462\System.Text.Json.dll</HintPath>
</Reference> </Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> <Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath> <HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
@ -226,6 +235,7 @@
<Compile Include="GrapQLInterface\LoginData.vb" /> <Compile Include="GrapQLInterface\LoginData.vb" />
<Compile Include="GrapQLInterface\LogoutData.vb" /> <Compile Include="GrapQLInterface\LogoutData.vb" />
<Compile Include="GrapQLInterface\QueryData.vb" /> <Compile Include="GrapQLInterface\QueryData.vb" />
<Compile Include="ZUGFeRDInterface\Enums\ErrorCodes.vb" />
<Compile Include="ZUGFeRDInterface\Enums\Item_Types.vb" /> <Compile Include="ZUGFeRDInterface\Enums\Item_Types.vb" />
<Compile Include="ZUGFeRDInterface\Exceptions.vb" /> <Compile Include="ZUGFeRDInterface\Exceptions.vb" />
<Compile Include="My Project\AssemblyInfo.vb" /> <Compile Include="My Project\AssemblyInfo.vb" />
@ -247,6 +257,7 @@
<Compile Include="ZUGFeRDInterface\PDFConverter.vb" /> <Compile Include="ZUGFeRDInterface\PDFConverter.vb" />
<Compile Include="ZUGFeRDInterface\Peppol_UBL2.1\CreditNoteType.vb" /> <Compile Include="ZUGFeRDInterface\Peppol_UBL2.1\CreditNoteType.vb" />
<Compile Include="ZUGFeRDInterface\Peppol_UBL2.1\InvoiceType.vb" /> <Compile Include="ZUGFeRDInterface\Peppol_UBL2.1\InvoiceType.vb" />
<Compile Include="ZUGFeRDInterface\RejectionStringRow.vb" />
<Compile Include="ZUGFeRDInterface\Validator.vb" /> <Compile Include="ZUGFeRDInterface\Validator.vb" />
<Compile Include="ZUGFeRDInterface\Version1.0\CrossIndustryDocumentType.vb" /> <Compile Include="ZUGFeRDInterface\Version1.0\CrossIndustryDocumentType.vb" />
<Compile Include="ZUGFeRDInterface.vb" /> <Compile Include="ZUGFeRDInterface.vb" />
@ -282,14 +293,6 @@
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Base\Base.vbproj">
<Project>{6ea0c51f-c2b1-4462-8198-3de0b32b74f8}</Project>
<Name>Base</Name>
</ProjectReference>
<ProjectReference Include="..\Database\Database.vbproj">
<Project>{eaf0ea75-5fa7-485d-89c7-b2d843b03a96}</Project>
<Name>Database</Name>
</ProjectReference>
<ProjectReference Include="..\Logging\Logging.vbproj"> <ProjectReference Include="..\Logging\Logging.vbproj">
<Project>{903b2d7d-3b80-4be9-8713-7447b704e1b0}</Project> <Project>{903b2d7d-3b80-4be9-8713-7447b704e1b0}</Project>
<Name>Logging</Name> <Name>Logging</Name>

View File

@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices
<Assembly: AssemblyCompany("Digital Data")> <Assembly: AssemblyCompany("Digital Data")>
<Assembly: AssemblyProduct("Modules.Interfaces")> <Assembly: AssemblyProduct("Modules.Interfaces")>
<Assembly: AssemblyCopyright("Copyright © 2025")> <Assembly: AssemblyCopyright("Copyright © 2025")>
<Assembly: AssemblyTrademark("")> <Assembly: AssemblyTrademark("2.3.7.0")>
<Assembly: ComVisible(False)> <Assembly: ComVisible(False)>
@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben: ' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")> ' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.3.0.0")> <Assembly: AssemblyVersion("2.4.0.0")>
<Assembly: AssemblyFileVersion("2.3.0.0")> <Assembly: AssemblyFileVersion("2.4.0.0")>

View File

@ -19,6 +19,7 @@ Public Class ZUGFeRDInterface
Public Const ZUGFERD_SPEC_DEFAULT = "DEFAULT" Public Const ZUGFERD_SPEC_DEFAULT = "DEFAULT"
Public Const ZUGFERD_SPEC_10 = "ZUGFERD_10" Public Const ZUGFERD_SPEC_10 = "ZUGFERD_10"
Public Const ZUGFERD_SPEC_2x = "ZUGFERD_2x" Public Const ZUGFERD_SPEC_2x = "ZUGFERD_2x"
Public Const ZUGFERD_SPEC_2_3x = "ZUGFERD_2_3x"
Public Const UBL_SPEC_21 = "UBL_21" Public Const UBL_SPEC_21 = "UBL_21"
@ -50,6 +51,7 @@ Public Class ZUGFeRDInterface
UnsupportedFormat UnsupportedFormat
FileTooBig FileTooBig
UnknownError UnknownError
NotInUse
End Enum End Enum
Public ReadOnly Property FileGroup As FileGroups Public ReadOnly Property FileGroup As FileGroups
@ -60,6 +62,7 @@ Public Class ZUGFeRDInterface
Public Property AllowXRechnung_Filename As Boolean = True Public Property AllowXRechnung_Filename As Boolean = True
Public Property AllowZugferd_1_0_Schema As Boolean = True Public Property AllowZugferd_1_0_Schema As Boolean = True
Public Property AllowZugferd_2_x_Schema As Boolean = True Public Property AllowZugferd_2_x_Schema As Boolean = True
Public Property AllowZugferd_2_3_x_Schema As Boolean = True
Public Property AllowPeppol_3_x_Schema As Boolean = False Public Property AllowPeppol_3_x_Schema As Boolean = False
End Class End Class
@ -130,24 +133,46 @@ Public Class ZUGFeRDInterface
AllowedFilenames = oAllowedFilenames AllowedFilenames = oAllowedFilenames
End Sub End Sub
Public Function FilterPropertyMap(pPropertyMap As Dictionary(Of String, XmlItemProperty), pSpecification As String) As Dictionary(Of String, XmlItemProperty) Public Function FilterPropertyMap(pPropertyMapList As List(Of XmlItemProperty), pSpecification As String) As Dictionary(Of String, XmlItemProperty)
_logger.Debug("Filtering Property map for Specification [{0}]", pSpecification) _logger.Debug("Filtering Property map list for Specification [{0}]", pSpecification)
If pSpecification = ZUGFERD_SPEC_10 Then If pSpecification = ZUGFERD_SPEC_10 Then
_logger.Debug("Special Case [{0}], including [{1}]", ZUGFERD_SPEC_10, ZUGFERD_SPEC_DEFAULT) Try
Return pPropertyMap.
Where(Function(kv) kv.Value.Specification = pSpecification Or kv.Value.Specification = ZUGFERD_SPEC_DEFAULT). _logger.Debug("Special Case [{0}], including [{1}]", ZUGFERD_SPEC_10, ZUGFERD_SPEC_DEFAULT)
ToDictionary(Function(kv) kv.Key, Function(kv) kv.Value)
Dim countElements As Integer = pPropertyMapList.Where(Function(x) x.Specification = pSpecification Or x.Specification = ZUGFERD_SPEC_DEFAULT).Count
_logger.Debug("Property map list contains [{0}] elements for specification [{1}]", countElements, pSpecification)
Return pPropertyMapList.
Where(Function(kv) kv.Specification = pSpecification Or kv.Specification = ZUGFERD_SPEC_DEFAULT).
ToDictionary(Function(kv) kv.XMLPath, Function(kv) kv)
Catch ex As Exception
_logger.Error(ex)
End Try
Else Else
_logger.Debug("Using Specification [{0}]", pSpecification)
Return pPropertyMap. Try
Where(Function(kv) kv.Value.Specification = pSpecification).
ToDictionary(Function(kv) kv.Key, Function(kv) kv.Value) Dim countElements As Integer = pPropertyMapList.Where(Function(x) x.Specification = pSpecification).Count
_logger.Debug("Property map list contains [{0}] elements for specification [{1}]", countElements, pSpecification)
Return pPropertyMapList.
Where(Function(kv) kv.Specification = pSpecification).
ToDictionary(Function(kv) kv.XMLPath, Function(kv) kv)
Catch ex As Exception
_logger.Error(ex)
End Try
End If End If
Return Nothing
End Function End Function
Public Function GetSerializedXMLContentFromFile(oFileInfo As FileInfo) As ZugferdResult Public Function GetSerializedXMLContentFromFile(oFileInfo As FileInfo) As ZugferdResult
Dim oResult = New ZugferdResult() Dim oResult = New ZugferdResult()
Dim oMessage As String = String.Empty
Try Try
Dim oFileSize As Integer = oFileInfo.Length Dim oFileSize As Integer = oFileInfo.Length
@ -172,7 +197,7 @@ Public Class ZUGFeRDInterface
Catch ex As Exception Catch ex As Exception
_logger.Error(ex) _logger.Error(ex)
Throw New ZUGFeRDExecption(ErrorType.NoValidZugferd, "Datei ist eine ungültige XML Datei.") Throw New ZUGFeRDExecption(ErrorCodes.UnsupportedFerdException, "Datei ist eine ungültige XML Datei.")
End Try End Try
If oResult.ValidationErrors.Any() Then If oResult.ValidationErrors.Any() Then
@ -188,7 +213,6 @@ Public Class ZUGFeRDInterface
''' Validates a ZUGFeRD File and extracts the XML Document from it ''' Validates a ZUGFeRD File and extracts the XML Document from it
''' </summary> ''' </summary>
''' <param name="Path"></param> ''' <param name="Path"></param>
''' <exception cref="ZUGFeRDExecption"></exception>
Public Function ExtractZUGFeRDFileWithGDPicture(Path As String) As ZugferdResult Public Function ExtractZUGFeRDFileWithGDPicture(Path As String) As ZugferdResult
Dim oResult = ValidateZUGFeRDFileWithGDPicture(Path) Dim oResult = ValidateZUGFeRDFileWithGDPicture(Path)
oResult = ValidateZUGFeRDDocument(oResult) oResult = ValidateZUGFeRDDocument(oResult)
@ -206,7 +230,6 @@ Public Class ZUGFeRDInterface
''' Validates a ZUGFeRD File and extracts the XML Document from it ''' Validates a ZUGFeRD File and extracts the XML Document from it
''' </summary> ''' </summary>
''' <param name="Stream"></param> ''' <param name="Stream"></param>
''' <exception cref="ZUGFeRDExecption"></exception>
Public Function ExtractZUGFeRDFileWithGDPicture(Stream As Stream) As ZugferdResult Public Function ExtractZUGFeRDFileWithGDPicture(Stream As Stream) As ZugferdResult
Dim oResult = ValidateZUGFeRDFileWithGDPicture(Stream) Dim oResult = ValidateZUGFeRDFileWithGDPicture(Stream)
oResult = ValidateZUGFeRDDocument(oResult) oResult = ValidateZUGFeRDDocument(oResult)
@ -229,7 +252,6 @@ Public Class ZUGFeRDInterface
''' Validates a ZUGFeRD File and extracts the XML Document from it ''' Validates a ZUGFeRD File and extracts the XML Document from it
''' </summary> ''' </summary>
''' <param name="pStream"></param> ''' <param name="pStream"></param>
''' <exception cref="ZUGFeRDExecption"></exception>
''' <returns>The embedded xml data as an XPath document</returns> ''' <returns>The embedded xml data as an XPath document</returns>
Public Function ValidateZUGFeRDFileWithGDPicture(pStream As Stream) As ZugferdResult Public Function ValidateZUGFeRDFileWithGDPicture(pStream As Stream) As ZugferdResult
Dim oEmbedExtractor = New PDFEmbeds(_logConfig) Dim oEmbedExtractor = New PDFEmbeds(_logConfig)
@ -248,7 +270,7 @@ Public Class ZUGFeRDInterface
Throw ex Throw ex
Catch ex As Exception Catch ex As Exception
_logger.Warn("Error while validating ZUGFeRD file with GDPicture") _logger.Warn("Error while validating eInvoice file with GDPicture")
_logger.Error(ex) _logger.Error(ex)
Throw ex Throw ex
End Try End Try
@ -258,7 +280,6 @@ Public Class ZUGFeRDInterface
''' Validates a ZUGFeRD File and extracts the XML Document from it ''' Validates a ZUGFeRD File and extracts the XML Document from it
''' </summary> ''' </summary>
''' <param name="pPath"></param> ''' <param name="pPath"></param>
''' <exception cref="ZUGFeRDExecption"></exception>
''' <returns>The embedded xml data as an XPath document</returns> ''' <returns>The embedded xml data as an XPath document</returns>
Public Function ValidateZUGFeRDFileWithGDPicture(pPath As String) As ZugferdResult Public Function ValidateZUGFeRDFileWithGDPicture(pPath As String) As ZugferdResult
Dim oEmbedExtractor = New PDFEmbeds(_logConfig) Dim oEmbedExtractor = New PDFEmbeds(_logConfig)
@ -277,19 +298,15 @@ Public Class ZUGFeRDInterface
Throw ex Throw ex
Catch ex As Exception Catch ex As Exception
_logger.Warn("Error while validating ZUGFeRD file with GDPicture") _logger.Warn("Error while validating eInvoice file with GDPicture")
_logger.Error(ex) _logger.Error(ex)
Throw ex Throw ex
End Try End Try
End Function End Function
Private Function HandleEmbeddedFiles(pResults As List(Of PDFEmbeds.EmbeddedFile)) As ZugferdResult Private Function HandleEmbeddedFiles(pResults As List(Of PDFEmbeds.EmbeddedFile)) As ZugferdResult
If pResults Is Nothing Then If pResults Is Nothing OrElse pResults.Count = 0 Then
Throw New ZUGFeRDExecption(ErrorType.NoZugferd, "Datei ist keine ZUGFeRD Datei, weil die Attachments nicht gelesen werden konnten.") Throw New ZUGFeRDExecption(ErrorCodes.InvalidFerdNoXMLAttachmentFound, "Die Datei ist keine gültige ZUGFeRD-Datei, es wurde kein passender XML-Anhang gefunden.")
End If
If pResults.Count = 0 Then
Throw New ZUGFeRDExecption(ErrorType.NoZugferd, "Datei ist keine ZUGFeRD Datei, weil sie keine Attachments enthält.")
End If End If
' Find the first file which filename matches the valid filenames for embedded invoice files ' Find the first file which filename matches the valid filenames for embedded invoice files
@ -298,7 +315,7 @@ Public Class ZUGFeRDInterface
FirstOrDefault() FirstOrDefault()
If oValidResult Is Nothing Then If oValidResult Is Nothing Then
Throw New ZUGFeRDExecption(ErrorType.NoZugferd, "Datei ist keine ZUGFeRD Datei, weil keine entsprechende XML-Datei gefunden wurde.") Throw New ZUGFeRDExecption(ErrorCodes.InvalidFerdNoXMLAttachmentFound, "Die Datei ist keine ZUGFeRD Datei, weil keine passende XML-Datei gefunden wurde.")
End If End If
' Search the embedded files for the ones which are allowed as per the configuration. ' Search the embedded files for the ones which are allowed as per the configuration.
@ -308,7 +325,7 @@ Public Class ZUGFeRDInterface
FirstOrDefault() FirstOrDefault()
If oAllowedResult Is Nothing Then If oAllowedResult Is Nothing Then
Throw New ZUGFeRDExecption(ErrorType.UnsupportedFormat, "Datei ist eine ZUGFeRD Datei, aber das Format wird nicht unterstützt.", oAllowedResult.FileName) Throw New ZUGFeRDExecption(ErrorCodes.InvalidFerdNoXMLAttachmentFound, "Datei enthält einen XML-Anhang mit einem ungültigen Dateinamen.", oAllowedResult.FileName)
End If End If
Try Try
@ -326,7 +343,7 @@ Public Class ZUGFeRDInterface
Catch ex As Exception Catch ex As Exception
_logger.Error(ex) _logger.Error(ex)
Throw New ZUGFeRDExecption(ErrorType.NoValidZugferd, "Datei ist eine ungültige ZUGFeRD Datei.") Throw New ZUGFeRDExecption(ErrorCodes.InvalidFerdException, "XML-Datei konnte nicht gelesen werden.")
End Try End Try
End Function End Function
@ -358,6 +375,7 @@ Public Class ZUGFeRDInterface
}) })
End If End If
'' Reihenfolge 2.0 muss unverändert bleiben. Älteste Version immer zuerst!
If _Options.AllowZugferd_2_x_Schema Then If _Options.AllowZugferd_2_x_Schema Then
oAllowedTypes.AddRange(New List(Of AllowedType) From { oAllowedTypes.AddRange(New List(Of AllowedType) From {
New AllowedType With { New AllowedType With {
@ -374,16 +392,22 @@ Public Class ZUGFeRDInterface
.SchemaType = GetType(Version2_2_FacturX.CrossIndustryInvoiceType), .SchemaType = GetType(Version2_2_FacturX.CrossIndustryInvoiceType),
.Specification = ZUGFERD_SPEC_2x, .Specification = ZUGFERD_SPEC_2x,
.XMLSchema = XMLSCHEMA_ZUGFERD_22 .XMLSchema = XMLSCHEMA_ZUGFERD_22
}
})
End If
'' Reihenfolge ab 2.3 geändert. Neuste Version immer zuerst
If _Options.AllowZugferd_2_3_x_Schema Then
oAllowedTypes.AddRange(New List(Of AllowedType) From {
New AllowedType With {
.SchemaType = GetType(Version2_3_3_FacturX.CrossIndustryInvoiceType),
.Specification = ZUGFERD_SPEC_2_3x,
.XMLSchema = XMLSCHEMA_ZUGFERD_233
}, },
New AllowedType With { New AllowedType With {
.SchemaType = GetType(Version2_3_FacturX.CrossIndustryInvoiceType), .SchemaType = GetType(Version2_3_FacturX.CrossIndustryInvoiceType),
.Specification = ZUGFERD_SPEC_2x, .Specification = ZUGFERD_SPEC_2_3x,
.XMLSchema = XMLSCHEMA_ZUGFERD_23 .XMLSchema = XMLSCHEMA_ZUGFERD_23
},
New AllowedType With {
.SchemaType = GetType(Version2_3_3_FacturX.CrossIndustryInvoiceType),
.Specification = ZUGFERD_SPEC_2x,
.XMLSchema = XMLSCHEMA_ZUGFERD_233
} }
}) })
End If End If
@ -426,8 +450,7 @@ Public Class ZUGFeRDInterface
Next Next
If oObject Is Nothing Then If oObject Is Nothing Then
'Throw New ApplicationException("No Types matched the given document. Document could not be serialized.") Throw New ZUGFeRDExecption(ErrorCodes.UnsupportedFerdException, "Unsupported Format")
Throw New ZUGFeRDExecption(ErrorType.UnsupportedFormat, "Unsupported Format")
End If End If
pResult.Specification = oSpecification pResult.Specification = oSpecification
@ -442,8 +465,8 @@ Public Class ZUGFeRDInterface
Catch ex As Exception Catch ex As Exception
_logger.Error(ex) _logger.Error(ex)
Dim oMessage = "Datei ist eine ungültige ZUGFeRD Datei oder das Format wird nicht unterstüzt, oder das Format ist deaktiviert." Dim oMessage = "Datei ist eine ungültige Datei oder das Format wird nicht unterstüzt, oder das Format ist deaktiviert."
Throw New ZUGFeRDExecption(ErrorType.NoValidZugferd, oMessage) Throw New ZUGFeRDExecption(ErrorCodes.UnsupportedFerdException, oMessage)
End Try End Try
End Function End Function
End Class End Class

View File

@ -0,0 +1,14 @@
Public Enum ErrorCodes
NotInUse = 0
ValidationException = 20001
MD5HashException = 20002
UnsupportedFerdException = 20003
InvalidFerdException = 20004
TooMuchFerdsException = 20005
InvalidFerdNoXMLAttachmentFound = 20006
MissingValueException = 20007
FileSizeLimitReachedException = 20008
OutOfMemoryException = 20009
UnhandledException = 20010
FileMoveException = 200011
End Enum

View File

@ -3,5 +3,6 @@
DateType '1 DateType '1
MoneyType '2 MoneyType '2
FileType '3 FileType '3
ListType '4 - vgl. Währung
End Enum End Enum

View File

@ -4,7 +4,11 @@ Public Class Exceptions
Public Class ZUGFeRDExecption Public Class ZUGFeRDExecption
Inherits ApplicationException Inherits ApplicationException
Public ReadOnly Property ErrorType() As ZUGFeRDInterface.ErrorType Public ReadOnly Property ErrorCode() As ErrorCodes
Public ReadOnly Property Param1 As String = String.Empty
Public ReadOnly Property Param2 As String = String.Empty
''' <summary> ''' <summary>
''' Contains the name of the extracted xml file if already extracted. ''' Contains the name of the extracted xml file if already extracted.
@ -12,18 +16,37 @@ Public Class Exceptions
''' <returns>A filename like zugferd-invoice.xml</returns> ''' <returns>A filename like zugferd-invoice.xml</returns>
Public ReadOnly Property XmlFile As String = String.Empty Public ReadOnly Property XmlFile As String = String.Empty
Public Sub New(ErrorType As ZUGFeRDInterface.ErrorType, Message As String) Public Sub New(pErrorCode As ErrorCodes, Message As String)
MyBase.New(Message) MyBase.New(Message)
_ErrorType = ErrorType _ErrorCode = pErrorCode
End Sub End Sub
Public Sub New(ErrorType As ZUGFeRDInterface.ErrorType, Message As String, pXmlFileName As String) Public Sub New(pErrorCode As ErrorCodes, Message As String, pXmlFileName As String)
MyBase.New(Message) MyBase.New(Message)
_ErrorType = ErrorType _ErrorCode = pErrorCode
_XmlFile = pXmlFileName _XmlFile = pXmlFileName
End Sub End Sub
Public Sub New(pErrorCode As ErrorCodes, Param1 As String, Param2 As String, Message As String)
MyBase.New(Message)
_ErrorCode = pErrorCode
_Param1 = Param1
_Param2 = Param2
End Sub
Public Sub New(pErrorCode As ErrorCodes, Param1 As String, Param2 As String, Message As String, pXmlFileName As String)
MyBase.New(Message)
_ErrorCode = pErrorCode
_Param1 = Param1
_Param2 = Param2
_XmlFile = pXmlFileName
End Sub
End Class End Class
Public Class ValidationException Public Class ValidationException
@ -31,8 +54,13 @@ Public Class Exceptions
Public ValidationErrors As List(Of ZugferdValidationError) Public ValidationErrors As List(Of ZugferdValidationError)
Public ReadOnly Property ErrorCode() As ErrorCodes
Public Sub New() Public Sub New()
MyBase.New("ZUGFeRD document found but validation failed!") MyBase.New("ZUGFeRD document found but validation failed!")
_ErrorCode = ErrorCodes.ValidationException
End Sub End Sub
End Class End Class
End Class End Class

View File

@ -1,4 +1,5 @@
Imports System.Reflection Imports System.Globalization
Imports System.Reflection
Imports System.Text.RegularExpressions Imports System.Text.RegularExpressions
Imports DigitalData.Modules.Logging Imports DigitalData.Modules.Logging
@ -27,6 +28,7 @@ Public Class PropertyValues
Public IsRequired As Boolean Public IsRequired As Boolean
Public GroupCounter As Integer = -1 Public GroupCounter As Integer = -1
Public EN16931_ID As String
Public Description As String Public Description As String
Public Value As String Public Value As String
Public XMLPath As String Public XMLPath As String
@ -35,6 +37,7 @@ Public Class PropertyValues
End Class End Class
Public Class MissingProperty Public Class MissingProperty
Public EN16931_ID As String
Public Description As String Public Description As String
Public XMLPath As String Public XMLPath As String
@ -54,7 +57,7 @@ Public Class PropertyValues
ToDictionary(Function(Item) Item.Key, ToDictionary(Function(Item) Item.Key,
Function(Item) Item.Value) Function(Item) Item.Value)
_logger.Debug("Found {0} default properties.", oDefaultProperties.Count) _logger.Debug("Found {0} ungrouped properties.", oDefaultProperties.Count)
' PropertyMap items with `IsGrouped = True` are grouped by group scope ' PropertyMap items with `IsGrouped = True` are grouped by group scope
Dim oGroupedProperties = PropertyMap. Dim oGroupedProperties = PropertyMap.
@ -68,7 +71,7 @@ Public Class PropertyValues
Dim oGroupScope As String = oGroup.Key Dim oGroupScope As String = oGroup.Key
Dim oPropertyList As New Dictionary(Of XmlItemProperty, List(Of Object)) Dim oPropertyList As New Dictionary(Of XmlItemProperty, List(Of Object))
Dim oRowCount = 0 Dim oRowCount = 0 ' TODO - Es wird anhand der Anzahl XML-Knoten ermittelt wieviele Rows gelesen werden???????
_logger.Debug($"Fetching Property values for group [{oGroupScope}].") _logger.Debug($"Fetching Property values for group [{oGroupScope}].")
@ -112,13 +115,14 @@ Public Class PropertyValues
Dim oPropertyDescription As String = oColumn.Key.Description Dim oPropertyDescription As String = oColumn.Key.Description
Dim oPropertyPath As String = oColumn.Key.XMLPath Dim oPropertyPath As String = oColumn.Key.XMLPath
Dim oItemType As Integer = oColumn.Key.ItemType Dim oItemType As Integer = oColumn.Key.ItemType
Dim oEN16931Value As String = oColumn.Key.EN16931_ID
Dim oRowCounter = oRowIndex + oGlobalGroupCounter + 1 Dim oRowCounter = oRowIndex + oGlobalGroupCounter + 1
' Returns nothing if oColumn.Value contains an empty list ' Returns nothing if oColumn.Value contains an empty list
Dim oPropertyValue = oColumn.Value.ElementAtOrDefault(oRowIndex) Dim oPropertyValue = oColumn.Value.ElementAtOrDefault(oRowIndex)
_logger.Debug("Processing itemSpecification *TableColumn* [{0}].", oTableColumn) _logger.Debug("Processing itemColumn *TableColumn* [{0}].", oTableColumn)
If oTableColumn = "INVOICE_SELLER_EMAIL" Then If oTableColumn = "INVOICE_SELLER_EMAIL" Then
Console.WriteLine("INVOICE_SELLER_EMAIL") Console.WriteLine("INVOICE_SELLER_EMAIL")
ElseIf oTableColumn = "INVOICE_POSITION_ARTICLE" Then ElseIf oTableColumn = "INVOICE_POSITION_ARTICLE" Then
@ -126,20 +130,40 @@ Public Class PropertyValues
End If End If
If IsNothing(oPropertyValue) OrElse String.IsNullOrEmpty(oPropertyValue) Then If IsNothing(oPropertyValue) OrElse String.IsNullOrEmpty(oPropertyValue) Then
If oColumn.Key.IsRequired Then If oColumn.Key.IsRequired Then
_logger.Warn($"{MessageId} # oPropertyValue for specification [{oTableColumn}] is empty or not found but is required. Continuing with Empty String.") _logger.Warn($"{MessageId} - oPropertyValue for column [{oTableColumn}] is empty or not found but is required. Continuing with Empty String.")
Dim oMissingProperty = New MissingProperty() With { Dim oMissingProperty = New MissingProperty() With {
.EN16931_ID = oEN16931Value,
.Description = oPropertyDescription, .Description = oPropertyDescription,
.XMLPath = oPropertyPath .XMLPath = oPropertyPath
} }
oResult.MissingProperties.Add(oMissingProperty) oResult.MissingProperties.Add(oMissingProperty)
Else Else
_logger.Debug($"{MessageId} # oPropertyValue for specification [{oTableColumn}] is empty or not found. Continuing with Empty String.") _logger.Debug($"{MessageId} - oPropertyValue for column [{oTableColumn}] is empty or not found. Continuing with Empty String.")
End If End If
oPropertyValue = String.Empty oPropertyValue = String.Empty
End If End If
_logger.Debug("ItemSpecification [{0}] has value '{1}'", oTableColumn, oPropertyValue) If (oPropertyValue IsNot Nothing) Then
Dim logValue As String = oPropertyValue.ToString()
If logValue.Length > 50 Then
_logger.Debug("Item [{0}] has value '{1}...'", oTableColumn, logValue.Substring(1, 50))
Else
_logger.Debug("Item [{0}] has value '{1}'", oTableColumn, oPropertyValue)
End If
End If
If oTableColumn = "INVOICE_CURRENCY" Or oItemType = 4 Then
Dim oValuestring = oPropertyValue.ToString()
' Bei Listenelementen entfernen wir den String Item, um den Wert zu erhalten
If oValuestring.Contains("Item") Then
oValuestring = oValuestring.Replace("Item", "")
End If
oPropertyValue = oValuestring
End If
oResult.ValidProperties.Add(New ValidProperty() With { oResult.ValidProperties.Add(New ValidProperty() With {
.MessageId = MessageId, .MessageId = MessageId,
@ -150,7 +174,8 @@ Public Class PropertyValues
.TableColumn = oTableColumn, .TableColumn = oTableColumn,
.IsRequired = oIsRequired, .IsRequired = oIsRequired,
.XMLPath = oPropertyPath, .XMLPath = oPropertyPath,
.ItemType = oItemType .ItemType = oItemType,
.EN16931_ID = oEN16931Value
}) })
Next Next
Next Next
@ -169,11 +194,12 @@ Public Class PropertyValues
Dim oIsRequired = oItem.Value.IsRequired Dim oIsRequired = oItem.Value.IsRequired
Dim oDescription = oItem.Value.Description Dim oDescription = oItem.Value.Description
Dim oItemType = oItem.Value.ItemType Dim oItemType = oItem.Value.ItemType
Dim oEN16931_ID = oItem.Value.EN16931_ID
Try Try
oPropertyValueList = GetPropValue(pDocument, oItem.Key) oPropertyValueList = GetPropValue(pDocument, oItem.Key)
Catch ex As Exception Catch ex As Exception
_logger.Warn("{2} # Unknown error occurred while fetching specification [{0}] in group [{1}]:", oPropertyDescription, oItem.Value.GroupScope, MessageId) _logger.Warn("{2} - Unknown error occurred while fetching specification [{0}] in group [{1}]:", oTableColumn, oItem.Value.GroupScope, MessageId)
_logger.Warn("ERROR-MESSAGE [{0}]", ex.Message) _logger.Warn("ERROR-MESSAGE [{0}]", ex.Message)
_logger.Error(ex) _logger.Error(ex)
oPropertyValueList = New List(Of Object) oPropertyValueList = New List(Of Object)
@ -192,20 +218,20 @@ Public Class PropertyValues
' This should hopefully show config errors ' This should hopefully show config errors
If TypeOf oPropertyValue Is List(Of Object) Then If TypeOf oPropertyValue Is List(Of Object) Then
_logger.Warn("Item with specification [{0}] may be configured incorrectly", oPropertyDescription) _logger.Warn("Item with specification [{0}] may be configured incorrectly", oTableColumn)
oPropertyValue = Nothing oPropertyValue = Nothing
End If End If
End Select End Select
End If End If
Catch ex As Exception Catch ex As Exception
_logger.Warn("Unknown error occurred while processing specification [{0}]:", oPropertyDescription) _logger.Warn("Unknown error occurred while processing specification [{0}]:", oTableColumn)
_logger.Error(ex) _logger.Error(ex)
oPropertyValue = Nothing oPropertyValue = Nothing
End Try End Try
If IsNothing(oPropertyValue) OrElse String.IsNullOrEmpty(oPropertyValue) Then If IsNothing(oPropertyValue) OrElse String.IsNullOrEmpty(oPropertyValue) Then
If oItem.Value.IsRequired Then If oItem.Value.IsRequired Then
_logger.Warn("{0} # Specification [{1}] is empty, but marked as required! Skipping.", MessageId, oPropertyDescription) _logger.Warn("Specification [{0}] is empty, but marked as required! Skipping.", oTableColumn)
Dim oMissingProperty = New MissingProperty With Dim oMissingProperty = New MissingProperty With
{ {
.Description = oPropertyDescription, .Description = oPropertyDescription,
@ -214,15 +240,22 @@ Public Class PropertyValues
oResult.MissingProperties.Add(oMissingProperty) oResult.MissingProperties.Add(oMissingProperty)
Continue For Continue For
Else Else
_logger.Debug("{0} # oPropertyValue for specification [{1}] is empty or not found. Skipping.", MessageId, oPropertyDescription) _logger.Debug("oPropertyValue for specification [{0}] is empty or not found. Skipping.", oTableColumn)
Continue For Continue For
End If End If
End If End If
' Statt dem Zahlenwert des Enums, wollen wir die Währunsgbezeichnung ' Statt dem Zahlenwert des Enums, wollen wir die Währungsbezeichnung
If oTableColumn = "INVOICE_CURRENCY" Then If oTableColumn = "INVOICE_CURRENCY" Or oItemType = 4 Then
oPropertyValue = oPropertyValue.ToString() Dim oValuestring = oPropertyValue.ToString()
' Bei Listenelementen entfernen wir den String Item, um den Wert zu erhalten
If oValuestring.Contains("Item") Then
oValuestring = oValuestring.Replace("Item", "")
End If
oPropertyValue = oValuestring
End If End If
oResult.ValidProperties.Add(New ValidProperty() With { oResult.ValidProperties.Add(New ValidProperty() With {
@ -233,7 +266,8 @@ Public Class PropertyValues
.TableColumn = oTableColumn, .TableColumn = oTableColumn,
.IsRequired = oIsRequired, .IsRequired = oIsRequired,
.XMLPath = oPropertyPath, .XMLPath = oPropertyPath,
.ItemType = oItemType .ItemType = oItemType,
.EN16931_ID = oEN16931_ID
}) })
Next Next
@ -280,17 +314,11 @@ Public Class PropertyValues
Obj = oInfo.GetValue(Obj, Nothing) Obj = oInfo.GetValue(Obj, Nothing)
' TODO: This code should check for array properties by itself
' and should not rely on the user to
'If oInfo.PropertyType.IsArray Then
' Obj = Obj(0)
'End If
If oHasIndex Then If oHasIndex Then
Obj = Obj(0) Obj = Obj(0)
End If End If
If IsArray(Obj) And Not oHasIndex Then If IsArray(Obj) And Not oHasIndex And oPart <> "Value" Then
Dim oCurrentPart As String = oPart Dim oCurrentPart As String = oPart
Dim oSplitString As String() = New String() {oCurrentPart & "."} Dim oSplitString As String() = New String() {oCurrentPart & "."}
Dim oPathFragments = PropertyName.Split(oSplitString, StringSplitOptions.None) Dim oPathFragments = PropertyName.Split(oSplitString, StringSplitOptions.None)
@ -310,8 +338,56 @@ Public Class PropertyValues
Next Next
Return oResults Return oResults
End If Else
If oPart = "Value" AndAlso Obj IsNot Nothing Then
' Der Name des gefundenen Datentyps
Dim oObjType = oInfo.PropertyType.FullName
If oObjType.Equals("System.DateTime", StringComparison.OrdinalIgnoreCase) Then
Dim d As Date
Dim s As String
Dim oResult As String
s = Convert.ToString(Obj)
If IsDate(s) = True Then
' Hier wird das DEFAULT-Format auf yyyyMMdd gesetzt
Dim dtfi As DateTimeFormatInfo = CultureInfo.CreateSpecificCulture(CultureInfo.InvariantCulture.Name).DateTimeFormat
dtfi.DateSeparator = ""
dtfi.ShortDatePattern = "yyyyMMdd"
d = CDate(s)
oResult = d.ToString("d", dtfi)
'Return New List(Of Object) From {oResult}
Dim oRetValue As List(Of Object) = New List(Of Object) From {
oResult
}
Return oRetValue
End If
ElseIf oObjType.Equals("System.Decimal", StringComparison.OrdinalIgnoreCase) Then
Dim oResult As String
If IsNumeric(Obj) = True Then
Dim decValue As Decimal = CDec(Obj)
' Es wird immer ein . als Dezimaltrenner verwendet, falls nötig
oResult = decValue.ToString(CultureInfo.InvariantCulture)
'Return New List(Of Object) From {oResult}
Dim oRetValue As List(Of Object) = New List(Of Object) From {
oResult
}
Return oRetValue
End If
End If
End If
End If
Next Next
Return New List(Of Object) From {Obj} Return New List(Of Object) From {Obj}
@ -339,8 +415,20 @@ Public Class PropertyValues
Select Case oCount Select Case oCount
Case 0 Case 0
Return Nothing Return Nothing
Case 1
Dim firstElement As Object
firstElement = oList.FirstOrDefault()
If firstElement IsNot Nothing AndAlso IsArray(firstElement) Then
' Attachments sind Byte-Arrays und müssen umgewandelt werden
Return Convert.ToBase64String(firstElement)
Else
Return DoGetFinalPropValue(oList.First())
End If
Case Else Case Else
Return DoGetFinalPropValue(oList.First()) Return DoGetFinalPropValue(oList.First())
End Select End Select
Return DoGetFinalPropValue(Value) Return DoGetFinalPropValue(Value)

View File

@ -0,0 +1,8 @@
Public Class RejectionStringRow
Public ModuleName As String
Public Title As String
Public Caption As String
Public Language As String
Public String1 As String
End Class

View File

@ -14,6 +14,7 @@ Public Class Validator
ValidateDecimalNodes(pResult) ValidateDecimalNodes(pResult)
ValidateCurrencyNodes(pResult) ValidateCurrencyNodes(pResult)
'TODO Validate Datumsfelder
Return pResult Return pResult
End Function End Function
@ -29,7 +30,7 @@ Public Class Validator
.ElementName = oNode.Name.LocalName, .ElementName = oNode.Name.LocalName,
.ElementValue = oNode.Value, .ElementValue = oNode.Value,
.ErrorMessage = "Value could not be parsed as Decimal.", .ErrorMessage = "Value could not be parsed as Decimal.",
.ErrorMessageDE = "Der Wert konnte nicht in eine Dezimalzahl umgewandelt werden." .ErrorMessageDE = "Der Wert ist keine Dezimalzahl."
}) })
End If End If
Next Next

View File

@ -22,7 +22,14 @@
''' 0 = Default / Text ''' 0 = Default / Text
''' 1 = Datum ''' 1 = Datum
''' 2 = Gleitkomma ''' 2 = Gleitkomma
''' 3 = Memo-Feld ''' 3 = Attachment-Felder
''' 4 = Elemente einer Liste, vgl Currency
''' </summary> ''' </summary>
Public ItemType As Integer Public ItemType As Integer
''' <summary>
''' BT-Feld-Bezeichnung
''' </summary>
Public EN16931_ID As String
End Class End Class

View File

@ -40,7 +40,7 @@
</dependentAssembly> </dependentAssembly>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> <assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.5" newVersion="8.0.0.5" /> <bindingRedirect oldVersion="0.0.0.0-8.0.0.6" newVersion="8.0.0.6" />
</dependentAssembly> </dependentAssembly>
</assemblyBinding> </assemblyBinding>
</runtime> </runtime>

View File

@ -26,7 +26,7 @@
<package id="System.Runtime.CompilerServices.Unsafe" version="6.1.0" targetFramework="net462" /> <package id="System.Runtime.CompilerServices.Unsafe" version="6.1.0" targetFramework="net462" />
<package id="System.Security.Cryptography.Pkcs" version="8.0.1" targetFramework="net462" /> <package id="System.Security.Cryptography.Pkcs" version="8.0.1" targetFramework="net462" />
<package id="System.Text.Encodings.Web" version="8.0.0" targetFramework="net462" /> <package id="System.Text.Encodings.Web" version="8.0.0" targetFramework="net462" />
<package id="System.Text.Json" version="8.0.5" targetFramework="net462" /> <package id="System.Text.Json" version="8.0.6" targetFramework="net462" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net462" /> <package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net462" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net462" /> <package id="System.ValueTuple" version="4.5.0" targetFramework="net462" />
</packages> </packages>

View File

@ -5,6 +5,8 @@
</startup> </startup>
<runtime> <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity name="GdPicture.NET.14" publicKeyToken="f52a2e60ad468dbb" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-14.3.9.0" newVersion="14.3.9.0" />
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="FirebirdSql.Data.FirebirdClient" publicKeyToken="3750abcc3150b00c" culture="neutral" /> <assemblyIdentity name="FirebirdSql.Data.FirebirdClient" publicKeyToken="3750abcc3150b00c" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.5.0.0" newVersion="7.5.0.0" /> <bindingRedirect oldVersion="0.0.0.0-7.5.0.0" newVersion="7.5.0.0" />
@ -43,7 +45,7 @@
</dependentAssembly> </dependentAssembly>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> <assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.5" newVersion="8.0.0.5" /> <bindingRedirect oldVersion="0.0.0.0-8.0.0.6" newVersion="8.0.0.6" />
</dependentAssembly> </dependentAssembly>
</assemblyBinding> </assemblyBinding>
</runtime> </runtime>

View File

@ -67,18 +67,6 @@
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Base\Base.vbproj">
<Project>{6ea0c51f-c2b1-4462-8198-3de0b32b74f8}</Project>
<Name>Base</Name>
</ProjectReference>
<ProjectReference Include="..\Config\Config.vbproj">
<Project>{44982f9b-6116-44e2-85d0-f39650b1ef99}</Project>
<Name>Config</Name>
</ProjectReference>
<ProjectReference Include="..\Database\Database.vbproj">
<Project>{eaf0ea75-5fa7-485d-89c7-b2d843b03a96}</Project>
<Name>Database</Name>
</ProjectReference>
<ProjectReference Include="..\Interfaces\Interfaces.vbproj"> <ProjectReference Include="..\Interfaces\Interfaces.vbproj">
<Project>{ab6f09bf-e794-4f6a-94bb-c97c0ba84d64}</Project> <Project>{ab6f09bf-e794-4f6a-94bb-c97c0ba84d64}</Project>
<Name>Interfaces</Name> <Name>Interfaces</Name>
@ -125,6 +113,18 @@
<Reference Include="BouncyCastle.Cryptography, Version=2.0.0.0, Culture=neutral, PublicKeyToken=072edcf4a5328938, processorArchitecture=MSIL"> <Reference Include="BouncyCastle.Cryptography, Version=2.0.0.0, Culture=neutral, PublicKeyToken=072edcf4a5328938, processorArchitecture=MSIL">
<HintPath>..\packages\BouncyCastle.Cryptography.2.5.0\lib\net461\BouncyCastle.Cryptography.dll</HintPath> <HintPath>..\packages\BouncyCastle.Cryptography.2.5.0\lib\net461\BouncyCastle.Cryptography.dll</HintPath>
</Reference> </Reference>
<Reference Include="DigitalData.Modules.Base">
<HintPath>..\Base\bin\Debug\DigitalData.Modules.Base.dll</HintPath>
</Reference>
<Reference Include="DigitalData.Modules.Config">
<HintPath>..\Config\bin\Debug\DigitalData.Modules.Config.dll</HintPath>
</Reference>
<Reference Include="DigitalData.Modules.Database">
<HintPath>..\Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
</Reference>
<Reference Include="DigitalData.Modules.Logging">
<HintPath>..\Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
</Reference>
<Reference Include="DocumentFormat.OpenXml, Version=3.2.0.0, Culture=neutral, PublicKeyToken=8fb06cb64d019a17, processorArchitecture=MSIL"> <Reference Include="DocumentFormat.OpenXml, Version=3.2.0.0, Culture=neutral, PublicKeyToken=8fb06cb64d019a17, processorArchitecture=MSIL">
<HintPath>..\packages\DocumentFormat.OpenXml.3.2.0\lib\net46\DocumentFormat.OpenXml.dll</HintPath> <HintPath>..\packages\DocumentFormat.OpenXml.3.2.0\lib\net46\DocumentFormat.OpenXml.dll</HintPath>
</Reference> </Reference>
@ -134,74 +134,80 @@
<Reference Include="FirebirdSql.Data.FirebirdClient, Version=7.5.0.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c, processorArchitecture=MSIL"> <Reference Include="FirebirdSql.Data.FirebirdClient, Version=7.5.0.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c, processorArchitecture=MSIL">
<HintPath>..\packages\FirebirdSql.Data.FirebirdClient.7.5.0\lib\net452\FirebirdSql.Data.FirebirdClient.dll</HintPath> <HintPath>..\packages\FirebirdSql.Data.FirebirdClient.7.5.0\lib\net452\FirebirdSql.Data.FirebirdClient.dll</HintPath>
</Reference> </Reference>
<Reference Include="GdPicture.NET.14, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL"> <Reference Include="GdPicture.NET.14, Version=14.3.19.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.dll</HintPath> <HintPath>..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.dll</HintPath>
</Reference> </Reference>
<Reference Include="GdPicture.NET.14.barcode.1d.writer, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL"> <Reference Include="GdPicture.NET.14.barcode.1d.writer, Version=14.3.19.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.barcode.1d.writer.dll</HintPath> <HintPath>..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.barcode.1d.writer.dll</HintPath>
</Reference> </Reference>
<Reference Include="GdPicture.NET.14.barcode.2d.writer, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL"> <Reference Include="GdPicture.NET.14.barcode.2d.writer, Version=14.3.19.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.barcode.2d.writer.dll</HintPath> <HintPath>..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.barcode.2d.writer.dll</HintPath>
</Reference> </Reference>
<Reference Include="GdPicture.NET.14.CAD, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL"> <Reference Include="GdPicture.NET.14.CAD, Version=14.3.19.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.CAD.dll</HintPath> <HintPath>..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.CAD.dll</HintPath>
</Reference> </Reference>
<Reference Include="GdPicture.NET.14.CAD.DWG, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL"> <Reference Include="GdPicture.NET.14.CAD.DWG, Version=14.3.19.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.CAD.DWG.dll</HintPath> <HintPath>..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.CAD.DWG.dll</HintPath>
</Reference> </Reference>
<Reference Include="GdPicture.NET.14.Common, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL"> <Reference Include="GdPicture.NET.14.Common, Version=14.3.19.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.Common.dll</HintPath> <HintPath>..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.Common.dll</HintPath>
</Reference> </Reference>
<Reference Include="GdPicture.NET.14.Document, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL"> <Reference Include="GdPicture.NET.14.Document, Version=14.3.19.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.Document.dll</HintPath> <HintPath>..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.Document.dll</HintPath>
</Reference> </Reference>
<Reference Include="GdPicture.NET.14.Email, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL"> <Reference Include="GdPicture.NET.14.Email, Version=14.3.19.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.Email.dll</HintPath> <HintPath>..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.Email.dll</HintPath>
</Reference> </Reference>
<Reference Include="GdPicture.NET.14.HTML, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL"> <Reference Include="GdPicture.NET.14.HTML, Version=14.3.19.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.HTML.dll</HintPath> <HintPath>..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.HTML.dll</HintPath>
</Reference> </Reference>
<Reference Include="GdPicture.NET.14.Imaging, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL"> <Reference Include="GdPicture.NET.14.Imaging, Version=14.3.19.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.Imaging.dll</HintPath> <HintPath>..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.Imaging.dll</HintPath>
</Reference> </Reference>
<Reference Include="GdPicture.NET.14.Imaging.Formats, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL"> <Reference Include="GdPicture.NET.14.Imaging.Formats, Version=14.3.19.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.Imaging.Formats.dll</HintPath> <HintPath>..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.Imaging.Formats.dll</HintPath>
</Reference> </Reference>
<Reference Include="GdPicture.NET.14.Imaging.Formats.Conversion, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL"> <Reference Include="GdPicture.NET.14.Imaging.Formats.Conversion, Version=14.3.19.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.Imaging.Formats.Conversion.dll</HintPath> <HintPath>..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.Imaging.Formats.Conversion.dll</HintPath>
</Reference> </Reference>
<Reference Include="GdPicture.NET.14.Imaging.Rendering, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL"> <Reference Include="GdPicture.NET.14.Imaging.Rendering, Version=14.3.19.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.Imaging.Rendering.dll</HintPath> <HintPath>..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.Imaging.Rendering.dll</HintPath>
</Reference> </Reference>
<Reference Include="GdPicture.NET.14.MSOfficeBinary, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL"> <Reference Include="GdPicture.NET.14.MSOfficeBinary, Version=14.3.19.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.MSOfficeBinary.dll</HintPath> <HintPath>..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.MSOfficeBinary.dll</HintPath>
</Reference> </Reference>
<Reference Include="GdPicture.NET.14.OpenDocument, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL"> <Reference Include="GdPicture.NET.14.OpenDocument, Version=14.3.19.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.OpenDocument.dll</HintPath> <HintPath>..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.OpenDocument.dll</HintPath>
</Reference> </Reference>
<Reference Include="GdPicture.NET.14.OpenXML, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL"> <Reference Include="GdPicture.NET.14.OpenXML, Version=14.3.19.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.OpenXML.dll</HintPath> <HintPath>..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.OpenXML.dll</HintPath>
</Reference> </Reference>
<Reference Include="GdPicture.NET.14.OpenXML.Templating, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL"> <Reference Include="GdPicture.NET.14.OpenXML.Templating, Version=14.3.19.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.OpenXML.Templating.dll</HintPath> <HintPath>..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.OpenXML.Templating.dll</HintPath>
</Reference> </Reference>
<Reference Include="GdPicture.NET.14.PDF, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL"> <Reference Include="GdPicture.NET.14.PDF, Version=14.3.19.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.PDF.dll</HintPath> <HintPath>..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.PDF.dll</HintPath>
</Reference> </Reference>
<Reference Include="GdPicture.NET.14.RTF, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL"> <Reference Include="GdPicture.NET.14.RTF, Version=14.3.19.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.RTF.dll</HintPath> <HintPath>..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.RTF.dll</HintPath>
</Reference> </Reference>
<Reference Include="GdPicture.NET.14.SVG, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL"> <Reference Include="GdPicture.NET.14.SVG, Version=14.3.19.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.SVG.dll</HintPath> <HintPath>..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.SVG.dll</HintPath>
</Reference> </Reference>
<Reference Include="GdPicture.NET.14.wia.gateway, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6973b5c22dcf45f7, processorArchitecture=MSIL"> <Reference Include="GdPicture.NET.14.wia.gateway, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6973b5c22dcf45f7, processorArchitecture=MSIL">
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.wia.gateway.dll</HintPath> <HintPath>..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.wia.gateway.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes> <EmbedInteropTypes>True</EmbedInteropTypes>
</Reference> </Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> <Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath> <HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference> </Reference>
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
<Reference Include="NativeSDK.Settings, Version=14.3.19.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
<HintPath>..\packages\GdPicture.14.3.19\lib\net462\NativeSDK.Settings.dll</HintPath>
</Reference>
<Reference Include="NativeSDK.Settings.Edition, Version=14.3.19.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
<HintPath>..\packages\GdPicture.14.3.19\lib\net462\NativeSDK.Settings.Edition.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference> </Reference>
@ -227,9 +233,6 @@
<Reference Include="System.Buffers, Version=4.0.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> <Reference Include="System.Buffers, Version=4.0.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.6.0\lib\net462\System.Buffers.dll</HintPath> <HintPath>..\packages\System.Buffers.4.6.0\lib\net462\System.Buffers.dll</HintPath>
</Reference> </Reference>
<Reference Include="System.CodeDom, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.CodeDom.8.0.0\lib\net462\System.CodeDom.dll</HintPath>
</Reference>
<Reference Include="System.Collections.Immutable, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <Reference Include="System.Collections.Immutable, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Collections.Immutable.8.0.0\lib\net462\System.Collections.Immutable.dll</HintPath> <HintPath>..\packages\System.Collections.Immutable.8.0.0\lib\net462\System.Collections.Immutable.dll</HintPath>
</Reference> </Reference>
@ -264,8 +267,8 @@
<Reference Include="System.Text.Encodings.Web, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> <Reference Include="System.Text.Encodings.Web, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Encodings.Web.8.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath> <HintPath>..\packages\System.Text.Encodings.Web.8.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath>
</Reference> </Reference>
<Reference Include="System.Text.Json, Version=8.0.0.5, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> <Reference Include="System.Text.Json, Version=8.0.0.6, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Json.8.0.5\lib\net462\System.Text.Json.dll</HintPath> <HintPath>..\packages\System.Text.Json.8.0.6\lib\net462\System.Text.Json.dll</HintPath>
</Reference> </Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> <Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath> <HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
@ -282,11 +285,11 @@
<PropertyGroup> <PropertyGroup>
<PostBuildEvent>powershell.exe -command "&amp; { &amp;'$(SolutionDir)copy-binary.ps1' '$(TargetPath)' '$(TargetFileName)' '$(ConfigurationName)' '$(ProjectName)' }"</PostBuildEvent> <PostBuildEvent>powershell.exe -command "&amp; { &amp;'$(SolutionDir)copy-binary.ps1' '$(TargetPath)' '$(TargetFileName)' '$(ConfigurationName)' '$(ProjectName)' }"</PostBuildEvent>
</PropertyGroup> </PropertyGroup>
<Import Project="..\packages\GdPicture.runtimes.windows.14.3.3\build\net462\GdPicture.runtimes.windows.targets" Condition="Exists('..\packages\GdPicture.runtimes.windows.14.3.3\build\net462\GdPicture.runtimes.windows.targets')" /> <Import Project="..\packages\GdPicture.runtimes.windows.14.3.19\build\net462\GdPicture.runtimes.windows.targets" Condition="Exists('..\packages\GdPicture.runtimes.windows.14.3.19\build\net462\GdPicture.runtimes.windows.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup> <PropertyGroup>
<ErrorText>Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}".</ErrorText> <ErrorText>Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}".</ErrorText>
</PropertyGroup> </PropertyGroup>
<Error Condition="!Exists('..\packages\GdPicture.runtimes.windows.14.3.3\build\net462\GdPicture.runtimes.windows.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\GdPicture.runtimes.windows.14.3.3\build\net462\GdPicture.runtimes.windows.targets'))" /> <Error Condition="!Exists('..\packages\GdPicture.runtimes.windows.14.3.19\build\net462\GdPicture.runtimes.windows.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\GdPicture.runtimes.windows.14.3.19\build\net462\GdPicture.runtimes.windows.targets'))" />
</Target> </Target>
</Project> </Project>

View File

@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices
<Assembly: AssemblyCompany("Digital Data")> <Assembly: AssemblyCompany("Digital Data")>
<Assembly: AssemblyProduct("Modules.Jobs")> <Assembly: AssemblyProduct("Modules.Jobs")>
<Assembly: AssemblyCopyright("Copyright © 2025")> <Assembly: AssemblyCopyright("Copyright © 2025")>
<Assembly: AssemblyTrademark("2.9.3.0")> <Assembly: AssemblyTrademark("3.0.3.0")>
<Assembly: ComVisible(False)> <Assembly: ComVisible(False)>
@ -30,5 +30,5 @@ Imports System.Runtime.InteropServices
' Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern ' Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
' übernehmen, indem Sie "*" eingeben: ' übernehmen, indem Sie "*" eingeben:
<Assembly: AssemblyVersion("2.9.3.0")> <Assembly: AssemblyVersion("3.5.0.0")>
<Assembly: AssemblyFileVersion("2.9.3.0")> <Assembly: AssemblyFileVersion("3.5.0.0")>

View File

@ -33,11 +33,6 @@ Public Class HashFunctions
End If End If
' Check if Checksum exists in History Table ' Check if Checksum exists in History Table
'Dim oCheckCommand = $"SELECT * FROM TBEDM_ZUGFERD_HISTORY_IN WHERE GUID = (SELECT MAX(GUID) FROM TBEDM_ZUGFERD_HISTORY_IN WHERE UPPER(MD5HASH) = UPPER('{oMD5CheckSum}'))"
'Dim oTable As DataTable = _firebird.GetDatatable(oCheckCommand, Firebird.TransactionMode.NoTransaction)
' Check if Checksum exists in History Table
' TODO: WHAT THE FUCK IS THIS
Dim oCheckCommand = $"SELECT * FROM TBEMLP_HISTORY WHERE GUID = (SELECT MAX(GUID) FROM TBEMLP_HISTORY WHERE UPPER(MD5HASH) = UPPER('{oMD5CheckSum}'))" Dim oCheckCommand = $"SELECT * FROM TBEMLP_HISTORY WHERE GUID = (SELECT MAX(GUID) FROM TBEMLP_HISTORY WHERE UPPER(MD5HASH) = UPPER('{oMD5CheckSum}'))"
Dim oTable As DataTable = Database.GetDatatable(oCheckCommand, MSSQLServer.TransactionMode.NoTransaction) Dim oTable As DataTable = Database.GetDatatable(oCheckCommand, MSSQLServer.TransactionMode.NoTransaction)

View File

@ -11,6 +11,7 @@ Imports DigitalData.Modules.Interfaces.Exceptions
Imports DigitalData.Modules.Interfaces.PropertyValues Imports DigitalData.Modules.Interfaces.PropertyValues
Imports DigitalData.Modules.Jobs.Exceptions Imports DigitalData.Modules.Jobs.Exceptions
Imports DigitalData.Modules.Logging Imports DigitalData.Modules.Logging
Imports GdPicture14
Public Class ImportZUGFeRDFiles Public Class ImportZUGFeRDFiles
Implements IJob Implements IJob
@ -27,10 +28,35 @@ Public Class ImportZUGFeRDFiles
Private Const DIRECTORY_DONT_MOVE = "DIRECTORY_DONT_MOVE" Private Const DIRECTORY_DONT_MOVE = "DIRECTORY_DONT_MOVE"
Private Const MIME_TYPE_PDF = "application/pdf"
Private Const MIME_TYPE_XLSX = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
Private Const MIME_TYPE_ODT = "application/vnd.oasis.opendocument.spreadsheet"
' List of allowed extensions for PDF/A Attachments ' List of allowed extensions for PDF/A Attachments
' This list should not contain xml so the zugferd xml file will be filtered out ' This list should not contain xml so the zugferd xml file will be filtered out
Private ReadOnly AllowedExtensions As New List(Of String) From {"docx", "doc", "pdf", "xls", "xlsx", "ppt", "pptx", "txt"} Private ReadOnly AllowedExtensions As New List(Of String) From {"docx", "doc", "pdf", "xls", "xlsx", "ppt", "pptx", "txt"}
' List of the Columns we need to store embedded files on disk and database
Private ReadOnly EmbeddedFilesColumnNames As List(Of String) = New List(Of String) From {
"ATTACHMENT_FILE_FILENAME", "ATTACHMENT_FILE_VALUE", "ATTACHMENT_FILE_MIMECODE"
}
' List of the allowed MIME-Codes
' Allowed Values are:
'- application/pdf
'- application/vnd.openxmlformats-officedocument.spreadsheetml.sheet (xlsx)
'- application/vnd.oasis.opendocument.spreadsheet (odt)
'- image/jpeg
'- image/png
'- image/tiff (UBL)
'- text/csv
'- text/xml (UBL)
Private ReadOnly AllowedMimeTypesInEmbeddedFiles As List(Of String) = New List(Of String) From {
MIME_TYPE_PDF,
MIME_TYPE_XLSX,
MIME_TYPE_ODT
}
Private ReadOnly _logger As Logger Private ReadOnly _logger As Logger
Private ReadOnly _logConfig As LogConfig Private ReadOnly _logConfig As LogConfig
Private ReadOnly _filesystem As FilesystemEx Private ReadOnly _filesystem As FilesystemEx
@ -140,8 +166,6 @@ Public Class ImportZUGFeRDFiles
' Start a new transaction for each file group. ' Start a new transaction for each file group.
' This way we can rollback database changes for the whole filegroup in case something goes wrong. ' This way we can rollback database changes for the whole filegroup in case something goes wrong.
Dim oSQLConnection As SqlConnection = _mssql.GetConnection() Dim oSQLConnection As SqlConnection = _mssql.GetConnection()
Dim oSQLTransaction As SqlTransaction = oSQLConnection?.BeginTransaction() Dim oSQLTransaction As SqlTransaction = oSQLConnection?.BeginTransaction()
Dim oConnections As New DatabaseConnections() With { Dim oConnections As New DatabaseConnections() With {
@ -194,7 +218,7 @@ Public Class ImportZUGFeRDFiles
End If End If
If oResult.ZugferdFileFound = True Then If oResult.ZugferdFileFound = True Then
_logger.Debug("Zugferd File found") _logger.Debug("eInvoice File found")
oMD5CheckSum = oResult.MD5Checksum oMD5CheckSum = oResult.MD5Checksum
oZUGFeRDCount = oResult.ZugferdFileCount oZUGFeRDCount = oResult.ZugferdFileCount
oEmailAttachmentFiles.AddRange(oResult.EmailAttachmentFiles) oEmailAttachmentFiles.AddRange(oResult.EmailAttachmentFiles)
@ -311,7 +335,7 @@ Public Class ImportZUGFeRDFiles
Dim oBody = String.Format(EmailStrings.EMAIL_TOO_MUCH_FERDS, oEmailData.Subject) Dim oBody = String.Format(EmailStrings.EMAIL_TOO_MUCH_FERDS, oEmailData.Subject)
_email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "TooMuchFerdsException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.TooMuchFerdsException, "", "") _email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "TooMuchFerdsException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.TooMuchFerdsException, "", "")
AddRejectedState(oMessageId, oRejectionCodeString, "Email enthielt mehr als ein ZUGFeRD-Dokument", "", oSQLTransaction) AddRejectedState(oMessageId, oRejectionCodeString, "Email enthielt mehr als ein eInvoice-Dokument", "", oSQLTransaction)
Catch ex As NoFerdsException Catch ex As NoFerdsException
_logger.Error(ex) _logger.Error(ex)
@ -324,7 +348,7 @@ Public Class ImportZUGFeRDFiles
Dim oBody = String.Format(EmailStrings.EMAIL_NO_FERDS, oEmailData.Subject) Dim oBody = String.Format(EmailStrings.EMAIL_NO_FERDS, oEmailData.Subject)
_email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "NoFerdsException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.NoFerdsException, "", "") _email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "NoFerdsException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.NoFerdsException, "", "")
AddRejectedState(oMessageId, oRejectionCodeString, "Email enthielt keine ZUGFeRD-Dokumente", "", oSQLTransaction) AddRejectedState(oMessageId, oRejectionCodeString, "Email enthielt keine eInvoice-Dokumente", "", oSQLTransaction)
Catch ex As MissingValueException Catch ex As MissingValueException
_logger.Error(ex) _logger.Error(ex)
@ -343,7 +367,7 @@ Public Class ImportZUGFeRDFiles
Dim oEmailData = _file.MoveAndRenameEmailToRejected(oArgs, oMessageId) Dim oEmailData = _file.MoveAndRenameEmailToRejected(oArgs, oMessageId)
_email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "MissingValueException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.MissingValueException, oOrgFilename, oMissingFieldList) _email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "MissingValueException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.MissingValueException, oOrgFilename, oMissingFieldList)
AddRejectedState(oMessageId, oRejectionCodeString, "Es fehlten ZugferdSpezifikationen", "", oSQLTransaction) AddRejectedState(oMessageId, oRejectionCodeString, "Es fehlten eInvoice-Spezifikationen", "", oSQLTransaction)
Catch ex As FileSizeLimitReachedException Catch ex As FileSizeLimitReachedException
_logger.Error(ex) _logger.Error(ex)
@ -376,7 +400,7 @@ Public Class ImportZUGFeRDFiles
Dim oBody = _email.CreateBodyForUnhandledException(oMessageId, ex) Dim oBody = _email.CreateBodyForUnhandledException(oMessageId, ex)
Dim oEmailData As New EmailData With { Dim oEmailData As New EmailData With {
.From = oArgs.ExceptionEmailAddress, .From = oArgs.ExceptionEmailAddress,
.Subject = $"OutOfMemoryException im ZUGFeRD-Parser @ {oMessageId}" .Subject = $"OutOfMemoryException im eInvoice-Parser @ {oMessageId}"
} }
_email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "OutOfMemoryException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.UnhandledException, ex.Message, ex.StackTrace) _email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "OutOfMemoryException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.UnhandledException, ex.Message, ex.StackTrace)
@ -399,7 +423,7 @@ Public Class ImportZUGFeRDFiles
Dim oBody = _email.CreateBodyForUnhandledException(oMessageId, ex) Dim oBody = _email.CreateBodyForUnhandledException(oMessageId, ex)
Dim oEmailData As New EmailData With { Dim oEmailData As New EmailData With {
.From = oArgs.ExceptionEmailAddress, .From = oArgs.ExceptionEmailAddress,
.Subject = $"UnhandledException im ZUGFeRD-Parser @ {oMessageId}" .Subject = $"UnhandledException im eInvoice-Parser @ {oMessageId}"
} }
_email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "UnhandledException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.UnhandledException, ex.Message, ex.StackTrace) _email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "UnhandledException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.UnhandledException, ex.Message, ex.StackTrace)
@ -415,7 +439,8 @@ Public Class ImportZUGFeRDFiles
If oMoveDirectory = DIRECTORY_DONT_MOVE Then If oMoveDirectory = DIRECTORY_DONT_MOVE Then
_logger.Info("Application Error occurred. Files for message Id {0} will not be moved.", oMessageId) _logger.Info("Application Error occurred. Files for message Id {0} will not be moved.", oMessageId)
ElseIf oArgs.AllowXRechnung And oIsSuccess And oEInvoiceFileGroup.Item(0).Extension = ".xml" Then ElseIf oArgs.AllowXRechnung And oIsSuccess And
oEInvoiceFileGroup.Item(0).Extension.Equals(".xml", StringComparison.OrdinalIgnoreCase) = True Then
_logger.Debug("Before Creating the PDF-File from XML data / Before Commit") _logger.Debug("Before Creating the PDF-File from XML data / Before Commit")
oxRechnungHandle = True oxRechnungHandle = True
@ -455,7 +480,7 @@ Public Class ImportZUGFeRDFiles
Dim oBody = _email.CreateBodyForUnhandledException(oMessageId, ex) Dim oBody = _email.CreateBodyForUnhandledException(oMessageId, ex)
Dim oEmailData As New EmailData With { Dim oEmailData As New EmailData With {
.From = oArgs.ExceptionEmailAddress, .From = oArgs.ExceptionEmailAddress,
.Subject = $"FileMoveException im ZUGFeRD-Parser @ {oMessageId}" .Subject = $"FileMoveException im eInvoice-Parser @ {oMessageId}"
} }
_email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "FileMoveException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.UnhandledException, ex.Message, ex.StackTrace) _email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "FileMoveException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.UnhandledException, ex.Message, ex.StackTrace)
@ -534,36 +559,46 @@ Public Class ImportZUGFeRDFiles
Try Try
oDocument = _zugferd.GetSerializedXMLContentFromFile(pFile) oDocument = _zugferd.GetSerializedXMLContentFromFile(pFile)
oDocument.ReceiptFileType = ZUGFeRDInterface.RECEIPT_TYPE_XML
Catch ex As ValidationException Catch ex As ValidationException
Throw ex Throw ex
Catch ex As ZUGFeRDExecption Catch ex As ZUGFeRDExecption
Select Case ex.ErrorType
Case ZUGFeRDInterface.ErrorType.NoZugferd
_logger.Info("File [{0}] is not a valid ZUGFeRD document. Skipping.", pFile.Name)
oResult.EmailAttachmentFiles.Add(pFile) If ex.ErrorCode > 0 Then
Return oResult _logger.Info("New Rejection Logik")
Case ZUGFeRDInterface.ErrorType.UnsupportedFormat Select Case ex.ErrorCode
_logger.Info("File [{0}/{1}] is an unsupported ZUFeRD document format!", pFile.Name, ex.XmlFile) Case ErrorCode.NoFerdsException
Throw New UnsupportedFerdException(ex.XmlFile) _logger.Info("File [{0}] is not a valid eInvoice document. Skipping.", pFile.Name)
Case ZUGFeRDInterface.ErrorType.NoValidZugferd oResult.EmailAttachmentFiles.Add(pFile)
_logger.Info("File [{0}] is an Incorrectly formatted ZUGFeRD document!", pFile.Name) Return oResult
Throw New InvalidFerdException()
Case Else Case ErrorCode.UnsupportedFerdException
_logger.Warn("Unexpected Error occurred while extracting ZUGFeRD Information from file {0}", pFile.Name) _logger.Info("File [{0}/{1}] is an unsupported eInvoice document format!", pFile.Name, ex.XmlFile)
Throw ex Throw New UnsupportedFerdException(ex.XmlFile)
End Select
Case ErrorCode.InvalidFerdException
_logger.Info("File [{0}] is an incorrectly formatted eInvoice document!", pFile.Name)
Throw New InvalidFerdException()
Case Else
_logger.Warn("Unexpected Error occurred while extracting eInvoice Information from file {0}", pFile.Name)
Throw ex
End Select
End If
End Try End Try
Try Try
oDocument.ReceiptFileType = ZUGFeRDInterface.RECEIPT_TYPE_XML Dim sqlResult As Boolean = False
Dim sqlResult As Boolean = StoreXMLItemsInDatabase(pMessageId, oDocument, pFile, pConnections, pArgs)
If oDocument IsNot Nothing Then
sqlResult = StoreXMLItemsInDatabase(pMessageId, oDocument, pFile, pConnections, pArgs, oResult)
End If
Catch ex As Exception Catch ex As Exception
Throw ex Throw ex
End Try End Try
@ -606,30 +641,37 @@ Public Class ImportZUGFeRDFiles
Try Try
oDocument = _zugferd.ExtractZUGFeRDFileWithGDPicture(pFile.FullName) oDocument = _zugferd.ExtractZUGFeRDFileWithGDPicture(pFile.FullName)
oDocument.ReceiptFileType = ZUGFeRDInterface.RECEIPT_TYPE_PDF
Catch ex As ValidationException Catch ex As ValidationException
Throw ex Throw ex
Catch ex As ZUGFeRDExecption Catch ex As ZUGFeRDExecption
Select Case ex.ErrorType If ex.ErrorCode > 0 Then
Case ZUGFeRDInterface.ErrorType.NoZugferd _logger.Info("New Rejection Logik")
_logger.Info("File [{0}] is not a valid ZUGFeRD document. Skipping.", pFile.Name)
oResult.EmailAttachmentFiles.Add(pFile) Select Case ex.ErrorCode
Return oResult Case ErrorCode.NoFerdsException
_logger.Info("File [{0}] is not a valid eInvoice document. Skipping.", pFile.Name)
Case ZUGFeRDInterface.ErrorType.UnsupportedFormat oResult.EmailAttachmentFiles.Add(pFile)
_logger.Info("File [{0}/{1}] is an unsupported ZUFeRD document format!", pFile.Name, ex.XmlFile) Return oResult
Throw New UnsupportedFerdException(ex.XmlFile)
Case ZUGFeRDInterface.ErrorType.NoValidZugferd Case ErrorCode.UnsupportedFerdException
_logger.Info("File [{0}] is an Incorrectly formatted ZUGFeRD document!", pFile.Name) _logger.Info("File [{0}/{1}] is an unsupported eInvoice document format!", pFile.Name, ex.XmlFile)
Throw New InvalidFerdException() Throw New UnsupportedFerdException(ex.XmlFile)
Case ErrorCode.InvalidFerdException
_logger.Info("File [{0}] is an incorrectly formatted eInvoice document!", pFile.Name)
Throw New InvalidFerdException()
Case Else
_logger.Warn("Unexpected Error occurred while extracting eInvoice Information from file {0}", pFile.Name)
Throw ex
End Select
End If
Case Else
_logger.Warn("Unexpected Error occurred while extracting ZUGFeRD Information from file {0}", pFile.Name)
Throw ex
End Select
End Try End Try
' Check if there are more than one ZUGFeRD files ' Check if there are more than one ZUGFeRD files
@ -652,8 +694,7 @@ Public Class ImportZUGFeRDFiles
End If End If
Try Try
oDocument.ReceiptFileType = ZUGFeRDInterface.RECEIPT_TYPE_PDF Dim sqlResult As Boolean = StoreXMLItemsInDatabase(pMessageId, oDocument, pFile, pConnections, pArgs, oResult)
Dim sqlResult As Boolean = StoreXMLItemsInDatabase(pMessageId, oDocument, pFile, pConnections, pArgs)
Catch ex As Exception Catch ex As Exception
Throw ex Throw ex
End Try End Try
@ -670,12 +711,12 @@ Public Class ImportZUGFeRDFiles
End Function End Function
Private Function StoreXMLItemsInDatabase(pMessageId As String, pDocument As ZUGFeRDInterface.ZugferdResult, pFile As FileInfo, pConnections As DatabaseConnections, pArgs As WorkerArgs) As Boolean Private Function StoreXMLItemsInDatabase(pMessageId As String, pDocument As ZUGFeRDInterface.ZugferdResult, pFile As FileInfo, pConnections As DatabaseConnections, pArgs As WorkerArgs, pProcessFileResult As ProcessFileResult) As Boolean
' Check the document against the configured property map and return: ' Check the document against the configured property map and return:
' - a List of valid properties ' - a List of valid properties
' - a List of missing properties ' - a List of missing properties
Dim oPropertyMap = _zugferd.FilterPropertyMap(pArgs.PropertyMap, pDocument.Specification) Dim oPropertyMap As Dictionary(Of String, XmlItemProperty) = _zugferd.FilterPropertyMap(pArgs.PropertyMapList, pDocument.Specification)
Dim oCheckResult = _zugferd.PropertyValues.CheckPropertyValues(pDocument.SchemaObject, oPropertyMap, pMessageId) Dim oCheckResult = _zugferd.PropertyValues.CheckPropertyValues(pDocument.SchemaObject, oPropertyMap, pMessageId)
_logger.Info("Properties checked: [{0}] missing properties / [{1}] valid properties found.", oCheckResult.MissingProperties.Count, oCheckResult.ValidProperties.Count) _logger.Info("Properties checked: [{0}] missing properties / [{1}] valid properties found.", oCheckResult.MissingProperties.Count, oCheckResult.ValidProperties.Count)
@ -693,39 +734,359 @@ Public Class ImportZUGFeRDFiles
Throw New Exception("Bulk Insert failed! Exiting.") Throw New Exception("Bulk Insert failed! Exiting.")
End If End If
' TODO hier BAUSTELLE
' Eingebettete Dateien speichern ' Eingebettete Dateien speichern
'If CreateEmbeddedFilesOnDisk(pMessageId, pDocument, pConnections, oCheckResult) = False Then If HandleEmbeddedAttachments(pMessageId, pDocument, pConnections, oCheckResult, pArgs, pProcessFileResult) = False Then
' _logger.Debug("Files saving for MessageId [{0}] failed!", pMessageId) _logger.Debug("Files saving for MessageId [{0}] failed!", pMessageId)
'End If End If
Return True Return True
End Function End Function
Private Function CreateEmbeddedFilesOnDisk(pMessageId As String, pDocument As ZUGFeRDInterface.ZugferdResult, pConnections As DatabaseConnections, pCheckResult As CheckPropertyValuesResult) As Boolean ''' <summary>
''' Hier werden die Dateianhänge behandelt, die im XML als base64 eingetragen wurden.
''' Die zusammengehörigen Knoten müssen über "FILES" gruppiert werden!
'''
''' Die erwarteten Knoten-Namen sind in der List EmbeddedFilesColumnNames enthalten!
''' </summary>
Private Function HandleEmbeddedAttachments(pMessageId As String, pDocument As ZUGFeRDInterface.ZugferdResult, pConnections As DatabaseConnections,
pCheckResult As CheckPropertyValuesResult, pArgs As WorkerArgs, pProcessFileResult As ProcessFileResult) As Boolean
' Finde alle Eintraege in pCheckResult mit Item_Type=3 If (pCheckResult Is Nothing) Then
' Finde Dateinamen (Index nach ~attm) und Dateityp. Wir speichern nur PDF. _logger.Debug("pCheckResult is empty!")
' TODO Funktion aufrufen Return True
'SaveBase64ToDisk("", "") = False Then End If
If (CheckEmbeddedAttachmentEntries(pCheckResult) = False) Then
_logger.Debug("No embedded Files in XML found!")
Return True
End If
Dim embAttachmentList As List(Of ValidProperty) = pCheckResult.ValidProperties.Where(
Function(z)
Return EmbeddedFilesColumnNames.Contains(z.TableColumn)
End Function
).ToList()
If embAttachmentList Is Nothing OrElse embAttachmentList.Count <= 0 Then
_logger.Debug("No Fields for Embedded Files configured!")
Return True
End If
' GroupCounter Werte in Hashset eintragen, um distinct Werte zu erhalten
Dim oIndexList As HashSet(Of Integer) = New HashSet(Of Integer)
For Each resultItem In embAttachmentList
oIndexList.Add(resultItem.GroupCounter)
Next
Dim oOutputPath As String = GetOutputPathForEmbeddedAttachments(pArgs)
Dim nextAttachmentIndex As Integer = 0
nextAttachmentIndex = GetNextAttachmentIndex(pMessageId)
If nextAttachmentIndex <= 0 Then
nextAttachmentIndex = 1
End If
For Each groupIndex In oIndexList
Dim oMimeCodeString As String = String.Empty
Dim oOrgFilename As String = String.Empty
Dim oBase64String As String = String.Empty
Dim oMimeTypeProperty As ValidProperty = GetIndexProperty(embAttachmentList, groupIndex, "ATTACHMENT_FILE_MIMECODE")
If oMimeTypeProperty IsNot Nothing AndAlso oMimeTypeProperty.Value.IsNotNullOrEmpty() Then
oMimeCodeString = oMimeTypeProperty.Value.ToLower()
Else
_logger.Debug("Empty MIME-Code! File can not be stored!")
Continue For
End If
Dim oFilenameProperty As ValidProperty = GetIndexProperty(embAttachmentList, groupIndex, "ATTACHMENT_FILE_FILENAME")
If oFilenameProperty IsNot Nothing AndAlso oFilenameProperty.Value.IsNotNullOrEmpty() Then
oOrgFilename = oFilenameProperty.Value
Else
_logger.Debug("Empty Filename! File can not be stored!")
Continue For
End If
Dim oBase64ValueProperty As ValidProperty = GetIndexProperty(embAttachmentList, groupIndex, "ATTACHMENT_FILE_VALUE")
If oBase64ValueProperty IsNot Nothing AndAlso oBase64ValueProperty.Value.IsNotNullOrEmpty() Then
oBase64String = oBase64ValueProperty.Value
Else
_logger.Error("Empty base64 String! File can not be stored!")
Continue For
End If
Dim newAttachmentFilename = pMessageId + "~attm" + nextAttachmentIndex.ToString
Dim oFileExtension = GetEmbeddedFileExtension(oMimeTypeProperty.Value)
If oFileExtension.IsNotNullOrEmpty() Then
newAttachmentFilename += "." + oFileExtension
Else
_logger.Warn("No extension found! File can not be stored!")
Continue For
End If
Dim embeddedFilePath = Path.Combine(oOutputPath, newAttachmentFilename)
_logger.Debug("Next Attachment File is [{0}]", embeddedFilePath)
If SaveBase64ToDisk(embeddedFilePath, oBase64String) = True Then
_logger.Debug("Saved file [{0}] to disk", embeddedFilePath)
pProcessFileResult.EmailAttachmentFiles.Add(New FileInfo(embeddedFilePath))
Else
_logger.Error("Could not save File to Disk!")
Dim oReasonString = "Could not save file " + newAttachmentFilename + " to disk."
AddRejectedState(pMessageId, oReasonString, "EMBEDDED FILE CONSISTENCY NOT OK", "Info GUI", pConnections.SQLServerTransaction)
Continue For
End If
If TestFileOnDisk(embeddedFilePath, oMimeCodeString) = False Then
_logger.Error("Could not save File to Disk!")
Dim oReasonString = "Validation of file " + newAttachmentFilename + " on disk was NOT succesfully."
AddRejectedState(pMessageId, oReasonString, "EMBEDDED FILE CONSISTENCY NOT OK", "Info GUI", pConnections.SQLServerTransaction)
Continue For
End If
If InsertAttachmentHistoryEntry(pMessageId, oOrgFilename, embeddedFilePath) = False Then
_logger.Error("Could not save attachment Data to DB!")
Return False
End If
If InsertEmbeddedFileDataToDB(pMessageId, oBase64String, oOrgFilename, oMimeCodeString, groupIndex) = False Then
_logger.Error("Could not save attachment Data to DB!")
Return False
End If
nextAttachmentIndex += 1
Next
Return True Return True
End Function End Function
Private Function SaveBase64ToDisk(pExportFilePath As String, pBase64String As String) As Boolean Private Function TestFileOnDisk(pEmbeddedFilePath As String, pMimeCodeString As String) As Boolean
Try Try
Dim base64BinaryDataString As String = pBase64String ' Hier Base64-String einfügen If pMimeCodeString = MIME_TYPE_PDF Then
Dim binaryDataString As Byte() = System.Convert.FromBase64String(base64BinaryDataString) Dim oGdPicturePDF As New GdPicturePDF
Dim oFilename As String = pExportFilePath Dim oStatus As GdPictureStatus = oGdPicturePDF.LoadFromFile(pEmbeddedFilePath, True)
Dim Stream As System.IO.FileStream = New System.IO.FileStream(oFilename, System.IO.FileMode.Create) If oStatus <> GdPictureStatus.OK Then
Stream.Write(binaryDataString, 0, binaryDataString.Length) _logger.Error("File [{0}] has no proper state!", pEmbeddedFilePath)
Stream.Close() Return False
Catch ex As Exception End If
_logger.Error("Could NOT save File to Disk for MessageId [{0}] !", pExportFilePath)
Else
' Test other files
Dim fileInfo As FileInfo = New FileInfo(pEmbeddedFilePath)
If fileInfo.Exists = False Then
_logger.Error("Could not find File [{0}] on Disk!", pEmbeddedFilePath)
Return False
End If
End If
Return True
Catch ex As Exception
_logger.Error(ex)
Return False
End Try
End Function
Private Function GetEmbeddedFileExtension(pMimeTypeValue As String) As String
If pMimeTypeValue.IsNullOrEmpty() Then
_logger.Warn("Empty MimeCode is not allowed!")
Return String.Empty
End If
Select Case pMimeTypeValue.ToLower()
Case MIME_TYPE_PDF
Return "pdf"
Case MIME_TYPE_XLSX
Return "xlsx"
Case MIME_TYPE_ODT
Return "odt"
Case "image/jpeg"
Return "jpg"
Case "image/png"
Return "png"
Case "image/tiff"
Return "tif"
Case "text/csv"
Return "csv"
Case "text/xml"
Return "xml"
Case Else
Return String.Empty
End Select
End Function
Private Shared Function GetIndexProperty(pListResult As List(Of ValidProperty), pGroupIndex As Integer, pTableColumn As String) As ValidProperty
Return pListResult.Where(
Function(z)
Return z.GroupCounter = pGroupIndex AndAlso z.TableColumn = pTableColumn
End Function
).FirstOrDefault
End Function
''' <summary>
''' Speichert die Daten inkl. base64-String in die Datenbank
''' </summary>
Private Function InsertEmbeddedFileDataToDB(pMessageId As String, pItemValue As String, pOrgFilename As String, pMimeType As String, pGroupIndex As Integer) As Boolean
Try
Dim oCommand = New SqlCommand(
"INSERT INTO TBEDMI_ITEM_FILES (
REFERENCE_GUID,
ITEM_VALUE,
ORG_FILENAME,
MIME_TYPE,
GROUP_INDEX,
CREATED_WHO
) VALUES (
@MESSAGE_ID,
@ITEM_VALUE,
@ORG_FILENAME,
@MIME_TYPE,
@GROUP_INDEX,
@CREATED_WHO
)")
Dim fileBytes As Byte() = Convert.FromBase64String(pItemValue)
oCommand.Parameters.Add("MESSAGE_ID", SqlDbType.VarChar, 250).Value = pMessageId
oCommand.Parameters.Add("ITEM_VALUE", SqlDbType.VarBinary).Value = fileBytes
oCommand.Parameters.Add("ORG_FILENAME", SqlDbType.VarChar, 256).Value = pOrgFilename
oCommand.Parameters.Add("MIME_TYPE", SqlDbType.VarChar, 256).Value = pMimeType
oCommand.Parameters.Add("GROUP_INDEX", SqlDbType.Int).Value = pGroupIndex
oCommand.Parameters.Add("CREATED_WHO", SqlDbType.VarChar, 100).Value = "eInvoice Parser"
_mssql.ExecuteNonQuery(oCommand)
Return True
Catch ex As Exception
_logger.Error(ex)
Return False
End Try End Try
Return True End Function
''' <summary>
''' Ermittelt den Ausgabepfad für die eingebetteten Anhänge
''' </summary>
Private Function GetOutputPathForEmbeddedAttachments(pArgs As WorkerArgs) As String
Return pArgs.WatchDirectory
End Function
''' <summary>
''' Prüft, ob Embedded Attachments in den XML-Ergebnissen enthalten sind,
''' in dem geprüft wird, ob bestimmte MIME-Codes vorhanden sind.
''' </summary>
''' <param name="pCheckResult"></param>
''' <returns></returns>
Private Function CheckEmbeddedAttachmentEntries(pCheckResult As CheckPropertyValuesResult) As Boolean
Try
Dim resultList = pCheckResult.ValidProperties.Where(
Function(z)
Return (z.TableColumn = "ATTACHMENT_FILE_MIMECODE" AndAlso AllowedMimeTypesInEmbeddedFiles.Contains(z.Value.ToLower()))
End Function
).ToList()
If resultList.Count > 0 Then
_logger.Info("Found [{0}] embedded XML-Attachments.", resultList.Count)
Return True
Else
_logger.Info("No embedded XML-Attachments found.")
Return False
End If
Catch ex As Exception
_logger.Error("Error searching pCheckResult! {0}", ex.Message)
Return False
End Try
End Function
''' <summary>
''' Speichere base64 als Datei auf der Platte ab.
''' </summary>
Private Function SaveBase64ToDisk(pExportFilePath As String, pBase64String As String) As Boolean
Try
Dim oFilename As String = pExportFilePath
Dim base64BinaryDataString As String = pBase64String
Dim binaryDataString As Byte() = Convert.FromBase64String(base64BinaryDataString)
' Using verwenden, um blockieren der Datei zu verhindern
Using fs = New FileStream(oFilename, FileMode.Create, FileAccess.ReadWrite)
fs.Write(binaryDataString, 0, binaryDataString.Length)
fs.Flush()
fs.Close()
End Using
Return True
Catch ex As Exception
_logger.Error("Could NOT save File [{0}] to Disk! Exception: [{1}]", pExportFilePath, ex.Message)
Return False
End Try
End Function
''' <summary>
''' Die Methode lädt die bisherigen Dateinamen zu einer MessageID
''' Die Datei mit dem höchsten Index gibt den folgenden Index vor.
''' </summary>
''' <returns>Nächster Attachment Index</returns>
Private Function GetNextAttachmentIndex(pMessageId As String) As Integer
Try
Dim oSQL = $"SELECT count(*) FROM TBEMLP_HISTORY_ATTACHMENT WHERE EMAIL_MSGID = '{pMessageId}'"
Dim sqlResult = _mssql.GetScalarValue(oSQL)
If sqlResult = 0 Then
sqlResult = 1 ' Kleinster Index = 1
End If
Return sqlResult
Catch ex As Exception
_logger.Error(ex)
Throw ex
End Try
End Function
''' <summary>
''' Speichert die Infos zu einem embedded Dateianhang in die DB.
''' Mangels EMail-Daten werden die EMail-Felder (FROM, BODY, usw.) nicht gefüllt
''' </summary>
''' <returns>true, wenn erfolgreich</returns>
Private Function InsertAttachmentHistoryEntry(pMessageId As String, pFileName As String, pNewFileName As String) As Boolean
Try
Dim oCommand = New SqlCommand(
"INSERT INTO TBEMLP_HISTORY_ATTACHMENT (
WORK_PROCESS,
EMAIL_MSGID,
EMAIL_ATTMT,
EMAIL_ATTMT_INDEX,
EMAIL_FROM,
EMAIL_BODY
) VALUES (
@WORK_PROCESS,
@MESSAGE_ID,
@ATTACHMENT,
@ATTACHMENT_INDEX,
'-',
'-'
)")
oCommand.Parameters.Add("WORK_PROCESS", SqlDbType.VarChar, 100).Value = "Attachment Sniffer (Embedded Files)"
oCommand.Parameters.Add("MESSAGE_ID", SqlDbType.VarChar, 500).Value = pMessageId
oCommand.Parameters.Add("ATTACHMENT", SqlDbType.VarChar, 500).Value = pFileName
oCommand.Parameters.Add("ATTACHMENT_INDEX", SqlDbType.VarChar, 500).Value = pNewFileName
_mssql.ExecuteNonQuery(oCommand)
Return True
Catch ex As Exception
_logger.Error(ex)
Return False
End Try
End Function End Function
Private Function BulkInsertDataToDatabase(pMessageId As String, pDocument As ZUGFeRDInterface.ZugferdResult, pConnections As DatabaseConnections, pCheckResults As CheckPropertyValuesResult) As Boolean Private Function BulkInsertDataToDatabase(pMessageId As String, pDocument As ZUGFeRDInterface.ZugferdResult, pConnections As DatabaseConnections, pCheckResults As CheckPropertyValuesResult) As Boolean
@ -771,7 +1132,7 @@ Public Class ImportZUGFeRDFiles
' Erste Zeile enthält die Spezifikation ' Erste Zeile enthält die Spezifikation
Dim oFirstRow As DataRow = oDataTable.NewRow() Dim oFirstRow As DataRow = oDataTable.NewRow()
oFirstRow("REFERENCE_GUID") = pMessageId oFirstRow("REFERENCE_GUID") = pMessageId
oFirstRow("ITEM_DESCRIPTION") = "ZUGFeRDSpezifikation" oFirstRow("ITEM_DESCRIPTION") = "Verwendete Spezifikation der E-Rechnung"
oFirstRow("ITEM_VALUE") = pDocument.Specification oFirstRow("ITEM_VALUE") = pDocument.Specification
oFirstRow("GROUP_COUNTER") = 0 oFirstRow("GROUP_COUNTER") = 0
oFirstRow("SPEC_NAME") = "ZUGFERD_SPECIFICATION" oFirstRow("SPEC_NAME") = "ZUGFERD_SPECIFICATION"
@ -783,7 +1144,7 @@ Public Class ImportZUGFeRDFiles
' Zweite Zeile enthält das verwendete XML Schema ' Zweite Zeile enthält das verwendete XML Schema
Dim oSecondRow As DataRow = oDataTable.NewRow() Dim oSecondRow As DataRow = oDataTable.NewRow()
oSecondRow("REFERENCE_GUID") = pMessageId oSecondRow("REFERENCE_GUID") = pMessageId
oSecondRow("ITEM_DESCRIPTION") = "ZUGFeRDXMLSchema" oSecondRow("ITEM_DESCRIPTION") = "Verwendetes XML-Schema (XSD) der E-Rechnung"
oSecondRow("ITEM_VALUE") = pDocument.UsedXMLSchema oSecondRow("ITEM_VALUE") = pDocument.UsedXMLSchema
oSecondRow("GROUP_COUNTER") = 0 oSecondRow("GROUP_COUNTER") = 0
oSecondRow("SPEC_NAME") = "ZUGFERD_XML_SCHEMA" oSecondRow("SPEC_NAME") = "ZUGFERD_XML_SCHEMA"
@ -795,7 +1156,7 @@ Public Class ImportZUGFeRDFiles
' Dritte Zeile enthält das verwendete Datei-Format des Belegs (PDF/XML) ' Dritte Zeile enthält das verwendete Datei-Format des Belegs (PDF/XML)
Dim oThirdRow As DataRow = oDataTable.NewRow() Dim oThirdRow As DataRow = oDataTable.NewRow()
oThirdRow("REFERENCE_GUID") = pMessageId oThirdRow("REFERENCE_GUID") = pMessageId
oThirdRow("ITEM_DESCRIPTION") = "ReceiptFileType" oThirdRow("ITEM_DESCRIPTION") = "Dateityp der E-Rechnung"
oThirdRow("ITEM_VALUE") = pDocument.ReceiptFileType oThirdRow("ITEM_VALUE") = pDocument.ReceiptFileType
oThirdRow("GROUP_COUNTER") = 0 oThirdRow("GROUP_COUNTER") = 0
oThirdRow("SPEC_NAME") = "RECEIPT_FILE_TYPE" oThirdRow("SPEC_NAME") = "RECEIPT_FILE_TYPE"
@ -811,6 +1172,12 @@ Public Class ImportZUGFeRDFiles
Continue For Continue For
End If End If
' ItemType = 0 (normale texte) dürfen nicht leer sein
If oProperty.ItemType = 0 And oProperty.Value.IsNullOrEmpty Then
_logger.Debug("No Mapping for Property [{0}] with empty value, because of ItemType = 0.", oProperty.TableColumn)
Continue For
End If
' If GroupCounter is -1, it means this is a default property that can only occur once. ' If GroupCounter is -1, it means this is a default property that can only occur once.
' Set the actual inserted value to 0 ' Set the actual inserted value to 0
Dim oGroupCounterValue As Integer = oProperty.GroupCounter Dim oGroupCounterValue As Integer = oProperty.GroupCounter
@ -818,19 +1185,27 @@ Public Class ImportZUGFeRDFiles
oGroupCounterValue = 0 oGroupCounterValue = 0
End If End If
If oProperty.Value.Length > 900 Then If oProperty.Value.Length > 4000 Then
_logger.Warn("Value for field [{0}] is longer than 900 characters, will be truncated!", oProperty.TableColumn) _logger.Warn("Value for field [{0}] is longer than 4000 characters, will be truncated!", oProperty.TableColumn)
oProperty.Value = oProperty.Value.Truncate(4000)
End If
Dim oDescription As String
If oProperty.EN16931_ID IsNot Nothing AndAlso oProperty.EN16931_ID.Length > 1 Then
oDescription = oProperty.EN16931_ID + " (" + oProperty.Description + ")"
Else
oDescription = oProperty.Description
End If End If
Dim oNewRow As DataRow = oDataTable.NewRow() Dim oNewRow As DataRow = oDataTable.NewRow()
oNewRow("REFERENCE_GUID") = pMessageId oNewRow("REFERENCE_GUID") = pMessageId
oNewRow("ITEM_DESCRIPTION") = oProperty.Description oNewRow("ITEM_DESCRIPTION") = oDescription
oNewRow("ITEM_VALUE") = oProperty.Value.Truncate(900).Replace("'", "''") oNewRow("ITEM_VALUE") = oProperty.Value
oNewRow("GROUP_COUNTER") = oGroupCounterValue oNewRow("GROUP_COUNTER") = oGroupCounterValue
oNewRow("SPEC_NAME") = oProperty.TableColumn oNewRow("SPEC_NAME") = oProperty.TableColumn
oNewRow("IS_REQUIRED") = oProperty.IsRequired oNewRow("IS_REQUIRED") = oProperty.IsRequired
_logger.Debug("Mapping Property [{0}] with value [{1}]", oProperty.TableColumn, oProperty.Value.Replace("'", "''")) _logger.Debug("Mapping Property [{0}] with value [{1}]", oProperty.TableColumn, oProperty.Value)
oDataTable.Rows.Add(oNewRow) oDataTable.Rows.Add(oNewRow)
Next Next
@ -848,6 +1223,15 @@ Public Class ImportZUGFeRDFiles
_logger.Warn("Step [{0}] with SQL [{1}] was not successful.", oStep, oDelSQL) _logger.Warn("Step [{0}] with SQL [{1}] was not successful.", oStep, oDelSQL)
End Try End Try
Try
oDelSQL = $"DELETE FROM TBEDMI_ITEM_FILES where REFERENCE_GUID = '{pMessageId}'"
oStep = "TBEDMI_ITEM_FILES Delete MessageID Items"
Dim retValue As Boolean = _mssql.ExecuteNonQueryWithConnectionObject(oDelSQL, pConnections.SQLServerConnection, MSSQLServer.TransactionMode.ExternalTransaction, pConnections.SQLServerTransaction)
Return retValue
Catch ex As Exception
_logger.Warn("Step [{0}] with SQL [{1}] was not successful.", oStep, oDelSQL)
End Try
Return False Return False
End Function End Function
@ -871,6 +1255,10 @@ Public Class ImportZUGFeRDFiles
Return True Return True
End Function End Function
''' <summary>
''' Fügt neue Datensätze in Tabelle TBEMLP_HISTORY_STATE ein,
''' per Prozedur DD_ECM.[dbo].[PRCUST_ADD_HISTORY_STATE]
''' </summary>
Private Sub AddRejectedState(pMessageID As String, pTitle As String, pTitle1 As String, pComment As String, pTransaction As SqlTransaction) Private Sub AddRejectedState(pMessageID As String, pTitle As String, pTitle1 As String, pComment As String, pTransaction As SqlTransaction)
Try Try
'PRCUST_ADD_HISTORY_STATE: @MessageID VARCHAR(250), @TITLE1 VARCHAR(250), @TITLE2 VARCHAR(250) 'PRCUST_ADD_HISTORY_STATE: @MessageID VARCHAR(250), @TITLE1 VARCHAR(250), @TITLE2 VARCHAR(250)
@ -880,4 +1268,5 @@ Public Class ImportZUGFeRDFiles
_logger.Error(ex) _logger.Error(ex)
End Try End Try
End Sub End Sub
End Class End Class

View File

@ -12,7 +12,7 @@ Public Class WorkerArgs
Public NonZugferdDirectory As String = Nothing Public NonZugferdDirectory As String = Nothing
' Property Parameter ' Property Parameter
Public PropertyMap As New Dictionary(Of String, XmlItemProperty) Public PropertyMapList As New List(Of XmlItemProperty)
' Email Parameter ' Email Parameter
Public EmailOutProfileId As Integer = 0 Public EmailOutProfileId As Integer = 0
@ -31,6 +31,7 @@ Public Class WorkerArgs
Public AllowXRechnung As Boolean = True Public AllowXRechnung As Boolean = True
Public AllowZugferd10 As Boolean = True Public AllowZugferd10 As Boolean = True
Public AllowZugferd2x As Boolean = True Public AllowZugferd2x As Boolean = True
Public AllowZugferd23x As Boolean = True
Public AllowPeppolBISBill3x As Boolean = False Public AllowPeppolBISBill3x As Boolean = False
End Class End Class

View File

@ -7,6 +7,9 @@ Imports DigitalData.Modules.Logging
Imports GdPicture14 Imports GdPicture14
Imports System.Drawing Imports System.Drawing
Imports System.Linq Imports System.Linq
Imports System.Text.RegularExpressions
'11.11.2025
Public Class XRechnungViewDocument Public Class XRechnungViewDocument
Private ReadOnly _logger As Logger Private ReadOnly _logger As Logger
Private ReadOnly _logConfig As LogConfig Private ReadOnly _logConfig As LogConfig
@ -16,8 +19,6 @@ Public Class XRechnungViewDocument
Private fontResName As String Private fontResName As String
Private fontResNameBold As String Private fontResNameBold As String
Private fontResNameItalic As String Private fontResNameItalic As String
Private MyGDPicturePDF As GdPicturePDF
Public Sub New(LogConfig As LogConfig, MSSQL As MSSQLServer, GDPictureLicenseKey As String) Public Sub New(LogConfig As LogConfig, MSSQL As MSSQLServer, GDPictureLicenseKey As String)
_logConfig = LogConfig _logConfig = LogConfig
_logger = LogConfig.GetLogger() _logger = LogConfig.GetLogger()
@ -25,39 +26,54 @@ Public Class XRechnungViewDocument
_file = New ZUGFeRD.FileFunctions(LogConfig, MSSQL) _file = New ZUGFeRD.FileFunctions(LogConfig, MSSQL)
_gdpictureLicenseKey = GDPictureLicenseKey _gdpictureLicenseKey = GDPictureLicenseKey
End Sub End Sub
Public Function Create_PDFfromXML(oxmlFile As FileInfo, pDTItemValues As DataTable) As FileInfo Public Function Create_PDFfromXML(pXmlFile As FileInfo, pDTItemValues As DataTable) As FileInfo
_logger.Debug("Create_PDFfromXML() Start") _logger.Debug("Create_PDFfromXML() Start")
Try Try
Dim oXRechnungFile = oxmlFile.FullName Dim LicenseManager = New LicenseManager()
LicenseManager.RegisterKEY(_gdpictureLicenseKey)
Dim oXRechnungFile = pXmlFile.FullName
Dim oNewFileinfo As FileInfo Dim oNewFileinfo As FileInfo
Dim oxmlFilePath = oxmlFile.FullName Dim oXmlFilePath = pXmlFile.FullName
Dim oViewRecieptFilename = oxmlFile.Name Dim oViewRecieptFilename = pXmlFile.Name
Dim oTempFilePath = Path.GetDirectoryName(oxmlFilePath) + "\Temp" Dim oTempFilePath = Path.Combine(Path.GetDirectoryName(oXmlFilePath), "temp")
If Not Directory.Exists(oTempFilePath) Then If Not Directory.Exists(oTempFilePath) Then
Directory.CreateDirectory(oTempFilePath) Directory.CreateDirectory(oTempFilePath)
End If End If
oTempFilePath = oTempFilePath + "\xrechnung.xml" oTempFilePath = Path.Combine(oTempFilePath, "xrechnung.xml")
If File.Exists(oTempFilePath) Then If File.Exists(oTempFilePath) Then
File.Delete(oTempFilePath) File.Delete(oTempFilePath)
End If End If
File.Move(oxmlFilePath, oTempFilePath)
oxmlFile = New FileInfo(oTempFilePath)
oViewRecieptFilename = oViewRecieptFilename.Replace("xml", "pdf")
Dim oOutputPath = Path.GetDirectoryName(oxmlFilePath) + "\" + oViewRecieptFilename
If File.Exists(oOutputPath) Then
File.Delete(oOutputPath)
End If
MyGDPicturePDF = New GdPicturePDF()
MyGDPicturePDF.NewPDF(PdfConformance.PDF_A_2a)
Dim oPDFStatus As GdPictureStatus = MyGDPicturePDF.NewPDF()
pXmlFile = New FileInfo(oTempFilePath)
'oViewRecieptFilename = oViewRecieptFilename.Replace(".xml", ".pdf")
oViewRecieptFilename = Regex.Replace(oViewRecieptFilename, ".xml", ".pdf", RegexOptions.IgnoreCase)
Dim MyGDPicturePDF = New GdPicturePDF
Dim oPDFStatus As GdPictureStatus = MyGDPicturePDF.NewPDF(PdfConformance.PDF_A_3a)
If oPDFStatus <> GdPictureStatus.OK Then If oPDFStatus <> GdPictureStatus.OK Then
_logger.Warn($"Error initializing PDF: {oPDFStatus}") _logger.Warn($"Error initializing PDF: {oPDFStatus}")
Return Nothing Return Nothing
End If End If
Dim oOutputPath = Path.Combine(Path.GetDirectoryName(oXmlFilePath), oViewRecieptFilename)
_logger.Debug("Create_PDFfromXML() Resulting PDF Filepath: [{0}]", oOutputPath)
If File.Exists(oOutputPath) Then
File.Delete(oOutputPath)
End If
Dim oCreatedString = $"Maschinell erstellt durch / Automatically created by Digital Data E-Rechnung Parser: {Now.ToString}"
MyGDPicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft) MyGDPicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft)
MyGDPicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitMillimeter) MyGDPicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitMillimeter)
MyGDPicturePDF.SetLineWidth(1) MyGDPicturePDF.SetLineWidth(1)
@ -69,9 +85,24 @@ Public Class XRechnungViewDocument
'Create a New page 'Create a New page
MyGDPicturePDF.NewPage(PdfPageSizes.PdfPageSizeA4) MyGDPicturePDF.NewPage(PdfPageSizes.PdfPageSizeA4)
' Dim oCurrent As Integer = MyGDPicturePDF.GetCurrentPage() ' Dim oCurrent As Integer = MyGDPicturePDF.GetCurrentPage()
'Den HEader erzeugen
Dim yPosition As Integer = 15
MyGDPicturePDF.SetTextSize(18)
MyGDPicturePDF.DrawText(fontResName, 10, yPosition, "xRechnung Sichtbeleg - xInvoice Visual Receipt")
yPosition += 10
MyGDPicturePDF.SetTextSize(10)
MyGDPicturePDF.DrawText(fontResNameItalic, 10, yPosition, XRechnungStrings.CommentSichtbeleg_DE_Row1)
yPosition += 5
MyGDPicturePDF.DrawText(fontResNameItalic, 10, yPosition, XRechnungStrings.CommentSichtbeleg_DE_Row2)
yPosition += 5
MyGDPicturePDF.DrawText(fontResNameItalic, 10, yPosition, XRechnungStrings.CommentSichtbeleg_EN_Row1)
yPosition += 5
MyGDPicturePDF.DrawText(fontResNameItalic, 10, yPosition, XRechnungStrings.CommentSichtbeleg_EN_Row2)
'Den Footer erzeugen
MyGDPicturePDF.DrawLine(10, 280, 200, 280)
MyGDPicturePDF.DrawText(fontResName, 10, 285, oCreatedString)
Dim yPosition As Single = Create_PageHeader(False)
Create_PageFooter()
Dim oArea As String = "" Dim oArea As String = ""
Dim oIsPosition As Boolean = False Dim oIsPosition As Boolean = False
@ -87,6 +118,9 @@ Public Class XRechnungViewDocument
Dim oIndex As Integer = 0 Dim oIndex As Integer = 0
Dim oYPlus As Integer = 0 Dim oYPlus As Integer = 0
Dim oCreateTextBox As Boolean = False Dim oCreateTextBox As Boolean = False
Dim oInvHasDiscount As Boolean = False
Dim oYDyn As Integer = 0
Dim Former_oItemSPECNAME As String = ""
For Each oRow As DataRow In pDTItemValues.Rows For Each oRow As DataRow In pDTItemValues.Rows
Dim Y_eq_lastrow As Boolean = CBool(oRow.Item("Y_eq_lastrow")) Dim Y_eq_lastrow As Boolean = CBool(oRow.Item("Y_eq_lastrow"))
Dim oRowCaption As String = oRow.Item("Row_Caption") Dim oRowCaption As String = oRow.Item("Row_Caption")
@ -94,7 +128,10 @@ Public Class XRechnungViewDocument
Dim oItemValue As String = oRow.Item("ITEM_VALUE") Dim oItemValue As String = oRow.Item("ITEM_VALUE")
Dim oDisplay As Boolean = oRow.Item("Display") Dim oDisplay As Boolean = oRow.Item("Display")
Dim oAreaSwitch As Boolean = False Dim oAreaSwitch As Boolean = False
Dim oDescriptionFollowup As Boolean = False
If oItemSPECNAME = "RECEIPT_ALLOWANCE_REASON" Then
Console.WriteLine("Uiuiu")
End If
If oRow.Item("Area") = "INTERNAL" Then If oRow.Item("Area") = "INTERNAL" Then
If oItemSPECNAME = "STATIC_Y_SWITCH" Then If oItemSPECNAME = "STATIC_Y_SWITCH" Then
yPosition = oItemValue yPosition = oItemValue
@ -106,8 +143,23 @@ Public Class XRechnungViewDocument
_logger.Warn($"Could not create a second page. The error was: {oPDFStatus}") _logger.Warn($"Could not create a second page. The error was: {oPDFStatus}")
Exit For Exit For
Else Else
yPosition = Create_PageHeader(True) 'Wieder einen Header und Footer erzeugen
Create_PageFooter() yPosition = 15
MyGDPicturePDF.SetTextSize(18)
MyGDPicturePDF.DrawText(fontResName, 10, yPosition, "xRechnung Sichtbeleg - xInvoice Visual Receipt")
yPosition += 10
MyGDPicturePDF.SetTextSize(10)
MyGDPicturePDF.DrawText(fontResNameItalic, 10, yPosition, XRechnungStrings.CommentSichtbeleg_DE_Row1)
yPosition += 5
MyGDPicturePDF.DrawText(fontResNameItalic, 10, yPosition, XRechnungStrings.CommentSichtbeleg_DE_Row2)
yPosition += 5
MyGDPicturePDF.DrawText(fontResNameItalic, 10, yPosition, XRechnungStrings.CommentSichtbeleg_EN_Row1)
yPosition += 5
MyGDPicturePDF.DrawText(fontResNameItalic, 10, yPosition, XRechnungStrings.CommentSichtbeleg_EN_Row2)
MyGDPicturePDF.DrawLine(10, 280, 200, 280)
'Footer erzeugen
MyGDPicturePDF.DrawText(fontResName, 10, 285, oCreatedString)
End If End If
'oCurrent = MyGDPicturePDF.GetCurrentPage() 'oCurrent = MyGDPicturePDF.GetCurrentPage()
End If End If
@ -135,6 +187,18 @@ Public Class XRechnungViewDocument
ElseIf oArea = "POSITION" Then ElseIf oArea = "POSITION" Then
oAREACaption = "Positionen / Positions:" oAREACaption = "Positionen / Positions:"
oIsPosition = True oIsPosition = True
ElseIf oArea = "ALLOWANCE" Then
If oItemSPECNAME = "RECEIPT_ALLOWANCE_CHARGE_INDICATOR" Then
If oItemValue = "False" Then
oAREACaption = "Rabatt/Discount:"
oInvHasDiscount = True
Else
oAREACaption = "Zuschlag/Surcharge:"
End If
Else
oAREACaption = "Zu- oder Abschlag/Surcharge or Discount:"
End If
oIsPosition = True
ElseIf oArea = "AMOUNT" Then ElseIf oArea = "AMOUNT" Then
oAREACaption = "Beträge / Amounts:" oAREACaption = "Beträge / Amounts:"
oCreateTextBox = True oCreateTextBox = True
@ -163,15 +227,21 @@ Public Class XRechnungViewDocument
' gdpicturePDF.DrawText(fontResName, 10, yPosition, XRechnungStrings.Seperator_Line) ' gdpicturePDF.DrawText(fontResName, 10, yPosition, XRechnungStrings.Seperator_Line)
yPosition += 5 yPosition += 5
ElseIf oArea = "POSITION" Then ElseIf oArea = "POSITION" Then
'Tabellendarstellung
MyGDPicturePDF.DrawText(fontResName, 10, yPosition, "Pos#") MyGDPicturePDF.DrawText(fontResName, 10, yPosition, "Pos#")
MyGDPicturePDF.DrawText(fontResName, 19, yPosition, "Anz./am.") MyGDPicturePDF.DrawText(fontResName, 19, yPosition, "Anz./am.")
MyGDPicturePDF.DrawText(fontResName, 35, yPosition, "Einh/unt") MyGDPicturePDF.DrawText(fontResName, 35, yPosition, "Einh/Unit")
MyGDPicturePDF.DrawText(fontResName, 50, yPosition, "Pos.Text") MyGDPicturePDF.DrawText(fontResName, 50, yPosition, "Pos.Text")
MyGDPicturePDF.DrawText(fontResName, 164, yPosition, "Steuer/tax") MyGDPicturePDF.DrawText(fontResName, 163, yPosition, "Steuer/Tax")
MyGDPicturePDF.DrawText(fontResName, 181, yPosition, "Betrag/sum") MyGDPicturePDF.DrawText(fontResName, 181, yPosition, "Betrag/Sum")
ElseIf oArea = "ALLOWANCE" Then
MyGDPicturePDF.DrawText(fontResName, 10, yPosition, "Pos#")
' MyGDPicturePDF.DrawText(fontResName, 20, yPosition, "Betrag/Amount")
MyGDPicturePDF.DrawText(fontResName, 20, yPosition, "Grund/Reason")
MyGDPicturePDF.DrawText(fontResName, 163, yPosition, "Steuer/Tax")
MyGDPicturePDF.DrawText(fontResName, 163, yPosition, "Steuer/Tax")
MyGDPicturePDF.DrawText(fontResName, 181, yPosition, "Betrag/Sum")
yPosition += 5 yPosition += 5
'Tabellendarstellung Ende oPosCount = 0
ElseIf oArea = "EXEMPTION" Then ElseIf oArea = "EXEMPTION" Then
End If End If
@ -186,9 +256,8 @@ Public Class XRechnungViewDocument
oIsPosition = True oIsPosition = True
If oItemSPECNAME = "INVOICE_POSITION_AMOUNT" Then If oItemSPECNAME = "INVOICE_POSITION_AMOUNT" Then
oPosCount += 1 oPosCount += 1
'oPosTerm = $"{oPosCount}. {oItemValue} * " oYDyn = 0
'oItemValue = oPosTerm yPosition += 5
'Tabellendarstellung
oPosTerm = "" oPosTerm = ""
MyGDPicturePDF.DrawText(fontResName, 10, yPosition, oPosCount) MyGDPicturePDF.DrawText(fontResName, 10, yPosition, oPosCount)
' '
@ -201,6 +270,18 @@ Public Class XRechnungViewDocument
oDisplay = False oDisplay = False
' yPosition -= 5 ' yPosition -= 5
End If End If
ElseIf oArea = "ALLOWANCE" Then
oIsPosition = True
Dim validNames As String() = {"POSITION_ALLOWANCE_ACTUAL_AMOUNT", "RECEIPT_ALLOWANCE_RECEIPT_ALLOWANCE_CHARGE_INDICATOR"}
If validNames.Contains(oItemSPECNAME) Then
oPosCount += 1
oPosTerm = ""
MyGDPicturePDF.DrawText(fontResName, 10, yPosition, oPosCount)
'
Dim oCurrTerm = FormatCurrency(oItemValue, oCurrencySymbol)
MyGDPicturePDF.DrawText(fontResName, 20, yPosition, oCurrTerm)
oDisplay = False
End If
ElseIf oArea = "TAXPOS" Then ElseIf oArea = "TAXPOS" Then
oIsPosition = True oIsPosition = True
If oItemSPECNAME = "INVOICE_TAXPOS_RATE" Then If oItemSPECNAME = "INVOICE_TAXPOS_RATE" Then
@ -216,106 +297,115 @@ Public Class XRechnungViewDocument
'INDIVIDUELLES VERHALTEN BEI Folge-ITEMS 'INDIVIDUELLES VERHALTEN BEI Folge-ITEMS
_logger.Debug($"FollowItem - Area: [{oArea}] - ItemSpecname: [{oItemSPECNAME}] - ItemValue: [{oItemValue}]") _logger.Debug($"FollowItem - Area: [{oArea}] - ItemSpecname: [{oItemSPECNAME}] - ItemValue: [{oItemValue}]")
'Dim otextBoxYPos As Integer 'Dim otextBoxYPos As Integer
If oArea = "POSITION" Then If oArea = "POSITION" Or oArea = "ALLOWANCE" Then
If oItemSPECNAME = "INVOICE_POSITION_AMOUNT" Then If oItemSPECNAME <> Former_oItemSPECNAME And Former_oItemSPECNAME <> "" Then
If oItemSPECNAME = "INVOICE_POSITION_ARTICLE_DESCRIPTION" And Former_oItemSPECNAME = "INVOICE_POSITION_ARTICLE" Then
oDescriptionFollowup = True
Else
Former_oItemSPECNAME = oItemSPECNAME
End If
Else
Former_oItemSPECNAME = oItemSPECNAME
End If
If {"INVOICE_POSITION_AMOUNT", "POSITION_ALLOWANCE_ACTUAL_AMOUNT", "RECEIPT_ALLOWANCE_ACTUAL_AMOUNT"}.Contains(oItemSPECNAME) Then
oPosCount += 1 oPosCount += 1
oYPlus = 0 If Not oDescriptionFollowup Then
'Tabellendarstellung oYPlus = 0
yPosition += 5 oYDyn = 0
End If
oPosTerm = "" oPosTerm = ""
MyGDPicturePDF.DrawText(fontResName, 10, yPosition, oPosCount) MyGDPicturePDF.DrawText(fontResName, 10, yPosition, oPosCount)
'otextBoxYPos = yPosition - 3.5 If oItemSPECNAME = "INVOICE_POSITION_AMOUNT" Then
'MyGDPicturePDF.DrawTextBox(fontResName, 10, otextBoxYPos, 16, YCoo_TextBoxPlus5(otextBoxYPos), MyGDPicturePDF.DrawText(fontResName, 19, yPosition, oItemValue)
' TextAlignment.TextAlignmentFar, TextAlignment.TextAlignmentNear, ElseIf {"POSITION_ALLOWANCE_ACTUAL_AMOUNT", "RECEIPT_ALLOWANCE_ACTUAL_AMOUNT"}.Contains(oItemSPECNAME) Then
' oPosCount) Dim oTerm = FormatCurrency(oItemValue, oCurrencySymbol)
MyGDPicturePDF.DrawText(fontResName, 19, yPosition, oItemValue) If oInvHasDiscount And oItemSPECNAME = "RECEIPT_ALLOWANCE_ACTUAL_AMOUNT" And Not oTerm.StartsWith("-") Then
'Tabellendarstellung Ende oTerm = "-" + oTerm
End If
MyGDPicturePDF.DrawText(fontResName, 181, yPosition, oTerm)
Else
If oYDyn = 0 Then
oYDyn = yPosition
End If
Dim oPartsNL As List(Of String) = StringFunctions.SplitTextByNewLine(oItemValue)
For Each olinepart As String In oPartsNL
Dim oParts As List(Of String) = StringFunctions.SplitText_Length(olinepart, 64)
' Durchlaufen der einzelnen Teile in einer Schleife
For Each part As String In oParts
MyGDPicturePDF.DrawText(fontResName, 19, oYDyn, part)
oYDyn += 5
oYPlus += 5
Next
Next
End If
oDisplay = False oDisplay = False
ElseIf oItemSPECNAME = "INVOICE_POSITION_UNIT_TYPE" Then ElseIf oItemSPECNAME = "INVOICE_POSITION_UNIT_TYPE" Then
oYPlus = 0 oYPlus = 0
Dim oUnit = Return_UnitType(oItemValue) Dim oUnit = Return_UnitType(oItemValue)
MyGDPicturePDF.DrawText(fontResName, 35, yPosition, oUnit) MyGDPicturePDF.DrawText(fontResName, 35, yPosition, oUnit)
oDisplay = False oDisplay = False
ElseIf oItemSPECNAME = "INVOICE_POSITION_ARTICLE" Then ElseIf {"POSITION_ALLOWANCE_REASON", "RECEIPT_ALLOWANCE_REASON", "INVOICE_POSITION_ARTICLE", "INVOICE_POSITION_ARTICLE_DESCRIPTION"}.Contains(oItemSPECNAME) Then
'Tabellendarstellung 'Tabellendarstellung
oYPlus = 0 If Not oDescriptionFollowup Then
oYPlus = 0
End If
If oYDyn = 0 Then
oYDyn = yPosition
End If
Dim oX = 50
If oItemSPECNAME.Contains("ALLOWANCE") Then
oX = 20
End If
oPosDesc = "" oPosDesc = ""
oPosDesc = oItemValue oPosDesc = oItemValue
Dim oYDyn As Integer = yPosition - 5
Dim oPartsNL As List(Of String) = StringFunctions.SplitTextByNewLine(oItemValue) Dim oPartsNL As List(Of String) = StringFunctions.SplitTextByNewLine(oItemValue)
For Each olinepart As String In oPartsNL For Each olinepart As String In oPartsNL
Dim oParts As List(Of String) = StringFunctions.SplitText_Length(olinepart, 67) Dim oParts As List(Of String) = StringFunctions.SplitText_Length(olinepart, 64)
' Durchlaufen der einzelnen Teile in einer Schleife ' Durchlaufen der einzelnen Teile in einer Schleife
For Each part As String In oParts For Each part As String In oParts
MyGDPicturePDF.DrawText(fontResName, oX, oYDyn, part)
oYDyn += 5 oYDyn += 5
oYPlus += 5 oYPlus += 5
MyGDPicturePDF.DrawText(fontResName, 50, oYDyn, part)
Next Next
Next Next
'Tabellendarstellung Ende
' oPosTerm += $" {oItemValue}"
oDisplay = False oDisplay = False
ElseIf oItemSPECNAME = "INVOICE_POSITION_NOTE" Then ElseIf oItemSPECNAME = "INVOICE_POSITION_NOTE" Then
'Tabellendarstellung 'Tabellendarstellung
Dim cleanedText As String = RemoveNewlinesAndTabs(oItemValue) Dim cleanedText As String = RemoveNewlinesAndTabs(oItemValue)
Dim oParts As List(Of String) = StringFunctions.SplitText_Length(cleanedText, 70) Dim oParts As List(Of String) = StringFunctions.SplitText_Length(cleanedText, 70)
' Durchlaufen der einzelnen Teile in einer Schleife ' Durchlaufen der einzelnen Teile in einer Schleife
Dim oYDyn As Integer = yPosition If oYDyn = 0 Then
oYDyn = yPosition
End If
Dim oPartsNL As List(Of String) = StringFunctions.SplitTextByNewLine(oItemValue) Dim oPartsNL As List(Of String) = StringFunctions.SplitTextByNewLine(oItemValue)
For Each olinepart As String In oPartsNL For Each olinepart As String In oPartsNL
Dim oPartsPN As List(Of String) = StringFunctions.SplitText_Length(olinepart, 70) Dim oPartsPN As List(Of String) = StringFunctions.SplitText_Length(olinepart, 70)
' Durchlaufen der einzelnen Teile in einer Schleife ' Durchlaufen der einzelnen Teile in einer Schleife
For Each part As String In oPartsPN For Each part As String In oPartsPN
MyGDPicturePDF.DrawText(fontResName, 50, oYDyn, part)
oYDyn += 5 oYDyn += 5
oYPlus += 5 oYPlus += 5
MyGDPicturePDF.DrawText(fontResName, 50, oYDyn, part)
Next Next
Next Next
'oPosTerm += $" {oItemValue}" 'oPosTerm += $" {oItemValue}"
oDisplay = False oDisplay = False
ElseIf oItemSPECNAME = "INVOICE_POSITION_ARTICLE_DESCRIPTION" Then ElseIf {"INVOICE_TAXPOS_TAX_RATE", "INVOICE_TAXPOS_RATE", "POSITION_ALLOWANCE_CALCULATION_PERCENT", "RECEIPT_ALLOWANCE_CALCULATION_PERCENT", "RECEIPT_ALLOWANCE_VAT_RATE"}.Contains(oItemSPECNAME) Then
'Tabellendarstellung MyGDPicturePDF.DrawText(fontResName, 163, yPosition, $"{oItemValue} %")
Dim cleanedText As String = RemoveNewlinesAndTabs(oItemValue) oDisplay = False
Dim oParts As List(Of String) = StringFunctions.SplitText_Length(cleanedText, 70) ElseIf {"INVOICE_POSITION_TAX_AMOUNT"}.Contains(oItemSPECNAME) Then
' Durchlaufen der einzelnen Teile in einer Schleife
Dim oYDyn As Integer = yPosition
Dim oPartsNL As List(Of String) = StringFunctions.SplitTextByNewLine(oItemValue)
For Each olinepart As String In oPartsNL
Dim oPartsPN As List(Of String) = StringFunctions.SplitText_Length(olinepart, 70)
' Durchlaufen der einzelnen Teile in einer Schleife
For Each part As String In oPartsPN
oYDyn += 5
oYPlus += 5
MyGDPicturePDF.DrawText(fontResName, 50, oYDyn, part)
Next
Next
'oPosTerm += $" {oItemValue}"
oDisplay = False
ElseIf oItemSPECNAME = "INVOICE_TAXPOS_TAX_RATE" Or oItemSPECNAME = "INVOICE_TAXPOS_RATE" Then
'Tabellendarstellung
MyGDPicturePDF.DrawText(fontResName, 164, yPosition, $"{oItemValue} %")
'Tabellendarstellung ENDE
' oPosTerm += $" - {oItemValue} %"
oDisplay = False
ElseIf oItemSPECNAME = "INVOICE_POSITION_TAX_AMOUNT" Then
'Tabellendarstellung
Dim oYPos = yPosition - 3.5 Dim oYPos = yPosition - 3.5
Dim oBetrag As Decimal = oItemValue Dim TAXTERM = FormatCurrency(oItemValue, oCurrencySymbol)
Dim oFormatiert As String = oBetrag.ToString("N2", New Globalization.CultureInfo("de-DE"))
Dim TAXTERM = $"{oFormatiert} {oCurrencySymbol}"
MyGDPicturePDF.DrawTextBox(fontResName, 177, oYPos, 198, YCoo_TextBoxPlus5(oYPos), MyGDPicturePDF.DrawTextBox(fontResName, 177, oYPos, 198, YCoo_TextBoxPlus5(oYPos),
TextAlignment.TextAlignmentFar, TextAlignment.TextAlignmentNear, TextAlignment.TextAlignmentFar, TextAlignment.TextAlignmentNear,
TAXTERM) TAXTERM)
' MyGDPicturePDF.DrawText(fontResName, 180, yPosition, $"{oItemValue} {oCurrencySymbol}")
'Tabellendarstellung Ende
End If End If
oItemValue = oPosTerm oItemValue = oPosTerm
ElseIf oArea = "HEAD" Then ElseIf oArea = "HEAD" Then
If oItemSPECNAME = "INVOICE_DATE" Or oItemSPECNAME = "INVOICE_SERVICE_DATE" Then If {"INVOICE_DATE", "INVOICE_SERVICE_DATE"}.Contains(oItemSPECNAME) Then
oItemValue = StringFunctions.DatetimeStringToGermanStringConverter(oItemValue, _logger) oItemValue = StringFunctions.DatetimeStringToGermanStringConverter(oItemValue, _logger)
End If End If
ElseIf oArea = "TAXPOS" Then ElseIf oArea = "TAXPOS" Then
@ -324,10 +414,7 @@ Public Class XRechnungViewDocument
oPosTerm = $"{oItemValue} %:" oPosTerm = $"{oItemValue} %:"
oDisplay = False oDisplay = False
ElseIf oItemSPECNAME = "INVOICE_TAXPOS_AMOUNT" Then ElseIf oItemSPECNAME = "INVOICE_TAXPOS_AMOUNT" Then
Dim oBetrag As Decimal = oItemValue oPosTerm += FormatCurrency(oItemValue, oCurrencySymbol)
Dim oFormatiert As String = oBetrag.ToString("N2", New Globalization.CultureInfo("de-DE"))
oFormatiert += $" {oCurrencySymbol}"
oPosTerm += $" {oFormatiert}"
oDisplay = False oDisplay = False
ElseIf oItemSPECNAME = "INVOICE_TAXPOS_TYPE" Then ElseIf oItemSPECNAME = "INVOICE_TAXPOS_TYPE" Then
oPosTerm += $" {oItemValue}" oPosTerm += $" {oItemValue}"
@ -342,16 +429,14 @@ Public Class XRechnungViewDocument
If Y_eq_lastrow = False And oAreaSwitch = False Then If Y_eq_lastrow = False And oAreaSwitch = False Then
yPosition += 5 yPosition += 5
End If End If
If oArea = "AMOUNT" Then If oArea = "AMOUNT" Or oArea = "ALLOWANCE" Then
If oItemSPECNAME = "INVOICE_TOTAL_TAX" Or oItemSPECNAME = "INVOICE_TOTAL_NET" Or oItemSPECNAME = "INVOICE_TOTAL_GROSS" Then
Dim oBetrag As Decimal = oItemValue Dim oCURRENCYFORMAT = {"INVOICE_TOTAL_TAX", "INVOICE_TOTAL_NET", "INVOICE_TOTAL_GROSS", "POSITION_ALLOWANCE_ACTUAL_AMOUNT", "RECEIPT_ALLOWANCE_ACTUAL_AMOUNT",
Dim oFormatiert As String = oBetrag.ToString("N2", New Globalization.CultureInfo("de-DE")) "POSITION_ALLOWANCE_CALCULATION_PERCENT", "RECEIPT_ALLOWANCE_CALCULATION_PERCENT"}
oFormatiert += $" {oCurrencySymbol}" If oCURRENCYFORMAT.Contains(oItemSPECNAME) Then
oItemValue = oFormatiert oItemValue = FormatCurrency(oItemValue, oCurrencySymbol)
End If End If
End If End If
If oRowCaption <> String.Empty Then If oRowCaption <> String.Empty Then
'Zuerst die RowCaption 'Zuerst die RowCaption
MyGDPicturePDF.DrawText(fontResName, 10, yPosition, oRowCaption) MyGDPicturePDF.DrawText(fontResName, 10, yPosition, oRowCaption)
@ -364,7 +449,6 @@ Public Class XRechnungViewDocument
Else Else
MyGDPicturePDF.DrawText(fontResName, 70, yPosition, oItemValue) MyGDPicturePDF.DrawText(fontResName, 70, yPosition, oItemValue)
End If End If
Else Else
If Y_eq_lastrow = True Then If Y_eq_lastrow = True Then
MyGDPicturePDF.DrawText(fontResName, oRow.Item("xPosition"), yPosition, oItemValue) MyGDPicturePDF.DrawText(fontResName, oRow.Item("xPosition"), yPosition, oItemValue)
@ -392,35 +476,44 @@ Public Class XRechnungViewDocument
End If End If
End If End If
Else Else
'Tabellendarstellung
If oItemSPECNAME = "INVOICE_POSITION_TAX_AMOUNT" And oYPlus > 0 Then If oItemSPECNAME = "INVOICE_POSITION_TAX_AMOUNT" And oYPlus > 0 Then
yPosition += oYPlus - 5 yPosition += oYPlus
Else
End If End If
'Tabellendarstellung Ende
End If End If
oIndex += 1 oIndex += 1
Next Next
' Dim oeinv_Format As PdfInvoiceDataFormat = PdfInvoiceDataFormat.ZUGFeRD_2_0
Dim oAttString = "E-invoice XML attachment"
If File.Exists(oXmlFilePath) Then
MyGDPicturePDF.EmbedFile(oXmlFilePath, oAttString)
Else
_logger.Info("XML File is not existing and could not be embedded!")
Return Nothing
End If
MyGDPicturePDF.EnableCompression(True)
Dim oeinv_Format As PdfInvoiceDataFormat = PdfInvoiceDataFormat.ZUGFeRD_2_0
MyGDPicturePDF.EmbedFile(oTempFilePath, "Rechnungsdaten im ZUGFeRD-XML-Format")
'Finalize And save the PDF 'Finalize And save the PDF
oPDFStatus = MyGDPicturePDF.SaveToFile(oOutputPath) oPDFStatus = MyGDPicturePDF.SaveToFile(oOutputPath)
If oPDFStatus = GdPictureStatus.OK Then If oPDFStatus = GdPictureStatus.OK Then
_logger.Info("PDF VisualReceipt generated successfully!") _logger.Info("PDF VisualReceipt generated successfully!")
_logger.Debug("Vor MOVE... oxmlFilePath: [{0}] / oTempFilePath: [{1}]", oXmlFilePath, oTempFilePath)
File.Move(oXmlFilePath, oTempFilePath)
Else Else
_logger.Warn($"Error generating PDF VisualReceipt: {oPDFStatus}") _logger.Warn($"Error generating PDF VisualReceipt: {oPDFStatus}")
End If End If
'Release resources 'Release resources
MyGDPicturePDF.CloseDocument() MyGDPicturePDF.CloseDocument()
If oPDFStatus = GdPictureStatus.OK Then If oPDFStatus = GdPictureStatus.OK Then
File.Delete(oXRechnungFile) ' File.Delete(oXRechnungFile)
oNewFileinfo = New FileInfo(oOutputPath) oNewFileinfo = New FileInfo(oOutputPath)
_logger.Info("Create_PDFfromXML() End successfully. File [{0}] written.", oNewFileinfo.FullName)
_logger.Debug("Create_PDFfromXML() End successfully")
Return oNewFileinfo Return oNewFileinfo
Else Else
_logger.Debug("Create_PDFfromXML() Ends with nothing") _logger.Warn("Create_PDFfromXML() Ends with nothing")
Return Nothing Return Nothing
End If End If
@ -429,6 +522,43 @@ Public Class XRechnungViewDocument
Return Nothing Return Nothing
End Try End Try
End Function End Function
'Private Function FormatCurrency(ByVal pValue As String, pCurrencySymbol As String) As String
' pValue = pValue.Replace(".", ",")
' Dim oBetrag As Decimal = pValue
' Dim oFormatiert As String = oBetrag.ToString("N2", New Globalization.CultureInfo("de-DE"))
' oFormatiert = $"{oFormatiert} {pCurrencySymbol}"
' Return oFormatiert
'End Function
Private Function FormatCurrency(ByVal pValue As String, pCurrencySymbol As String) As String
pValue = pValue.Trim()
Dim oBetrag As Decimal
Dim culture As Globalization.CultureInfo
' Erkennung des Dezimaltrennzeichens
If pValue.Contains(",") AndAlso Not pValue.Contains(".") Then
culture = New Globalization.CultureInfo("de-DE") ' Komma deutsches Format
ElseIf pValue.Contains(".") AndAlso Not pValue.Contains(",") Then
culture = New Globalization.CultureInfo("en-US") ' Punkt englisches Format
Else
' Mischformat oder Tausendertrennzeichen Fallback auf aktuelle Culture
culture = Globalization.CultureInfo.CurrentCulture
End If
' Parsen mit gewählter Culture
If Not Decimal.TryParse(pValue, Globalization.NumberStyles.Any, culture, oBetrag) Then
Throw New FormatException($"Ungültiger Zahlenwert: {pValue}")
End If
' Formatieren mit deutscher Culture
Dim oFormatiert As String = oBetrag.ToString("N2", New Globalization.CultureInfo("de-DE"))
Return $"{oFormatiert} {pCurrencySymbol}"
End Function
Private Function FormatStringT(ByVal text As String) As String
Return text.Replace(vbCr, " - ").Replace(vbLf, "").Replace(vbTab, " ")
End Function
Private Function RemoveNewlinesAndTabs(ByVal text As String) As String Private Function RemoveNewlinesAndTabs(ByVal text As String) As String
Return text.Replace(vbCr, " - ").Replace(vbLf, "").Replace(vbTab, " ") Return text.Replace(vbCr, " - ").Replace(vbLf, "").Replace(vbTab, " ")
End Function End Function
@ -449,28 +579,28 @@ Public Class XRechnungViewDocument
Dim lines As List(Of String) = text.Split({vbCrLf, vbLf, vbCr}, StringSplitOptions.None).ToList() Dim lines As List(Of String) = text.Split({vbCrLf, vbLf, vbCr}, StringSplitOptions.None).ToList()
Return lines Return lines
End Function End Function
Public Function Create_PageHeader(pFollowPage As Boolean) As Integer
'Draw content on the PDF
Dim yPosition As Integer = 15
MyGDPicturePDF.SetTextSize(18)
MyGDPicturePDF.DrawText(fontResName, 10, yPosition, "xRechnung Sichtbeleg - xInvoice Visual Receipt")
yPosition += 10
MyGDPicturePDF.SetTextSize(10)
MyGDPicturePDF.DrawText(fontResNameItalic, 10, yPosition, XRechnungStrings.CommentSichtbeleg_DE_Row1)
yPosition += 5
MyGDPicturePDF.DrawText(fontResNameItalic, 10, yPosition, XRechnungStrings.CommentSichtbeleg_DE_Row2)
yPosition += 5
MyGDPicturePDF.DrawText(fontResNameItalic, 10, yPosition, XRechnungStrings.CommentSichtbeleg_EN_Row1)
yPosition += 5
MyGDPicturePDF.DrawText(fontResNameItalic, 10, yPosition, XRechnungStrings.CommentSichtbeleg_EN_Row2)
Return yPosition
End Function
Public Sub Create_PageFooter()
MyGDPicturePDF.DrawLine(10, 280, 200, 280)
Dim oCreatedString = $"Maschinell erstellt durch / Automatically created by Digital Data E-Rechnung Parser: {Now.ToString}"
MyGDPicturePDF.DrawText(fontResName, 10, 285, oCreatedString)
End Sub
Private Function Return_InvType(pType As String) As String Private Function Return_InvType(pType As String) As String
Dim oReturn As String = "Rechnung/invoice" Dim oReturn As String = "Rechnung/invoice"

View File

@ -4,8 +4,8 @@
<package id="DocumentFormat.OpenXml" version="3.2.0" targetFramework="net462" /> <package id="DocumentFormat.OpenXml" version="3.2.0" targetFramework="net462" />
<package id="DocumentFormat.OpenXml.Framework" version="3.2.0" targetFramework="net462" /> <package id="DocumentFormat.OpenXml.Framework" version="3.2.0" targetFramework="net462" />
<package id="FirebirdSql.Data.FirebirdClient" version="7.5.0" targetFramework="net461" /> <package id="FirebirdSql.Data.FirebirdClient" version="7.5.0" targetFramework="net461" />
<package id="GdPicture" version="14.3.3" targetFramework="net462" /> <package id="GdPicture" version="14.3.19" targetFramework="net462" />
<package id="GdPicture.runtimes.windows" version="14.3.3" targetFramework="net462" /> <package id="GdPicture.runtimes.windows" version="14.3.19" targetFramework="net462" />
<package id="Microsoft.AspNet.WebApi.Client" version="6.0.0" targetFramework="net462" /> <package id="Microsoft.AspNet.WebApi.Client" version="6.0.0" targetFramework="net462" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="8.0.0" targetFramework="net462" /> <package id="Microsoft.Bcl.AsyncInterfaces" version="8.0.0" targetFramework="net462" />
<package id="Microsoft.CSharp" version="4.7.0" targetFramework="net462" /> <package id="Microsoft.CSharp" version="4.7.0" targetFramework="net462" />
@ -18,16 +18,14 @@
<package id="protobuf-net.Core" version="3.2.46" targetFramework="net462" /> <package id="protobuf-net.Core" version="3.2.46" targetFramework="net462" />
<package id="RtfPipe" version="2.0.7677.4303" targetFramework="net462" /> <package id="RtfPipe" version="2.0.7677.4303" targetFramework="net462" />
<package id="System.Buffers" version="4.6.0" targetFramework="net462" /> <package id="System.Buffers" version="4.6.0" targetFramework="net462" />
<package id="System.CodeDom" version="8.0.0" targetFramework="net462" />
<package id="System.Collections.Immutable" version="8.0.0" targetFramework="net462" /> <package id="System.Collections.Immutable" version="8.0.0" targetFramework="net462" />
<package id="System.IO.Packaging" version="8.0.1" targetFramework="net462" /> <package id="System.IO.Packaging" version="8.0.1" targetFramework="net462" />
<package id="System.Management" version="8.0.0" targetFramework="net462" />
<package id="System.Memory" version="4.6.0" targetFramework="net462" /> <package id="System.Memory" version="4.6.0" targetFramework="net462" />
<package id="System.Numerics.Vectors" version="4.6.0" targetFramework="net462" /> <package id="System.Numerics.Vectors" version="4.6.0" targetFramework="net462" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.1.0" targetFramework="net462" /> <package id="System.Runtime.CompilerServices.Unsafe" version="6.1.0" targetFramework="net462" />
<package id="System.Security.Cryptography.Pkcs" version="8.0.1" targetFramework="net462" /> <package id="System.Security.Cryptography.Pkcs" version="8.0.1" targetFramework="net462" />
<package id="System.Text.Encodings.Web" version="8.0.0" targetFramework="net462" /> <package id="System.Text.Encodings.Web" version="8.0.0" targetFramework="net462" />
<package id="System.Text.Json" version="8.0.5" targetFramework="net462" /> <package id="System.Text.Json" version="8.0.6" targetFramework="net462" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net462" /> <package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net462" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net462" /> <package id="System.ValueTuple" version="4.5.0" targetFramework="net462" />
</packages> </packages>

66
c Normal file
View File

@ -0,0 +1,66 @@
51798a28 (HEAD -> master) HEAD@{0}: reset: moving to 51798a28f5fddb5b5e62e5e3944dfa8cea4bb12a
ec3a677c HEAD@{1}: commit: MS Jobs Sichtbeleg
48406884 HEAD@{2}: pull --progress --no-edit --no-stat --recurse-submodules=no origin: Fast-forward
204aaaeb HEAD@{3}: commit: Korrektur
ec378ba3 HEAD@{4}: commit: Modules.Interfaces: Version 2.3.7.0
35b19cde HEAD@{5}: commit: Modules.Interfaces: Fehlende Elemente der Codeliste UNTDID 7161 (Charge codes) nachgetragen, passend zur Version 2.3.x
9ae5465c HEAD@{6}: commit: Modules.Jobs: Version 3.0.3.0
82139fc3 HEAD@{7}: commit: Modules.Jobs: 4000 Zeichen-Grenze
f4ba4d9e HEAD@{8}: commit: Modules.Interface: Listen-Items Handling (Item_Type = 4)
0aabc12f HEAD@{9}: commit: Modules.Jobs: Version 3.0.2.0
adbd0fe9 HEAD@{10}: commit: Modules.Jobs: Kürzen der ITEM_VALUE-Werte entfernt. Tabelle muss VARCHAR(max) vorsehen.
2d6a2df4 HEAD@{11}: commit: Modules.Jobs: Version 3.0.1.0
e7ccb748 HEAD@{12}: commit: Modules.Interfaces: Version 2.3.6.0
05355c93 HEAD@{13}: commit: Readonly Property
2007bb91 HEAD@{14}: commit: Modules.Interfaces & Modules.Jobs: Weitergabe der ErrorCodes in den Exceptions, um sie im WebService auswerten zu können.
d7d2ecf8 HEAD@{15}: commit: Modules.Jobs: Replace Case-Insensitiv
447c7ea6 HEAD@{16}: commit: Modules.Jobs: Version 3.0.0.0
32bb14db HEAD@{17}: commit: Modules.Jobs: Strings-Vergleiche sollten unbedingt mit string.equals() erfolgen!
a5226a81 HEAD@{18}: commit: Modules.Interfaces: Try/Catch und logging
b534c4c7 HEAD@{19}: commit: Modules.Interfaces: Version 2.3.5.0
dc801383 HEAD@{20}: commit: Modules.Jobs: Version 2.9.9.0
477bb511 HEAD@{21}: commit: Modules.Interfaces & Modules.Jobs: ZUGFeRD 2.3.x-Logik angepasst. Auswertung der XML-Tabelle korrigiert, das Dictionary wird erst später erstellt.
0b66b805 HEAD@{22}: commit: Modules.Jobs: Version 2.9.8.0
5fd924d4 HEAD@{23}: commit: Modules.Interfaces: Version 2.3.4.0
e8ebc302 HEAD@{24}: commit: Modules.Interface + Modules.Jobs: ITEM_TYPE = 4 / Description enthält jetzt BT-Feld-Info / Kommentare / Abfrage BT-Felder
262805d1 HEAD@{25}: commit: Modules.Interface: Datumsformat immer 8-stellig (yyyyMMdd) aufbereiten
623807c5 HEAD@{26}: commit: Modules.Interfaces: Version 2.3.3
aee7997c HEAD@{27}: commit: Modules.Interfaces: Date/DateTime (yyyy-MM-dd) und Decimal/Numeric-Werte mit CultureInfo.Invariant.Culture speichern.
82a95faa HEAD@{28}: commit: Modules.Jobs: Version 2.9.7.0
af7534df HEAD@{29}: commit: Modules.Interfaces: Version 2.3.2.0
fa2c2a64 HEAD@{30}: commit: Modules.Jobs: Keine Hochkomma-Ersetzung mehr bei Bulk-Insert
390a5247 HEAD@{31}: commit: Modules.Interfaces: Belegarten in ZUGFeRD 2.3.x korrigiert und fehlende nachgetragen.
0ed99610 HEAD@{32}: commit: Leere Strings (item_type = 0) nicht mehr in die DB schreiben
2e0ae13a HEAD@{33}: commit: Modules.Jobs: Version 2.9.6.0
267e0387 HEAD@{34}: commit: Modules.Jobs: Prüfe ob Value überhaupt einen Wert hat, sonst wird auch keine Datei erstellt
2673755b HEAD@{35}: commit: Jobs: base64 / varbinary
5052ce4f HEAD@{36}: commit: Modules.Jobs: Version 2.9.5.0
717909d7 HEAD@{37}: commit: Modules.Jobs: MIME-Typen (pdf, xlsx, odt) - Fehlerhandling ergänzt, wenn Dateien nicht erstellt werden können.
04a408ab HEAD@{38}: commit: Jobs: MIME-Types + File-Extension + xlsx-Dateien
face3c76 HEAD@{39}: commit: Modules.Database: Version 2.3.6.0
2d3a1cd2 HEAD@{40}: commit: Korrektur von MS in master nachgezogen
43e95a20 HEAD@{41}: checkout: moving from Update-Net-8 to master
c0054d41 (Update-Net-8) HEAD@{42}: checkout: moving from master to Update-Net-8
43e95a20 HEAD@{43}: checkout: moving from Update-Net-8 to master
c0054d41 (Update-Net-8) HEAD@{44}: checkout: moving from master to Update-Net-8
43e95a20 HEAD@{45}: checkout: moving from Update-Net-8 to master
c0054d41 (Update-Net-8) HEAD@{46}: checkout: moving from master to Update-Net-8
43e95a20 HEAD@{47}: commit: Modules.Jobs: Version 2.9.4.0
05d0bd60 HEAD@{48}: commit: Modules.Interfaces: Version 2.3.1.0
7e70c059 HEAD@{49}: commit: Auslesen von embedded Files aus einer XML-Datei
0261d237 HEAD@{50}: pull --progress --no-edit --no-stat --recurse-submodules=no origin: Fast-forward
ea7fe74e HEAD@{51}: pull --progress --no-edit --no-stat --recurse-submodules=no origin: Merge made by the 'ort' strategy.
df04b0a7 HEAD@{52}: commit: Modules.Jobs: Version 2.9.3.0
ce652760 HEAD@{53}: commit: Modules.Base: version 1.3.9.0
17d5acee HEAD@{54}: commit: Neue Datum-Konvertierungsfunktion
c7afa2f7 HEAD@{55}: commit: Modules.Interfaces: Version 2.2.9.0
4d5ab649 HEAD@{56}: commit: Peppol in UBL2.1 umbenannt
f4c3e9b3 HEAD@{57}: commit: Modules.Interfaces: Version 2.2.8.0
9d76b17b HEAD@{58}: commit: Integration ZUGFeRD 2.3.3 XSD Schema
2ec92511 HEAD@{59}: commit: Modules.Jobs: Version 2.9.2.0
8e1b9d21 HEAD@{60}: commit: Modules.Interfaces - Version 2.2.7.0
7ac596b9 HEAD@{61}: pull --progress --no-edit --no-stat --recurse-submodules=no origin: Merge made by the 'ort' strategy.
cf9650be HEAD@{62}: commit: Peppol 3017 / UBL Logik
5774eb76 HEAD@{63}: pull --progress --no-edit --no-stat --recurse-submodules=no origin: Fast-forward
7602f2c8 HEAD@{64}: commit: Nuget Update - GDPicture
c74b7782 HEAD@{65}: clone: from http://git.dd:3000/AppStd/Modules