From 08441ec5832cffcda2b7435a6c75b5f8cbcd5be8 Mon Sep 17 00:00:00 2001 From: Sven Harazim Date: Mon, 12 Sep 2022 10:34:05 +0200 Subject: [PATCH] update validation-lib, support XRechnung v2.2.0, v2.1.1.,v1.2.2 removed --- .gitignore | 3 +- Distribution/README.md | 15 ++- Distribution/installtools.ps1 | 30 ++---- README.md | 5 +- Samples/XRechnungProject.dproj | 86 ++++++++-------- Samples/XRechnungUnit1.dfm | 132 ++++++++++--------------- Samples/XRechnungUnit1.pas | 115 ++++----------------- intf.Invoice.pas | 4 +- intf.MSXML2_TLB.pas | 4 +- intf.XRechnung.pas | 64 +++++------- intf.XRechnungValidationHelperJava.pas | 4 +- 11 files changed, 162 insertions(+), 300 deletions(-) diff --git a/.gitignore b/.gitignore index 4332761..ee0de6c 100644 --- a/.gitignore +++ b/.gitignore @@ -31,8 +31,7 @@ Samples/Win32 Samples/Win64 SaxonHE-Unmanaged Distribution/validator -Distribution/validator-configuration-122 -Distribution/validator-configuration-211 +Distribution/validator-configuration-220 Distribution/visualization Distribution/java Schema diff --git a/Distribution/README.md b/Distribution/README.md index 3d9a8a6..d8902be 100644 --- a/Distribution/README.md +++ b/Distribution/README.md @@ -1,9 +1,14 @@ # XRechnung Validierung -Das Skript installtools.ps1 mit PowerShell ausführen, um die Tools zu installieren bzw. zu aktualisieren. +Das Skript installtools.ps1 mit PowerShell ausfuehren, um die Tools zu installieren bzw. zu aktualisieren. ## Historie +- 12.09.2022 Update\ + validator-configuration-xrechnung_2.2.0_2022-07-15.zip\ + xrechnung-2.2.0-xrechnung-visualization-2022-07-31.zip\ + jdk8u292-b10_openj9-0.26.0/OpenJDK8U-jre_x64_windows_openj9_8u292b10_openj9-0.26.0.zip + - 05.04.2022 Update xrechnung-2.1.1-xrechnung-visualization-2021-11-15 validator-configuration-xrechnung_2.1.1_2021-11-15 - 01.10.2021 Update validationtool-1.4.2 validator-configuration-xrechnung_2.1.1_2021-07-31 xrechnung-2.1.1-xrechnung-visualization-2021-07-31 @@ -24,10 +29,10 @@ https://adoptopenjdk.net ## Versionen -https://github.com/itplr-kosit/validator/releases/tag/v1.4.1 +https://github.com/itplr-kosit/validator/releases/tag/v1.4.2 -https://github.com/itplr-kosit/validator-configuration-xrechnung/releases/tag/release-2020-12-31 +https://github.com/itplr-kosit/validator-configuration-xrechnung/releases/tag/release-2022-07-15 -https://github.com/itplr-kosit/xrechnung-visualization/releases/tag/v2020-12-31 +https://github.com/itplr-kosit/xrechnung-visualization/releases/tag/v2022-07-31 -https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u265-b01/OpenJDK8U-jre_x64_windows_hotspot_8u265b01.zip +https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u292-b10_openj9-0.26.0/OpenJDK8U-jre_x64_windows_openj9_8u292b10_openj9-0.26.0.zip diff --git a/Distribution/installtools.ps1 b/Distribution/installtools.ps1 index c80e853..927cd21 100644 --- a/Distribution/installtools.ps1 +++ b/Distribution/installtools.ps1 @@ -2,15 +2,8 @@ If (Test-Path validator){ Remove-Item validator -Recurse } -If (Test-Path validator-configuration-122){ - Remove-Item validator-configuration-122 -Recurse -} - -If (Test-Path validator-configuration-200){ - Remove-Item validator-configuration-200 -Recurse -} -If (Test-Path validator-configuration-211){ - Remove-Item validator-configuration-211 -Recurse +If (Test-Path validator-configuration-220){ + Remove-Item validator-configuration-220 -Recurse } If (Test-Path visualization){ @@ -22,27 +15,22 @@ If (Test-Path java){ } Invoke-WebRequest -Uri https://github.com/itplr-kosit/validator/releases/download/v1.4.2/validator-1.4.2-distribution.zip -OutFile validator.zip -Invoke-WebRequest -Uri https://github.com/itplr-kosit/validator-configuration-xrechnung/releases/download/release-2019-12-30/validator-configuration-xrechnung_1.2.2_2019-12-30.zip -OutFile validator-configuration-122.zip -Invoke-WebRequest -Uri https://github.com/itplr-kosit/validator-configuration-xrechnung/releases/download/release-2021-11-15/validator-configuration-xrechnung_2.1.1_2021-11-15.zip -OutFile validator-configuration-211.zip -Invoke-WebRequest -Uri https://github.com/itplr-kosit/xrechnung-visualization/releases/download/v2021-11-15/xrechnung-2.1.1-xrechnung-visualization-2021-11-15.zip -OutFile visualization.zip -Invoke-WebRequest -Uri https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u265-b01/OpenJDK8U-jre_x64_windows_hotspot_8u265b01.zip -OutFile jre.zip +Invoke-WebRequest -Uri https://github.com/itplr-kosit/validator-configuration-xrechnung/releases/download/release-2022-07-15/validator-configuration-xrechnung_2.2.0_2022-07-15.zip -OutFile validator-configuration-220.zip +Invoke-WebRequest -Uri https://github.com/itplr-kosit/xrechnung-visualization/releases/download/v2022-07-31/xrechnung-2.2.0-xrechnung-visualization-2022-07-31.zip -OutFile visualization.zip +Invoke-WebRequest -Uri https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u292-b10_openj9-0.26.0/OpenJDK8U-jre_x64_windows_openj9_8u292b10_openj9-0.26.0.zip -OutFile jre.zip Expand-Archive validator.zip -Expand-Archive validator-configuration-122.zip -Expand-Archive validator-configuration-211.zip +Expand-Archive validator-configuration-220.zip Expand-Archive visualization.zip Expand-Archive jre.zip -Move-Item .\jre\jdk8u265-b01-jre .\java +Move-Item .\jre\jdk8u292-b10-jre .\java Remove-Item jre -Recurse If (Test-Path validator.zip){ Remove-Item validator.zip } -If (Test-Path validator-configuration-122.zip){ - Remove-Item validator-configuration-122.zip -} -If (Test-Path validator-configuration-211.zip){ - Remove-Item validator-configuration-211.zip +If (Test-Path validator-configuration-220.zip){ + Remove-Item validator-configuration-220.zip } If (Test-Path visualization.zip){ Remove-Item visualization.zip diff --git a/README.md b/README.md index 7d26c4d..22b27c1 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Erstellen von Rechnungen im - XRechnung-UBL-Format (Universal Business Language) -- XRechnung-CII-Format (Cross Industrie Invoice ZUGFeRD 2.1.1) +- XRechnung-CII-Format (Cross Industrie Invoice) ## TODO @@ -22,8 +22,7 @@ https://github.com/itplr-kosit/validator-configuration-xrechnung/issues/41 Aktuelle XRechnung-Versionen -- 1.2.2 (Gültigkeitszeitraum 01.07.2020 - 31.12.2020) -- 2.1.1 (Gültigkeitszeitraum 01.02.2022 - 31.07.2022) +- 2.2.0 ## Weitere Informationen zu XRechnung diff --git a/Samples/XRechnungProject.dproj b/Samples/XRechnungProject.dproj index 07c4374..665d19e 100644 --- a/Samples/XRechnungProject.dproj +++ b/Samples/XRechnungProject.dproj @@ -1,7 +1,7 @@  {289847D5-0AA3-4C16-9133-97921118E4C5} - 19.4 + 19.5 VCL XRechnungProject.dpr True @@ -157,13 +157,8 @@ Microsoft Office XP Beispiele für gekapselte Komponenten für Automation Server - - - - XRechnungProject.exe - true - - + + 1 @@ -186,16 +181,6 @@ 64 - - - classes - 1 - - - classes - 1 - - res\xml @@ -505,7 +490,7 @@ 1 .dylib - + 1 .dylib @@ -538,7 +523,7 @@ 1 .dylib - + 1 .dylib @@ -575,7 +560,7 @@ 0 - + 0 @@ -599,13 +584,17 @@ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 @@ -615,7 +604,7 @@ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 @@ -625,7 +614,7 @@ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 @@ -635,7 +624,7 @@ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 @@ -645,7 +634,7 @@ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 @@ -655,7 +644,7 @@ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 @@ -665,7 +654,7 @@ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 @@ -675,7 +664,7 @@ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 @@ -685,7 +674,7 @@ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 @@ -695,7 +684,7 @@ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 @@ -705,7 +694,7 @@ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 @@ -715,7 +704,7 @@ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 @@ -725,7 +714,7 @@ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 @@ -735,7 +724,7 @@ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 @@ -745,7 +734,7 @@ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 @@ -755,7 +744,7 @@ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 @@ -765,7 +754,7 @@ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 @@ -775,7 +764,7 @@ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 @@ -785,7 +774,7 @@ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 @@ -807,6 +796,10 @@ ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF 1 + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + @@ -817,6 +810,10 @@ ..\ 1 + + ..\ + 1 + @@ -825,7 +822,7 @@ 1 - + 1 @@ -834,7 +831,7 @@ ..\$(PROJECTNAME).launchscreen 64 - + ..\$(PROJECTNAME).launchscreen 64 @@ -846,7 +843,7 @@ 1 - + 1 @@ -917,7 +914,7 @@ 1 - + 1 @@ -977,6 +974,7 @@ + diff --git a/Samples/XRechnungUnit1.dfm b/Samples/XRechnungUnit1.dfm index fb8a865..fe72b46 100644 --- a/Samples/XRechnungUnit1.dfm +++ b/Samples/XRechnungUnit1.dfm @@ -1,8 +1,8 @@ object Form1: TForm1 Left = 0 Top = 0 - Caption = 'XRechnung for Delphi v1.3.3' - ClientHeight = 1185 + Caption = 'XRechnung for Delphi v1.4.0' + ClientHeight = 692 ClientWidth = 1910 Color = clBtnFace Font.Charset = DEFAULT_CHARSET @@ -14,21 +14,14 @@ object Form1: TForm1 OnCreate = FormCreate DesignSize = ( 1910 - 1185) + 692) TextHeight = 13 - object Label1: TLabel - Left = 152 - Top = 8 - Width = 83 - Height = 13 - Caption = 'XRechnung 1.2.2' - end object Label2: TLabel - Left = 152 - Top = 506 + Left = 144 + Top = 10 Width = 83 Height = 13 - Caption = 'XRechnung 2.1.1' + Caption = 'XRechnung 2.2.0' end object Label3: TLabel Left = 8 @@ -37,66 +30,32 @@ object Form1: TForm1 Height = 13 Caption = 'Weitere Beispiele' end - object Memo1: TMemo - Left = 152 - Top = 27 - Width = 649 - Height = 473 - ScrollBars = ssBoth - TabOrder = 0 - end object btCreateInvoice: TButton Left = 8 Top = 264 Width = 129 Height = 25 Caption = 'Erzeugen' - TabOrder = 1 + TabOrder = 0 OnClick = btCreateInvoiceClick end object Memo2: TMemo - Left = 152 - Top = 525 + Left = 144 + Top = 29 Width = 649 Height = 473 + Anchors = [akLeft, akTop, akBottom] ScrollBars = ssBoth - TabOrder = 2 - end - object WebBrowser1: TWebBrowser - Left = 816 - Top = 27 - Width = 1081 - Height = 473 - Anchors = [akLeft, akTop, akRight] - TabOrder = 3 - ControlData = { - 4C000000B96F0000E33000000000000000000000000000000000000000000000 - 000000004C000000000000000000000001000000E0D057007335CF11AE690800 - 2B2E126208000000000000004C0000000114020000000000C000000000000046 - 8000000000000000000000000000000000000000000000000000000000000000 - 00000000000000000100000000000000000000000000000000000000} + TabOrder = 1 end object Memo3: TMemo - Left = 152 - Top = 1004 + Left = 144 + Top = 508 Width = 1745 Height = 169 + Anchors = [akLeft, akRight, akBottom] ScrollBars = ssBoth - TabOrder = 4 - end - object WebBrowser2: TWebBrowser - Left = 816 - Top = 525 - Width = 1081 - Height = 473 - Anchors = [akLeft, akTop, akRight] - TabOrder = 5 - ControlData = { - 4C000000B96F0000E33000000000000000000000000000000000000000000000 - 000000004C000000000000000000000001000000E0D057007335CF11AE690800 - 2B2E126208000000000000004C0000000114020000000000C000000000000046 - 8000000000000000000000000000000000000000000000000000000000000000 - 00000000000000000100000000000000000000000000000000000000} + TabOrder = 2 end object rbPaymentTerms: TRadioGroup Left = 8 @@ -110,7 +69,7 @@ object Form1: TForm1 'Netto' '1 Skonto' '2 Skonto') - TabOrder = 6 + TabOrder = 3 end object cbAllowanceCharges: TCheckBox Left = 8 @@ -118,7 +77,7 @@ object Form1: TForm1 Width = 138 Height = 17 Caption = 'Nachlaesse/Zuschlaege' - TabOrder = 7 + TabOrder = 4 end object Button4: TButton Left = 8 @@ -126,7 +85,7 @@ object Form1: TForm1 Width = 129 Height = 25 Caption = 'Titel / Positionsgruppen' - TabOrder = 8 + TabOrder = 5 OnClick = Button4Click end object cbPrepaidAmount: TCheckBox @@ -135,25 +94,16 @@ object Form1: TForm1 Width = 129 Height = 17 Caption = 'Abschlagsrechnungen' - TabOrder = 9 - end - object btX1ConvertHTML: TButton - Left = 632 - Top = 440 - Width = 137 - Height = 33 - Caption = 'XRechnung nach HTML' - TabOrder = 10 - Visible = False - OnClick = btX1ConvertHTMLClick + TabOrder = 6 end object btX2ConvertHTML: TButton - Left = 632 - Top = 937 + Left = 624 + Top = 441 Width = 137 Height = 33 + Anchors = [akLeft, akBottom] Caption = 'XRechnung nach HTML' - TabOrder = 11 + TabOrder = 7 Visible = False OnClick = btX2ConvertHTMLClick end @@ -163,7 +113,7 @@ object Form1: TForm1 Width = 129 Height = 25 Caption = 'UStG '#167' 13b' - TabOrder = 12 + TabOrder = 8 OnClick = Button1Click end object cbAttachments: TCheckBox @@ -172,7 +122,7 @@ object Form1: TForm1 Width = 97 Height = 17 Caption = 'Mit Anhaengen' - TabOrder = 13 + TabOrder = 9 end object cbDeliveriyInf: TCheckBox Left = 8 @@ -180,7 +130,7 @@ object Form1: TForm1 Width = 97 Height = 17 Caption = 'Lieferanschrift' - TabOrder = 14 + TabOrder = 10 end object rbFormat: TRadioGroup Left = 8 @@ -192,15 +142,37 @@ object Form1: TForm1 Items.Strings = ( 'UBL' 'ZUGFeRD') - TabOrder = 15 + TabOrder = 11 end object Button2: TButton - Left = 8 - Top = 1142 + Left = 9 + Top = 652 Width = 129 Height = 25 Caption = 'Datei laden' - TabOrder = 16 + TabOrder = 12 OnClick = Button2Click end + object Panel1: TPanel + Left = 808 + Top = 29 + Width = 1081 + Height = 473 + Anchors = [akLeft, akTop, akRight, akBottom] + TabOrder = 13 + object WebBrowser2: TWebBrowser + Left = 1 + Top = 1 + Width = 1079 + Height = 471 + Align = alClient + TabOrder = 0 + ControlData = { + 4C000000856F0000AE3000000000000000000000000000000000000000000000 + 000000004C000000000000000000000001000000E0D057007335CF11AE690800 + 2B2E126208000000000000004C0000000114020000000000C000000000000046 + 8000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000100000000000000000000000000000000000000} + end + end end diff --git a/Samples/XRechnungUnit1.pas b/Samples/XRechnungUnit1.pas index 66e9b67..013ecc2 100644 --- a/Samples/XRechnungUnit1.pas +++ b/Samples/XRechnungUnit1.pas @@ -14,12 +14,9 @@ interface type TForm1 = class(TForm) - Memo1: TMemo; btCreateInvoice: TButton; Memo2: TMemo; - WebBrowser1: TWebBrowser; Memo3: TMemo; - Label1: TLabel; Label2: TLabel; WebBrowser2: TWebBrowser; rbPaymentTerms: TRadioGroup; @@ -27,28 +24,25 @@ TForm1 = class(TForm) Button4: TButton; Label3: TLabel; cbPrepaidAmount: TCheckBox; - btX1ConvertHTML: TButton; btX2ConvertHTML: TButton; Button1: TButton; cbAttachments: TCheckBox; cbDeliveriyInf: TCheckBox; rbFormat: TRadioGroup; Button2: TButton; + Panel1: TPanel; procedure btCreateInvoiceClick(Sender: TObject); procedure FormCreate(Sender: TObject); procedure Button4Click(Sender: TObject); - procedure btX1ConvertHTMLClick(Sender: TObject); procedure btX2ConvertHTMLClick(Sender: TObject); procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); private - procedure Generate122(inv : TInvoice); - procedure Generate211(inv : TInvoice); + procedure Generate220(inv : TInvoice); public JavaRuntimeEnvironmentPath : String; ValidatorLibPath : String; - ValidatorConfiguration122Path : String; - ValidatorConfiguration211Path : String; + ValidatorConfiguration220Path : String; VisualizationLibPath : String; end; @@ -69,9 +63,12 @@ procedure TForm1.FormCreate(Sender: TObject); hstr := ExtractFileDir(hstr)+PathDelim+'Distribution'+PathDelim; JavaRuntimeEnvironmentPath := hstr +'java'+PathDelim; ValidatorLibPath := hstr +'validator'+PathDelim; - ValidatorConfiguration122Path := hstr +'validator-configuration-122'+PathDelim; - ValidatorConfiguration211Path := hstr +'validator-configuration-211'+PathDelim; + ValidatorConfiguration220Path := hstr +'validator-configuration-220'+PathDelim; VisualizationLibPath := hstr +'visualization'+PathDelim; + Width := 50; + Top := 50; + Width := Screen.WorkAreaWidth-100; + Height := Screen.WorkAreaHeight-100; end; procedure TForm1.Button1Click(Sender: TObject); @@ -79,12 +76,9 @@ procedure TForm1.Button1Click(Sender: TObject); inv : TInvoice; suc : Boolean; begin - WebBrowser1.Navigate2('about:blank'); WebBrowser2.Navigate2('about:blank'); - Memo1.Clear; Memo2.Clear; Memo3.Clear; - btX1ConvertHTML.Visible := false; btX2ConvertHTML.Visible := false; inv := TInvoice.Create; @@ -166,8 +160,7 @@ procedure TForm1.Button1Click(Sender: TObject); inv.PayableAmount := 200.00; //Summe Zahlbar MwSt try - Generate122(inv); - Generate211(inv); + Generate220(inv); finally inv.Free; end; @@ -199,12 +192,9 @@ procedure TForm1.btCreateInvoiceClick(Sender: TObject); inv : TInvoice; suc : Boolean; begin - WebBrowser1.Navigate2('about:blank'); WebBrowser2.Navigate2('about:blank'); - Memo1.Clear; Memo2.Clear; Memo3.Clear; - btX1ConvertHTML.Visible := false; btX2ConvertHTML.Visible := false; inv := TInvoice.Create; @@ -517,10 +507,7 @@ procedure TForm1.btCreateInvoiceClick(Sender: TObject); //TODO PayableRoundingAmount try - - Generate122(inv); - - Generate211(inv); + Generate220(inv); finally inv.Free; end; @@ -533,12 +520,9 @@ procedure TForm1.Button4Click(Sender: TObject); begin ShowMessage('Die Validierungswarnung scheint derzeit noch normal zu sein.'+#10+'[UBL-CR-646]-A UBL invoice should not include the InvoiceLine SubInvoiceLine'); - WebBrowser1.Navigate2('about:blank'); WebBrowser2.Navigate2('about:blank'); - Memo1.Clear; Memo2.Clear; Memo3.Clear; - btX1ConvertHTML.Visible := false; btX2ConvertHTML.Visible := false; inv := TInvoice.Create; @@ -660,53 +644,13 @@ procedure TForm1.Button4Click(Sender: TObject); inv.PayableAmount := 428.40; //Summe Zahlbar MwSt try - Generate211(inv); + Generate220(inv); finally inv.Free; end; end; -procedure TForm1.Generate122(inv: TInvoice); -var - xml,cmdoutput,xmlresult,htmlresult,error : String; - Doc : Variant; - invtest : TInvoice; -begin - Memo3.Clear; - if rbFormat.itemindex <> 0 then - exit; - - TXRechnungInvoiceAdapter.SaveToXMLStr(inv,XRechnungVersion_122,xml); - - GetXRechnungValidationHelperJava.SetJavaRuntimeEnvironmentPath(JavaRuntimeEnvironmentPath) - .SetValidatorLibPath(ValidatorLibPath) - .SetValidatorConfigurationPath(ValidatorConfiguration122Path) - .Validate(xml,cmdoutput,xmlresult,htmlresult); - - Doc := WebBrowser1.Document; - Doc.Clear; - if htmlresult <> '' then - Doc.Write(htmlresult) - else - Doc.Write('Validation nicht erfolgreich. Siehe Verzeichnis ./Distribution/Read.Me'); - Doc.Close; - - Memo1.Lines.Text := xml; - Memo1.Lines.SaveToFile(ExtractFilePath(Application.ExeName)+'XRechnung-UBL-122.xml',TEncoding.UTF8); - - invtest := TInvoice.Create; - try - TXRechnungInvoiceAdapter.LoadFromXMLStr(invtest,xml,error); - if error <> '' then - MessageDlg('error loading XRechnung'+#10+error, mtError, [mbOK], 0); - finally - invtest.Free; - end; - - btX1ConvertHTML.Visible := true; -end; - -procedure TForm1.Generate211(inv: TInvoice); +procedure TForm1.Generate220(inv: TInvoice); var xml,cmdoutput,xmlresult,htmlresult,error : String; Doc : Variant; @@ -715,11 +659,11 @@ procedure TForm1.Generate211(inv: TInvoice); Memo3.Clear; if rbFormat.itemindex = 0 then begin - TXRechnungInvoiceAdapter.SaveToXMLStr(inv,XRechnungVersion_211_UBL,xml); + TXRechnungInvoiceAdapter.SaveToXMLStr(inv,XRechnungVersion_220_UBL,xml); GetXRechnungValidationHelperJava.SetJavaRuntimeEnvironmentPath(JavaRuntimeEnvironmentPath) .SetValidatorLibPath(ValidatorLibPath) - .SetValidatorConfigurationPath(ValidatorConfiguration211Path) + .SetValidatorConfigurationPath(ValidatorConfiguration220Path) .Validate(xml,cmdoutput,xmlresult,htmlresult); Memo3.Lines.Text := cmdoutput; @@ -733,7 +677,7 @@ procedure TForm1.Generate211(inv: TInvoice); Doc.Close; Memo2.Lines.Text := xml; - Memo2.Lines.SaveToFile(ExtractFilePath(Application.ExeName)+'XRechnung-UBL-211.xml',TEncoding.UTF8); + Memo2.Lines.SaveToFile(ExtractFilePath(Application.ExeName)+'XRechnung-UBL-220.xml',TEncoding.UTF8); invtest := TInvoice.Create; try @@ -748,11 +692,11 @@ procedure TForm1.Generate211(inv: TInvoice); end else begin - TXRechnungInvoiceAdapter.SaveToXMLStr(inv,XRechnungVersion_211_UNCEFACT,xml); + TXRechnungInvoiceAdapter.SaveToXMLStr(inv,XRechnungVersion_220_UNCEFACT,xml); GetXRechnungValidationHelperJava.SetJavaRuntimeEnvironmentPath(JavaRuntimeEnvironmentPath) .SetValidatorLibPath(ValidatorLibPath) - .SetValidatorConfigurationPath(ValidatorConfiguration211Path) + .SetValidatorConfigurationPath(ValidatorConfiguration220Path) .Validate(xml,cmdoutput,xmlresult,htmlresult); Memo3.Lines.Text := cmdoutput; @@ -766,7 +710,7 @@ procedure TForm1.Generate211(inv: TInvoice); Doc.Close; Memo2.Lines.Text := xml; - Memo2.Lines.SaveToFile(ExtractFilePath(Application.ExeName)+'XRechnung-UNCEFACT-211.xml',TEncoding.UTF8); + Memo2.Lines.SaveToFile(ExtractFilePath(Application.ExeName)+'XRechnung-UNCEFACT-220.xml',TEncoding.UTF8); invtest := TInvoice.Create; try @@ -781,29 +725,6 @@ procedure TForm1.Generate211(inv: TInvoice); end; end; -procedure TForm1.btX1ConvertHTMLClick(Sender: TObject); -var - xml,cmdoutput,htmlresult : String; - Doc : Variant; -begin - xml := Memo1.Lines.Text; - - GetXRechnungValidationHelperJava.SetJavaRuntimeEnvironmentPath(JavaRuntimeEnvironmentPath) - .SetValidatorLibPath(ValidatorLibPath) - .SetVisualizationLibPath(VisualizationLibPath) - .Visualize(xml,true,cmdoutput,htmlresult); - - Memo3.Lines.Text := cmdoutput; - - Doc := WebBrowser1.Document; - Doc.Clear; - if htmlresult <> '' then - Doc.Write(htmlresult) - else - Doc.Write('Visualisierung nicht erfolgreich. Siehe Verzeichnis ./Distribution/Read.Me'); - Doc.Close; -end; - procedure TForm1.btX2ConvertHTMLClick(Sender: TObject); var xml,cmdoutput,htmlresult : String; diff --git a/intf.Invoice.pas b/intf.Invoice.pas index 9db3e11..06594c2 100644 --- a/intf.Invoice.pas +++ b/intf.Invoice.pas @@ -1,9 +1,9 @@ { License XRechnung-for-Delphi -Copyright (C) 2021 Landrix Software GmbH & Co. KG +Copyright (C) 2022 Landrix Software GmbH & Co. KG Sven Harazim, info@landrix.de -Version 1.3.2 +Version 1.4.0 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/intf.MSXML2_TLB.pas b/intf.MSXML2_TLB.pas index 96fb8fd..006cddd 100644 --- a/intf.MSXML2_TLB.pas +++ b/intf.MSXML2_TLB.pas @@ -1,7 +1,7 @@ { -Copyright (C) 2021 Landrix Software GmbH & Co. KG +Copyright (C) 2022 Landrix Software GmbH & Co. KG Sven Harazim, info@landrix.de -Version 1.3.2 +Version 1.4.0 License This file is not official part of the package XRechnung-for-Delphi. diff --git a/intf.XRechnung.pas b/intf.XRechnung.pas index c21476b..c3ccd7f 100644 --- a/intf.XRechnung.pas +++ b/intf.XRechnung.pas @@ -1,9 +1,9 @@ { License XRechnung-for-Delphi -Copyright (C) 2021 Landrix Software GmbH & Co. KG +Copyright (C) 2022 Landrix Software GmbH & Co. KG Sven Harazim, info@landrix.de -Version 1.3.2 +Version 1.4.0 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -74,9 +74,8 @@ TXRechnungHelper = class(TObject) end; TXRechnungVersion = (XRechnungVersion_Unknown, - XRechnungVersion_122, - XRechnungVersion_211_UBL, - XRechnungVersion_211_UNCEFACT, + XRechnungVersion_220_UBL, + XRechnungVersion_220_UNCEFACT, XRechnungVersion_ReadingSupport_ZUGFeRDFacturX_2xx); TXRechnungValidationHelper = class(TObject) @@ -969,9 +968,8 @@ class function TXRechnungInvoiceAdapter.LoadFromFile(_Invoice: TInvoice; try xml.LoadFromFile(_Filename); case TXRechnungValidationHelper.GetXRechnungVersion(xml) of - XRechnungVersion_122 : Result := LoadDocumentUBL(_Invoice,XRechnungVersion_122,xml,_Error); - XRechnungVersion_211_UBL : Result := LoadDocumentUBL(_Invoice,XRechnungVersion_211_UBL,xml,_Error); - XRechnungVersion_211_UNCEFACT, + XRechnungVersion_220_UBL : Result := LoadDocumentUBL(_Invoice,XRechnungVersion_220_UBL,xml,_Error); + XRechnungVersion_220_UNCEFACT, XRechnungVersion_ReadingSupport_ZUGFeRDFacturX_2xx : Result := LoadDocumentUNCEFACT(_Invoice,xml,_Error); else exit; end; @@ -995,9 +993,8 @@ class function TXRechnungInvoiceAdapter.LoadFromStream(_Invoice: TInvoice; try xml.LoadFromStream(_Stream); case TXRechnungValidationHelper.GetXRechnungVersion(xml) of - XRechnungVersion_122 : Result := LoadDocumentUBL(_Invoice,XRechnungVersion_122,xml,_Error); - XRechnungVersion_211_UBL : Result := LoadDocumentUBL(_Invoice,XRechnungVersion_211_UBL,xml,_Error); - XRechnungVersion_211_UNCEFACT, + XRechnungVersion_220_UBL : Result := LoadDocumentUBL(_Invoice,XRechnungVersion_220_UBL,xml,_Error); + XRechnungVersion_220_UNCEFACT, XRechnungVersion_ReadingSupport_ZUGFeRDFacturX_2xx : Result := LoadDocumentUNCEFACT(_Invoice,xml,_Error); else exit; end; @@ -1021,9 +1018,8 @@ class function TXRechnungInvoiceAdapter.LoadFromXMLStr(_Invoice: TInvoice; try xml.LoadFromXML(_XML); case TXRechnungValidationHelper.GetXRechnungVersion(xml) of - XRechnungVersion_122 : Result := LoadDocumentUBL(_Invoice,XRechnungVersion_122,xml,_Error); - XRechnungVersion_211_UBL : Result := LoadDocumentUBL(_Invoice,XRechnungVersion_211_UBL,xml,_Error); - XRechnungVersion_211_UNCEFACT, + XRechnungVersion_220_UBL : Result := LoadDocumentUBL(_Invoice,XRechnungVersion_220_UBL,xml,_Error); + XRechnungVersion_220_UNCEFACT, XRechnungVersion_ReadingSupport_ZUGFeRDFacturX_2xx : Result := LoadDocumentUNCEFACT(_Invoice,xml,_Error); else exit; end; @@ -1036,9 +1032,8 @@ class procedure TXRechnungInvoiceAdapter.SaveDocument(_Invoice: TInvoice; _Version : TXRechnungVersion; _Xml: IXMLDocument); begin case _Version of - XRechnungVersion_122, - XRechnungVersion_211_UBL : SaveDocumentUBL(_Invoice,_Version,_Xml); - XRechnungVersion_211_UNCEFACT : SaveDocumentUNCEFACT(_Invoice,_Xml); + XRechnungVersion_220_UBL : SaveDocumentUBL(_Invoice,_Version,_Xml); + XRechnungVersion_220_UNCEFACT : SaveDocumentUNCEFACT(_Invoice,_Xml); else raise Exception.Create('XRechnung - wrong version'); end; end; @@ -1145,7 +1140,7 @@ class procedure TXRechnungInvoiceAdapter.SaveDocumentUBL(_Invoice: TInvoice; Text := IntToStr(_Invoiceline.BaseQuantity); end; end; - if _Version = XRechnungVersion_211_UBL then + //if _Version = XRechnungVersion_220_UBL then for subinvoiceline in _Invoiceline.SubInvoiceLines do InternalAddInvoiceLine(subinvoiceline,_Node.AddChild('cac:SubInvoiceLine')); end; @@ -1168,16 +1163,8 @@ class procedure TXRechnungInvoiceAdapter.SaveDocumentUBL(_Invoice: TInvoice; xRoot.DeclareNamespace('cac','urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2'); xRoot.DeclareNamespace('cbc','urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2'); - if _Version = XRechnungVersion_122 then - begin - xRoot.DeclareNamespace('xsi','http://www.w3.org/2001/XMLSchema-instance'); - xRoot.Attributes['xsi:schemaLocation'] := 'urn:oasis:names:specification:ubl:schema:xsd:Invoice-2 http://docs.oasis-open.org/ubl/os-UBL-2.1/xsd/maindoc/UBL-Invoice-2.1.xsd'; - xRoot.AddChild('cbc:CustomizationID').Text := 'urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_1.2'; - end else - begin - xRoot.AddChild('cbc:CustomizationID').Text := 'urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_2.1'+ - IfThen(InternalExtensionEnabled,'#conformant#urn:xoev-de:kosit:extension:xrechnung_2.1',''); - end; + xRoot.AddChild('cbc:CustomizationID').Text := 'urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_2.2'+ + IfThen(InternalExtensionEnabled,'#conformant#urn:xoev-de:kosit:extension:xrechnung_2.2',''); xRoot.AddChild('cbc:ID').Text := _Invoice.InvoiceNumber; xRoot.AddChild('cbc:IssueDate').Text := TXRechnungHelper.DateToStrUBLFormat(_Invoice.InvoiceIssueDate); @@ -1207,10 +1194,6 @@ class procedure TXRechnungInvoiceAdapter.SaveDocumentUBL(_Invoice: TInvoice; for i := 0 to _Invoice.Attachments.Count -1 do begin - if _Invoice.Attachments[i].AttachmentType = TInvoiceAttachmentType.iat_application_xml then - if _Version = XRechnungVersion_122 then - continue; //xml attachment not allowed in v1.2.2'); - with xRoot.AddChild('cac:AdditionalDocumentReference') do begin AddChild('cbc:ID').Text := _Invoice.Attachments[i].ID; @@ -1381,7 +1364,7 @@ class procedure TXRechnungInvoiceAdapter.SaveDocumentUBL(_Invoice: TInvoice; TXRechnungHelper.FloatToStr(_Invoice.PaymentTermCashDiscount1Percent)])+ IfThen(_Invoice.PaymentTermCashDiscount1Base <> 0,'BASISBETRAG='+ TXRechnungHelper.AmountToStr(_Invoice.PaymentTermCashDiscount1Base)+'#','')+ - IfThen(_Version = XRechnungVersion_211_UBL,#13#10,''); + IfThen(_Version = XRechnungVersion_220_UBL,#13#10,''); end; iptt_CashDiscount2: begin @@ -1398,7 +1381,7 @@ class procedure TXRechnungInvoiceAdapter.SaveDocumentUBL(_Invoice: TInvoice; TXRechnungHelper.FloatToStr(_Invoice.PaymentTermCashDiscount2Percent)])+ IfThen(_Invoice.PaymentTermCashDiscount2Base <> 0,'BASISBETRAG='+ TXRechnungHelper.AmountToStr(_Invoice.PaymentTermCashDiscount2Base)+'#','')+ - IfThen(_Version = XRechnungVersion_211_UBL,#13#10,''); + IfThen(_Version = XRechnungVersion_220_UBL,#13#10,''); end; end; end; @@ -1607,7 +1590,7 @@ class procedure TXRechnungInvoiceAdapter.SaveDocumentUNCEFACT(_Invoice: TInvoice xRoot.AddChild('rsm:ExchangedDocumentContext') .AddChild('ram:GuidelineSpecifiedDocumentContextParameter') - .AddChild('ram:ID').Text := 'urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_2.1'; + .AddChild('ram:ID').Text := 'urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_2.2'; with xRoot.AddChild('rsm:ExchangedDocument') do begin @@ -2550,11 +2533,8 @@ class function TXRechnungValidationHelper.GetXRechnungVersion( begin if not TXRechnungXMLHelper.FindChild(_XML.DocumentElement,'cbc:CustomizationID',node) then exit; - if node.Text.EndsWith('xrechnung_2.1',true) then - Result := XRechnungVersion_211_UBL - else - if node.Text.EndsWith('xrechnung_1.2',true) then - Result := XRechnungVersion_122; + if node.Text.EndsWith('xrechnung_2.2',true) then + Result := XRechnungVersion_220_UBL; end else if (SameText(_XML.DocumentElement.NodeName,'CrossIndustryInvoice') or SameText(_XML.DocumentElement.NodeName,'rsm:CrossIndustryInvoice')) then begin @@ -2564,8 +2544,8 @@ class function TXRechnungValidationHelper.GetXRechnungVersion( exit; if not TXRechnungXMLHelper.FindChild(node2,'ram:ID',node) then exit; - if node.Text.EndsWith('xrechnung_2.1',true) then - Result := XRechnungVersion_211_UNCEFACT + if node.Text.EndsWith('xrechnung_2.2',true) then + Result := XRechnungVersion_220_UNCEFACT else if node.Text.StartsWith('urn:cen.eu:en16931:2017',true) then Result := XRechnungVersion_ReadingSupport_ZUGFeRDFacturX_2xx; diff --git a/intf.XRechnungValidationHelperJava.pas b/intf.XRechnungValidationHelperJava.pas index fa805d1..182c44f 100644 --- a/intf.XRechnungValidationHelperJava.pas +++ b/intf.XRechnungValidationHelperJava.pas @@ -1,7 +1,7 @@ { -Copyright (C) 2021 Landrix Software GmbH & Co. KG +Copyright (C) 2022 Landrix Software GmbH & Co. KG Sven Harazim, info@landrix.de -Version 1.3.2 +Version 1.4.0 License This file is not official part of the package XRechnung-for-Delphi.