diff --git a/ZUGFeRD-Test/ZUGFeRD21Tests.cs b/ZUGFeRD-Test/ZUGFeRD21Tests.cs index 509cd63..b837aa5 100644 --- a/ZUGFeRD-Test/ZUGFeRD21Tests.cs +++ b/ZUGFeRD-Test/ZUGFeRD21Tests.cs @@ -137,17 +137,17 @@ public void TestReferenceMinimumInvoice() [TestMethod] - public void TestReferenceXRechnungCII() + public void TestReferenceXRechnung1CII() { string path = @"..\..\..\demodata\xRechnung\xRechnung CII.xml"; InvoiceDescriptor desc = InvoiceDescriptor.Load(path); - Assert.AreEqual(desc.Profile, Profile.XRechnung); + Assert.AreEqual(desc.Profile, Profile.XRechnung1); Assert.AreEqual(desc.Type, InvoiceType.Invoice); Assert.AreEqual(desc.InvoiceNo, "0815-99-1-a"); Assert.AreEqual(desc.TradeLineItems.Count, 2); Assert.AreEqual(desc.LineTotalAmount, 1445.98m); - } // !TestReferenceXRechnungCII() + } // !TestReferenceXRechnung1CII() [TestMethod] @@ -181,6 +181,38 @@ public void TestInvoiceWithAttachment() break; } } - } + } // !TestInvoiceWithAttachment() + + + [TestMethod] + public void TestXRechnung1() + { + InvoiceDescriptor desc = this.InvoiceProvider.CreateInvoice(); + + MemoryStream ms = new MemoryStream(); + + desc.Save(ms, ZUGFeRDVersion.Version21, Profile.XRechnung1); + ms.Seek(0, SeekOrigin.Begin); + Assert.AreEqual(desc.Profile, Profile.XRechnung1); + + InvoiceDescriptor loadedInvoice = InvoiceDescriptor.Load(ms); + Assert.AreEqual(loadedInvoice.Profile, Profile.XRechnung1); + } // !TestXRechnung1() + + + [TestMethod] + public void TestXRechnung2() + { + InvoiceDescriptor desc = this.InvoiceProvider.CreateInvoice(); + + MemoryStream ms = new MemoryStream(); + + desc.Save(ms, ZUGFeRDVersion.Version21, Profile.XRechnung); + ms.Seek(0, SeekOrigin.Begin); + Assert.AreEqual(desc.Profile, Profile.XRechnung); + + InvoiceDescriptor loadedInvoice = InvoiceDescriptor.Load(ms); + Assert.AreEqual(loadedInvoice.Profile, Profile.XRechnung); + } // !TestXRechnung2() } } diff --git a/ZUGFeRD/InvoiceDescriptor1Writer.cs b/ZUGFeRD/InvoiceDescriptor1Writer.cs index f0aee67..f2ab399 100644 --- a/ZUGFeRD/InvoiceDescriptor1Writer.cs +++ b/ZUGFeRD/InvoiceDescriptor1Writer.cs @@ -589,7 +589,7 @@ public override void Save(InvoiceDescriptor descriptor, Stream stream) if (Descriptor.BillingPeriodStart.HasValue && Descriptor.BillingPeriodEnd.HasValue) { - Writer.WriteStartElement("ram:BillingSpecifiedPeriod", Profile.BasicWL | Profile.Basic | Profile.Comfort | Profile.Extended | Profile.XRechnung); + Writer.WriteStartElement("ram:BillingSpecifiedPeriod", Profile.BasicWL | Profile.Basic | Profile.Comfort | Profile.Extended | Profile.XRechnung1 | Profile.XRechnung); Writer.WriteStartElement("ram:StartDateTime"); _writeElementWithAttribute(Writer, "udt:DateTimeString", "format", "102", _formatDate(this.Descriptor.BillingPeriodStart.Value)); diff --git a/ZUGFeRD/InvoiceDescriptor20Writer.cs b/ZUGFeRD/InvoiceDescriptor20Writer.cs index dc04164..c2966b6 100644 --- a/ZUGFeRD/InvoiceDescriptor20Writer.cs +++ b/ZUGFeRD/InvoiceDescriptor20Writer.cs @@ -294,7 +294,7 @@ public override void Save(InvoiceDescriptor descriptor, Stream stream) if (Descriptor.BillingPeriodStart.HasValue || Descriptor.BillingPeriodEnd.HasValue) { - Writer.WriteStartElement("ram:BillingSpecifiedPeriod", Profile.BasicWL | Profile.Basic | Profile.Comfort | Profile.Extended | Profile.XRechnung); + Writer.WriteStartElement("ram:BillingSpecifiedPeriod", Profile.BasicWL | Profile.Basic | Profile.Comfort | Profile.Extended | Profile.XRechnung1 | Profile.XRechnung); if (Descriptor.BillingPeriodStart.HasValue) { Writer.WriteStartElement("ram:StartDateTime"); diff --git a/ZUGFeRD/InvoiceDescriptor21Writer.cs b/ZUGFeRD/InvoiceDescriptor21Writer.cs index 9f2a532..d1f95c5 100644 --- a/ZUGFeRD/InvoiceDescriptor21Writer.cs +++ b/ZUGFeRD/InvoiceDescriptor21Writer.cs @@ -33,7 +33,7 @@ internal class InvoiceDescriptor21Writer : IInvoiceDescriptorWriter private InvoiceDescriptor Descriptor; - private readonly Profile ALL_PROFILES = Profile.Minimum | Profile.BasicWL | Profile.Basic | Profile.Comfort | Profile.Extended | Profile.XRechnung; + private readonly Profile ALL_PROFILES = Profile.Minimum | Profile.BasicWL | Profile.Basic | Profile.Comfort | Profile.Extended | Profile.XRechnung1 | Profile.XRechnung; /// @@ -120,7 +120,7 @@ public override void Save(InvoiceDescriptor descriptor, Stream stream) //Gruppierung von allgemeinen Positionsangaben if (tradeLineItem.AssociatedDocument != null) { - Writer.WriteStartElement("ram:AssociatedDocumentLineDocument", Profile.Basic | Profile.Comfort | Profile.Extended | Profile.XRechnung); + Writer.WriteStartElement("ram:AssociatedDocumentLineDocument", Profile.Basic | Profile.Comfort | Profile.Extended | Profile.XRechnung1 | Profile.XRechnung); if (!String.IsNullOrEmpty(tradeLineItem.AssociatedDocument.LineID)) { Writer.WriteElementString("ram:LineID", tradeLineItem.AssociatedDocument.LineID); @@ -139,17 +139,17 @@ public override void Save(InvoiceDescriptor descriptor, Stream stream) #region SpecifiedTradeProduct //Eine Gruppe von betriebswirtschaftlichen Begriffen, die Informationen über die in Rechnung gestellten Waren und Dienstleistungen enthält - Writer.WriteStartElement("ram:SpecifiedTradeProduct", Profile.Basic | Profile.Comfort | Profile.Extended | Profile.XRechnung); + Writer.WriteStartElement("ram:SpecifiedTradeProduct", Profile.Basic | Profile.Comfort | Profile.Extended | Profile.XRechnung1 | Profile.XRechnung); if ((tradeLineItem.GlobalID != null) && !String.IsNullOrEmpty(tradeLineItem.GlobalID.SchemeID) && !String.IsNullOrEmpty(tradeLineItem.GlobalID.ID)) { _writeElementWithAttribute(Writer, "ram:GlobalID", "schemeID", tradeLineItem.GlobalID.SchemeID, tradeLineItem.GlobalID.ID, Profile.Basic | Profile.Comfort | Profile.Extended); } - _writeOptionalElementString(Writer, "ram:SellerAssignedID", tradeLineItem.SellerAssignedID, Profile.Comfort | Profile.Extended | Profile.XRechnung); - _writeOptionalElementString(Writer, "ram:BuyerAssignedID", tradeLineItem.BuyerAssignedID, Profile.Comfort | Profile.Extended | Profile.XRechnung); + _writeOptionalElementString(Writer, "ram:SellerAssignedID", tradeLineItem.SellerAssignedID, Profile.Comfort | Profile.Extended | Profile.XRechnung1 | Profile.XRechnung); + _writeOptionalElementString(Writer, "ram:BuyerAssignedID", tradeLineItem.BuyerAssignedID, Profile.Comfort | Profile.Extended | Profile.XRechnung1 | Profile.XRechnung); _writeOptionalElementString(Writer, "ram:Name", tradeLineItem.Name, Profile.Basic | Profile.Comfort | Profile.Extended); - _writeOptionalElementString(Writer, "ram:Name", !isCommentItem ? tradeLineItem.Name : "TEXT", Profile.XRechnung); // XRechnung erfordert einen Item-Namen - _writeOptionalElementString(Writer, "ram:Description", tradeLineItem.Description, Profile.Comfort | Profile.Extended | Profile.XRechnung); + _writeOptionalElementString(Writer, "ram:Name", !isCommentItem ? tradeLineItem.Name : "TEXT", Profile.XRechnung1 | Profile.XRechnung); // XRechnung erfordert einen Item-Namen + _writeOptionalElementString(Writer, "ram:Description", tradeLineItem.Description, Profile.Comfort | Profile.Extended | Profile.XRechnung1 | Profile.XRechnung); Writer.WriteEndElement(); // !ram:SpecifiedTradeProduct(Basic|Comfort|Extended|XRechnung) #endregion @@ -157,15 +157,15 @@ public override void Save(InvoiceDescriptor descriptor, Stream stream) #region SpecifiedLineTradeAgreement (Basic, Comfort, Extended, XRechnung) //Eine Gruppe von betriebswirtschaftlichen Begriffen, die Informationen über den Preis für die in der betreffenden Rechnungsposition in Rechnung gestellten Waren und Dienstleistungen enthält - if (new Profile[] { Profile.Basic, Profile.Comfort, Profile.Extended, Profile.XRechnung }.Contains(descriptor.Profile)) + if (new Profile[] { Profile.Basic, Profile.Comfort, Profile.Extended, Profile.XRechnung, Profile.XRechnung1 }.Contains(descriptor.Profile)) { - Writer.WriteStartElement("ram:SpecifiedLineTradeAgreement", Profile.Basic | Profile.Comfort | Profile.Extended | Profile.XRechnung); + Writer.WriteStartElement("ram:SpecifiedLineTradeAgreement", Profile.Basic | Profile.Comfort | Profile.Extended | Profile.XRechnung1 | Profile.XRechnung); #region BuyerOrderReferencedDocument (Comfort, Extended, XRechnung) //Detailangaben zur zugehörigen Bestellung if (tradeLineItem.BuyerOrderReferencedDocument != null) { - Writer.WriteStartElement("ram:BuyerOrderReferencedDocument", Profile.Comfort | Profile.Extended | Profile.XRechnung); + Writer.WriteStartElement("ram:BuyerOrderReferencedDocument", Profile.Comfort | Profile.Extended | Profile.XRechnung1 | Profile.XRechnung); #region IssuerAssignedID //Bestellnummer @@ -252,7 +252,7 @@ public override void Save(InvoiceDescriptor descriptor, Stream stream) #endregion #region GrossPriceProductTradePrice (Comfort, Extended, XRechnung) - Writer.WriteStartElement("ram:GrossPriceProductTradePrice", Profile.Comfort | Profile.Extended | Profile.XRechnung); + Writer.WriteStartElement("ram:GrossPriceProductTradePrice", Profile.Comfort | Profile.Extended | Profile.XRechnung1 | Profile.XRechnung); _writeOptionalAmount(Writer, "ram:ChargeAmount", tradeLineItem.GrossUnitPrice, 2); if (tradeLineItem.UnitQuantity.HasValue) { @@ -271,7 +271,7 @@ public override void Save(InvoiceDescriptor descriptor, Stream stream) #endregion #region BasisAmount - Writer.WriteStartElement("ram:BasisAmount", profile: Profile.Extended | Profile.XRechnung); + Writer.WriteStartElement("ram:BasisAmount", profile: Profile.Extended | Profile.XRechnung1 | Profile.XRechnung); Writer.WriteValue(_formatDecimal(tradeAllowanceCharge.BasisAmount, 2)); Writer.WriteEndElement(); #endregion @@ -282,7 +282,7 @@ public override void Save(InvoiceDescriptor descriptor, Stream stream) Writer.WriteEndElement(); #endregion - _writeOptionalElementString(Writer, "ram:Reason", tradeAllowanceCharge.Reason, Profile.Extended | Profile.XRechnung); + _writeOptionalElementString(Writer, "ram:Reason", tradeAllowanceCharge.Reason, Profile.Extended | Profile.XRechnung1 | Profile.XRechnung); Writer.WriteEndElement(); // !AppliedTradeAllowanceCharge } @@ -293,7 +293,7 @@ public override void Save(InvoiceDescriptor descriptor, Stream stream) #region NetPriceProductTradePrice //Im Nettopreis sind alle Zu- und Abschläge enthalten, jedoch nicht die Umsatzsteuer. - Writer.WriteStartElement("ram:NetPriceProductTradePrice", Profile.Basic | Profile.Comfort | Profile.Extended | Profile.XRechnung); + Writer.WriteStartElement("ram:NetPriceProductTradePrice", Profile.Basic | Profile.Comfort | Profile.Extended | Profile.XRechnung1 | Profile.XRechnung); _writeOptionalAmount(Writer, "ram:ChargeAmount", tradeLineItem.NetUnitPrice, 2); if (tradeLineItem.UnitQuantity.HasValue) @@ -311,12 +311,12 @@ public override void Save(InvoiceDescriptor descriptor, Stream stream) #endregion #region SpecifiedLineTradeDelivery (Basic, Comfort, Extended) - Writer.WriteStartElement("ram:SpecifiedLineTradeDelivery", Profile.Basic | Profile.Comfort | Profile.Extended | Profile.XRechnung); + Writer.WriteStartElement("ram:SpecifiedLineTradeDelivery", Profile.Basic | Profile.Comfort | Profile.Extended | Profile.XRechnung1 | Profile.XRechnung); _writeElementWithAttribute(Writer, "ram:BilledQuantity", "unitCode", tradeLineItem.UnitCode.EnumToString(), _formatDecimal(tradeLineItem.BilledQuantity, 2)); if (tradeLineItem.DeliveryNoteReferencedDocument != null) { - Writer.WriteStartElement("ram:DeliveryNoteReferencedDocument", ALL_PROFILES ^ Profile.XRechnung); + Writer.WriteStartElement("ram:DeliveryNoteReferencedDocument", ALL_PROFILES ^ (Profile.XRechnung1 | Profile.XRechnung)); if (!String.IsNullOrEmpty(tradeLineItem.DeliveryNoteReferencedDocument.ID)) { Writer.WriteElementString("ram:IssuerAssignedID", tradeLineItem.DeliveryNoteReferencedDocument.ID); @@ -353,7 +353,7 @@ public override void Save(InvoiceDescriptor descriptor, Stream stream) #region SpecifiedLineTradeSettlement Writer.WriteStartElement("ram:SpecifiedLineTradeSettlement"); //ToDo: Prüfen #region ApplicableTradeTax - Writer.WriteStartElement("ram:ApplicableTradeTax", Profile.Basic | Profile.Comfort | Profile.Extended | Profile.XRechnung); + Writer.WriteStartElement("ram:ApplicableTradeTax", Profile.Basic | Profile.Comfort | Profile.Extended | Profile.XRechnung1 | Profile.XRechnung); Writer.WriteElementString("ram:TypeCode", tradeLineItem.TaxType.EnumToString()); if (!String.IsNullOrEmpty(_translateTaxCategoryCode(tradeLineItem.TaxCategoryCode))) { @@ -394,7 +394,7 @@ public override void Save(InvoiceDescriptor descriptor, Stream stream) _total = tradeLineItem.NetUnitPrice * tradeLineItem.BilledQuantity; } - Writer.WriteStartElement("ram:LineTotalAmount", Profile.Basic | Profile.Comfort | Profile.Extended | Profile.XRechnung); + Writer.WriteStartElement("ram:LineTotalAmount", Profile.Basic | Profile.Comfort | Profile.Extended | Profile.XRechnung1 | Profile.XRechnung); Writer.WriteValue(_formatDecimal(_total)); Writer.WriteEndElement(); // !ram:LineTotalAmount @@ -442,7 +442,7 @@ public override void Save(InvoiceDescriptor descriptor, Stream stream) Writer.WriteElementString("ram:IssuerAssignedID", this.Descriptor.OrderNo); if (this.Descriptor.OrderDate.HasValue) { - Writer.WriteStartElement("ram:FormattedIssueDateTime", ALL_PROFILES ^ Profile.XRechnung); + Writer.WriteStartElement("ram:FormattedIssueDateTime", ALL_PROFILES ^ (Profile.XRechnung1 | Profile.XRechnung)); Writer.WriteStartElement("qdt:DateTimeString"); Writer.WriteAttributeString("format", "102"); Writer.WriteValue(_formatDate(this.Descriptor.OrderDate.Value)); @@ -461,7 +461,7 @@ public override void Save(InvoiceDescriptor descriptor, Stream stream) Writer.WriteElementString("ram:IssuerAssignedID", this.Descriptor.ContractReferencedDocument.ID); if (this.Descriptor.ContractReferencedDocument.IssueDateTime.HasValue) { - Writer.WriteStartElement("ram:FormattedIssueDateTime", ALL_PROFILES ^ Profile.XRechnung); + Writer.WriteStartElement("ram:FormattedIssueDateTime", ALL_PROFILES ^ (Profile.XRechnung1 | Profile.XRechnung)); Writer.WriteStartElement("qdt:DateTimeString"); Writer.WriteAttributeString("format", "102"); Writer.WriteValue(_formatDate(this.Descriptor.ContractReferencedDocument.IssueDateTime.Value)); @@ -518,9 +518,9 @@ public override void Save(InvoiceDescriptor descriptor, Stream stream) if (Descriptor.SpecifiedProcuringProject != null) { - Writer.WriteStartElement("ram:SpecifiedProcuringProject", Profile.Comfort | Profile.Extended | Profile.XRechnung); - Writer.WriteElementString("ram:ID", Descriptor.SpecifiedProcuringProject.ID, Profile.Comfort | Profile.Extended | Profile.XRechnung); - Writer.WriteElementString("ram:Name", Descriptor.SpecifiedProcuringProject.Name, Profile.Comfort | Profile.Extended | Profile.XRechnung); + Writer.WriteStartElement("ram:SpecifiedProcuringProject", Profile.Comfort | Profile.Extended | Profile.XRechnung1 | Profile.XRechnung); + Writer.WriteElementString("ram:ID", Descriptor.SpecifiedProcuringProject.ID, Profile.Comfort | Profile.Extended | Profile.XRechnung1 | Profile.XRechnung); + Writer.WriteElementString("ram:Name", Descriptor.SpecifiedProcuringProject.Name, Profile.Comfort | Profile.Extended | Profile.XRechnung1 | Profile.XRechnung); Writer.WriteEndElement(); // !ram:SpecifiedProcuringProject } #endregion @@ -556,7 +556,7 @@ public override void Save(InvoiceDescriptor descriptor, Stream stream) if (this.Descriptor.DeliveryNoteReferencedDocument.IssueDateTime.HasValue) { - Writer.WriteStartElement("ram:FormattedIssueDateTime", ALL_PROFILES ^ Profile.XRechnung); + Writer.WriteStartElement("ram:FormattedIssueDateTime", ALL_PROFILES ^ (Profile.XRechnung1 | Profile.XRechnung)); Writer.WriteStartElement("qdt:DateTimeString"); Writer.WriteAttributeString("format", "102"); Writer.WriteValue(_formatDate(this.Descriptor.DeliveryNoteReferencedDocument.IssueDateTime.Value)); @@ -597,7 +597,7 @@ public override void Save(InvoiceDescriptor descriptor, Stream stream) if ((this.Descriptor.PaymentMeans != null) && (this.Descriptor.PaymentMeans.TypeCode != PaymentMeansTypeCodes.Unknown)) { - Writer.WriteStartElement("ram:SpecifiedTradeSettlementPaymentMeans", Profile.BasicWL | Profile.Basic | Profile.Comfort | Profile.Extended | Profile.XRechnung); + Writer.WriteStartElement("ram:SpecifiedTradeSettlementPaymentMeans", Profile.BasicWL | Profile.Basic | Profile.Comfort | Profile.Extended | Profile.XRechnung1 | Profile.XRechnung); Writer.WriteElementString("ram:TypeCode", this.Descriptor.PaymentMeans.TypeCode.EnumToString()); Writer.WriteElementString("ram:Information", this.Descriptor.PaymentMeans.Information); @@ -697,7 +697,7 @@ public override void Save(InvoiceDescriptor descriptor, Stream stream) #region BillingSpecifiedPeriod if (Descriptor.BillingPeriodStart.HasValue || Descriptor.BillingPeriodEnd.HasValue) { - Writer.WriteStartElement("ram:BillingSpecifiedPeriod", Profile.BasicWL | Profile.Basic | Profile.Comfort | Profile.Extended | Profile.XRechnung); + Writer.WriteStartElement("ram:BillingSpecifiedPeriod", Profile.BasicWL | Profile.Basic | Profile.Comfort | Profile.Extended | Profile.XRechnung1 | Profile.XRechnung); if (Descriptor.BillingPeriodStart.HasValue) { Writer.WriteStartElement("ram:StartDateTime"); @@ -724,7 +724,7 @@ public override void Save(InvoiceDescriptor descriptor, Stream stream) Writer.WriteElementString("udt:Indicator", tradeAllowanceCharge.ChargeIndicator ? "true" : "false"); Writer.WriteEndElement(); // !ram:ChargeIndicator - Writer.WriteStartElement("ram:BasisAmount", profile: Profile.Comfort | Profile.Extended | Profile.XRechnung); + Writer.WriteStartElement("ram:BasisAmount", profile: Profile.Comfort | Profile.Extended | Profile.XRechnung1 | Profile.XRechnung); Writer.WriteValue(_formatDecimal(tradeAllowanceCharge.BasisAmount)); Writer.WriteEndElement(); @@ -752,7 +752,7 @@ public override void Save(InvoiceDescriptor descriptor, Stream stream) { foreach (ServiceCharge serviceCharge in this.Descriptor.ServiceCharges) { - Writer.WriteStartElement("ram:SpecifiedLogisticsServiceCharge", ALL_PROFILES ^ Profile.XRechnung); + Writer.WriteStartElement("ram:SpecifiedLogisticsServiceCharge", ALL_PROFILES ^ (Profile.XRechnung1 | Profile.XRechnung)); if (!String.IsNullOrEmpty(serviceCharge.Description)) { Writer.WriteElementString("ram:Description", serviceCharge.Description); @@ -837,7 +837,7 @@ internal override bool Validate(InvoiceDescriptor descriptor, bool throwExceptio return false; } - if (descriptor.Profile == Profile.XRechnung) + if ((descriptor.Profile == Profile.XRechnung) || (descriptor.Profile == Profile.XRechnung1)) { if (descriptor.Seller != null) { @@ -987,11 +987,11 @@ private void _writeOptionalParty(ProfileAwareXmlTextWriter writer, string partyT if (contact != null) { - _writeOptionalContact(writer, "ram:DefinedTradeContact", contact, Profile.Extended | Profile.XRechnung); + _writeOptionalContact(writer, "ram:DefinedTradeContact", contact, Profile.Extended | Profile.XRechnung1 | Profile.XRechnung); } - else if ((profile & Profile.XRechnung) == Profile.XRechnung) + else if ( ((profile & Profile.XRechnung) == Profile.XRechnung) || ((profile & Profile.XRechnung1) == Profile.XRechnung1) ) { - _writeOptionalContact(writer, "ram:DefinedTradeContact", new Contact(), Profile.XRechnung); + _writeOptionalContact(writer, "ram:DefinedTradeContact", new Contact(), Profile.XRechnung1 | Profile.XRechnung); } writer.WriteStartElement("ram:PostalTradeAddress"); @@ -1048,7 +1048,7 @@ private void _writeOptionalContact(ProfileAwareXmlTextWriter writer, string cont if (!String.IsNullOrEmpty(contact.FaxNo)) { - writer.WriteStartElement("ram:FaxUniversalCommunication", ALL_PROFILES ^ Profile.XRechnung); + writer.WriteStartElement("ram:FaxUniversalCommunication", ALL_PROFILES ^ (Profile.XRechnung1 | Profile.XRechnung)); writer.WriteElementString("ram:CompleteNumber", contact.FaxNo); writer.WriteEndElement(); } diff --git a/ZUGFeRD/Profile.cs b/ZUGFeRD/Profile.cs index 14469aa..8e1c2cf 100644 --- a/ZUGFeRD/Profile.cs +++ b/ZUGFeRD/Profile.cs @@ -67,7 +67,13 @@ public enum Profile /// /// Invoice format based on EU Directive 2014/55/EU, adopted to Germany in E-Invoice Law of April 4, 2017 (BGBl. I p. 770) /// - XRechnung = 32 + XRechnung = 32, + + /// + /// Invoice format based on EU Directive 2014/55/EU, adopted to Germany in E-Invoice Law of April 4, 2017 (BGBl. I p. 770). + /// Important note: using this profile will generate a version 1 XRechnung (as valid until 31/12/2020) + /// + XRechnung1 = 64 } @@ -101,7 +107,7 @@ public static Profile FromString(this Profile _, string s) case "urn:factur-x.eu:1p0:basicwl": return Profile.BasicWL; case "urn:cen.eu:en16931:2017": return Profile.Comfort; case "urn:cen.eu:en16931:2017#conformant#urn:factur-x.eu:1p0:extended": return Profile.Extended; - case "urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_1.2": return Profile.XRechnung; + case "urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_1.2": return Profile.XRechnung1; case "urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_2.0": return Profile.XRechnung; } @@ -139,6 +145,7 @@ public static string EnumToString(this Profile profile, ZUGFeRDVersion version) case Profile.BasicWL: return "urn:factur-x.eu:1p0:basicwl"; case Profile.Comfort: return "urn:cen.eu:en16931:2017"; case Profile.Extended: return "urn:cen.eu:en16931:2017#conformant#urn:factur-x.eu:1p0:extended"; + case Profile.XRechnung1: return "urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_1.2"; case Profile.XRechnung: return "urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_2.0"; default: throw new Exception("Unsupported profile for ZUGFeRD version 21"); } diff --git a/ZUGFeRD/old_enums/CountryCodes_Version3.cs b/ZUGFeRD/old_enums/CountryCodes_Version3.cs deleted file mode 100644 index 173fa41..0000000 --- a/ZUGFeRD/old_enums/CountryCodes_Version3.cs +++ /dev/null @@ -1,1319 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace s2industries.ZUGFeRD -{ - /// - /// Country codes based on ISO 3166 - /// source: - /// http://www.iso.org/iso/home/standards/country_codes/country_names_and_code_elements_txt.htm - /// - /// enum can be re-generated using: - /// - /// f = file("countries.txt") - /// g = file("output.cs", "w+") - /// - /// for line in f.readlines(): - /// parts = line.replace("\n", "").split(";") - /// - /// g.write("/// \n") - /// g.write("/// " + parts[0] + "\n") - /// g.write("/// \n") - /// g.write(parts[1] + ",\n") - /// g.write("\n") - /// - /// f.close() - /// g.close() - /// - public enum CountryCodes_Version3 - { - /// - /// AFGHANISTAN - /// - AF, - - /// - /// ÅLAND ISLANDS - /// - AX, - - /// - /// ALBANIA - /// - AL, - - /// - /// ALGERIA - /// - DZ, - - /// - /// AMERICAN SAMOA - /// - AS, - - /// - /// ANDORRA - /// - AD, - - /// - /// ANGOLA - /// - AO, - - /// - /// ANGUILLA - /// - AI, - - /// - /// ANTARCTICA - /// - AQ, - - /// - /// ANTIGUA AND BARBUDA - /// - AG, - - /// - /// ARGENTINA - /// - AR, - - /// - /// ARMENIA - /// - AM, - - /// - /// ARUBA - /// - AW, - - /// - /// AUSTRALIA - /// - AU, - - /// - /// AUSTRIA - /// - AT, - - /// - /// AZERBAIJAN - /// - AZ, - - /// - /// BAHAMAS - /// - BS, - - /// - /// BAHRAIN - /// - BH, - - /// - /// BANGLADESH - /// - BD, - - /// - /// BARBADOS - /// - BB, - - /// - /// BELARUS - /// - BY, - - /// - /// BELGIUM - /// - BE, - - /// - /// BELIZE - /// - BZ, - - /// - /// BENIN - /// - BJ, - - /// - /// BERMUDA - /// - BM, - - /// - /// BHUTAN - /// - BT, - - /// - /// BOLIVIA, PLURINATIONAL STATE OF - /// - BO, - - /// - /// BONAIRE, SINT EUSTATIUS AND SABA - /// - BQ, - - /// - /// BOSNIA AND HERZEGOVINA - /// - BA, - - /// - /// BOTSWANA - /// - BW, - - /// - /// BOUVET ISLAND - /// - BV, - - /// - /// BRAZIL - /// - BR, - - /// - /// BRITISH INDIAN OCEAN TERRITORY - /// - IO, - - /// - /// BRUNEI DARUSSALAM - /// - BN, - - /// - /// BULGARIA - /// - BG, - - /// - /// BURKINA FASO - /// - BF, - - /// - /// BURUNDI - /// - BI, - - /// - /// CAMBODIA - /// - KH, - - /// - /// CAMEROON - /// - CM, - - /// - /// CANADA - /// - CA, - - /// - /// CAPE VERDE - /// - CV, - - /// - /// CAYMAN ISLANDS - /// - KY, - - /// - /// CENTRAL AFRICAN REPUBLIC - /// - CF, - - /// - /// CHAD - /// - TD, - - /// - /// CHILE - /// - CL, - - /// - /// CHINA - /// - CN, - - /// - /// CHRISTMAS ISLAND - /// - CX, - - /// - /// COCOS (KEELING) ISLANDS - /// - CC, - - /// - /// COLOMBIA - /// - CO, - - /// - /// COMOROS - /// - KM, - - /// - /// CONGO - /// - CG, - - /// - /// CONGO, THE DEMOCRATIC REPUBLIC OF THE - /// - CD, - - /// - /// COOK ISLANDS - /// - CK, - - /// - /// COSTA RICA - /// - CR, - - /// - /// CÔTE D'IVOIRE - /// - CI, - - /// - /// CROATIA - /// - HR, - - /// - /// CUBA - /// - CU, - - /// - /// CURAÇAO - /// - CW, - - /// - /// CYPRUS - /// - CY, - - /// - /// CZECH REPUBLIC - /// - CZ, - - /// - /// DENMARK - /// - DK, - - /// - /// DJIBOUTI - /// - DJ, - - /// - /// DOMINICA - /// - DM, - - /// - /// DOMINICAN REPUBLIC - /// - DO, - - /// - /// ECUADOR - /// - EC, - - /// - /// EGYPT - /// - EG, - - /// - /// EL SALVADOR - /// - SV, - - /// - /// EQUATORIAL GUINEA - /// - GQ, - - /// - /// ERITREA - /// - ER, - - /// - /// ESTONIA - /// - EE, - - /// - /// ETHIOPIA - /// - ET, - - /// - /// FALKLAND ISLANDS (MALVINAS) - /// - FK, - - /// - /// FAROE ISLANDS - /// - FO, - - /// - /// FIJI - /// - FJ, - - /// - /// FINLAND - /// - FI, - - /// - /// FRANCE - /// - FR, - - /// - /// FRENCH GUIANA - /// - GF, - - /// - /// FRENCH POLYNESIA - /// - PF, - - /// - /// FRENCH SOUTHERN TERRITORIES - /// - TF, - - /// - /// GABON - /// - GA, - - /// - /// GAMBIA - /// - GM, - - /// - /// GEORGIA - /// - GE, - - /// - /// GERMANY - /// - DE, - - /// - /// GHANA - /// - GH, - - /// - /// GIBRALTAR - /// - GI, - - /// - /// GREECE - /// - GR, - - /// - /// GREENLAND - /// - GL, - - /// - /// GRENADA - /// - GD, - - /// - /// GUADELOUPE - /// - GP, - - /// - /// GUAM - /// - GU, - - /// - /// GUATEMALA - /// - GT, - - /// - /// GUERNSEY - /// - GG, - - /// - /// GUINEA - /// - GN, - - /// - /// GUINEA-BISSAU - /// - GW, - - /// - /// GUYANA - /// - GY, - - /// - /// HAITI - /// - HT, - - /// - /// HEARD ISLAND AND MCDONALD ISLANDS - /// - HM, - - /// - /// HOLY SEE (VATICAN CITY STATE) - /// - VA, - - /// - /// HONDURAS - /// - HN, - - /// - /// HONG KONG - /// - HK, - - /// - /// HUNGARY - /// - HU, - - /// - /// ICELAND - /// - IS, - - /// - /// INDIA - /// - IN, - - /// - /// INDONESIA - /// - ID, - - /// - /// IRAN, ISLAMIC REPUBLIC OF - /// - IR, - - /// - /// IRAQ - /// - IQ, - - /// - /// IRELAND - /// - IE, - - /// - /// ISLE OF MAN - /// - IM, - - /// - /// ISRAEL - /// - IL, - - /// - /// ITALY - /// - IT, - - /// - /// JAMAICA - /// - JM, - - /// - /// JAPAN - /// - JP, - - /// - /// JERSEY - /// - JE, - - /// - /// JORDAN - /// - JO, - - /// - /// KAZAKHSTAN - /// - KZ, - - /// - /// KENYA - /// - KE, - - /// - /// KIRIBATI - /// - KI, - - /// - /// KOREA, DEMOCRATIC PEOPLE'S REPUBLIC OF - /// - KP, - - /// - /// KOREA, REPUBLIC OF - /// - KR, - - /// - /// KUWAIT - /// - KW, - - /// - /// KYRGYZSTAN - /// - KG, - - /// - /// LAO PEOPLE'S DEMOCRATIC REPUBLIC - /// - LA, - - /// - /// LATVIA - /// - LV, - - /// - /// LEBANON - /// - LB, - - /// - /// LESOTHO - /// - LS, - - /// - /// LIBERIA - /// - LR, - - /// - /// LIBYA - /// - LY, - - /// - /// LIECHTENSTEIN - /// - LI, - - /// - /// LITHUANIA - /// - LT, - - /// - /// LUXEMBOURG - /// - LU, - - /// - /// MACAO - /// - MO, - - /// - /// MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF - /// - MK, - - /// - /// MADAGASCAR - /// - MG, - - /// - /// MALAWI - /// - MW, - - /// - /// MALAYSIA - /// - MY, - - /// - /// MALDIVES - /// - MV, - - /// - /// MALI - /// - ML, - - /// - /// MALTA - /// - MT, - - /// - /// MARSHALL ISLANDS - /// - MH, - - /// - /// MARTINIQUE - /// - MQ, - - /// - /// MAURITANIA - /// - MR, - - /// - /// MAURITIUS - /// - MU, - - /// - /// MAYOTTE - /// - YT, - - /// - /// MEXICO - /// - MX, - - /// - /// MICRONESIA, FEDERATED STATES OF - /// - FM, - - /// - /// MOLDOVA, REPUBLIC OF - /// - MD, - - /// - /// MONACO - /// - MC, - - /// - /// MONGOLIA - /// - MN, - - /// - /// MONTENEGRO - /// - ME, - - /// - /// MONTSERRAT - /// - MS, - - /// - /// MOROCCO - /// - MA, - - /// - /// MOZAMBIQUE - /// - MZ, - - /// - /// MYANMAR - /// - MM, - - /// - /// NAMIBIA - /// - NA, - - /// - /// NAURU - /// - NR, - - /// - /// NEPAL - /// - NP, - - /// - /// NETHERLANDS - /// - NL, - - /// - /// NEW CALEDONIA - /// - NC, - - /// - /// NEW ZEALAND - /// - NZ, - - /// - /// NICARAGUA - /// - NI, - - /// - /// NIGER - /// - NE, - - /// - /// NIGERIA - /// - NG, - - /// - /// NIUE - /// - NU, - - /// - /// NORFOLK ISLAND - /// - NF, - - /// - /// NORTHERN MARIANA ISLANDS - /// - MP, - - /// - /// NORWAY - /// - NO, - - /// - /// OMAN - /// - OM, - - /// - /// PAKISTAN - /// - PK, - - /// - /// PALAU - /// - PW, - - /// - /// PALESTINE, STATE OF - /// - PS, - - /// - /// PANAMA - /// - PA, - - /// - /// PAPUA NEW GUINEA - /// - PG, - - /// - /// PARAGUAY - /// - PY, - - /// - /// PERU - /// - PE, - - /// - /// PHILIPPINES - /// - PH, - - /// - /// PITCAIRN - /// - PN, - - /// - /// POLAND - /// - PL, - - /// - /// PORTUGAL - /// - PT, - - /// - /// PUERTO RICO - /// - PR, - - /// - /// QATAR - /// - QA, - - /// - /// RÉUNION - /// - RE, - - /// - /// ROMANIA - /// - RO, - - /// - /// RUSSIAN FEDERATION - /// - RU, - - /// - /// RWANDA - /// - RW, - - /// - /// SAINT BARTHÉLEMY - /// - BL, - - /// - /// SAINT HELENA, ASCENSION AND TRISTAN DA CUNHA - /// - SH, - - /// - /// SAINT KITTS AND NEVIS - /// - KN, - - /// - /// SAINT LUCIA - /// - LC, - - /// - /// SAINT MARTIN (FRENCH PART) - /// - MF, - - /// - /// SAINT PIERRE AND MIQUELON - /// - PM, - - /// - /// SAINT VINCENT AND THE GRENADINES - /// - VC, - - /// - /// SAMOA - /// - WS, - - /// - /// SAN MARINO - /// - SM, - - /// - /// SAO TOME AND PRINCIPE - /// - ST, - - /// - /// SAUDI ARABIA - /// - SA, - - /// - /// SENEGAL - /// - SN, - - /// - /// SERBIA - /// - RS, - - /// - /// SEYCHELLES - /// - SC, - - /// - /// SIERRA LEONE - /// - SL, - - /// - /// SINGAPORE - /// - SG, - - /// - /// SINT MAARTEN (DUTCH PART) - /// - SX, - - /// - /// SLOVAKIA - /// - SK, - - /// - /// SLOVENIA - /// - SI, - - /// - /// SOLOMON ISLANDS - /// - SB, - - /// - /// SOMALIA - /// - SO, - - /// - /// SOUTH AFRICA - /// - ZA, - - /// - /// SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS - /// - GS, - - /// - /// SOUTH SUDAN - /// - SS, - - /// - /// SPAIN - /// - ES, - - /// - /// SRI LANKA - /// - LK, - - /// - /// SUDAN - /// - SD, - - /// - /// SURINAME - /// - SR, - - /// - /// SVALBARD AND JAN MAYEN - /// - SJ, - - /// - /// SWAZILAND - /// - SZ, - - /// - /// SWEDEN - /// - SE, - - /// - /// SWITZERLAND - /// - CH, - - /// - /// SYRIAN ARAB REPUBLIC - /// - SY, - - /// - /// TAIWAN, PROVINCE OF CHINA - /// - TW, - - /// - /// TAJIKISTAN - /// - TJ, - - /// - /// TANZANIA, UNITED REPUBLIC OF - /// - TZ, - - /// - /// THAILAND - /// - TH, - - /// - /// TIMOR-LESTE - /// - TL, - - /// - /// TOGO - /// - TG, - - /// - /// TOKELAU - /// - TK, - - /// - /// TONGA - /// - TO, - - /// - /// TRINIDAD AND TOBAGO - /// - TT, - - /// - /// TUNISIA - /// - TN, - - /// - /// TURKEY - /// - TR, - - /// - /// TURKMENISTAN - /// - TM, - - /// - /// TURKS AND CAICOS ISLANDS - /// - TC, - - /// - /// TUVALU - /// - TV, - - /// - /// UGANDA - /// - UG, - - /// - /// UKRAINE - /// - UA, - - /// - /// UNITED ARAB EMIRATES - /// - AE, - - /// - /// UNITED KINGDOM - /// - GB, - - /// - /// UNITED STATES - /// - US, - - /// - /// UNITED STATES MINOR OUTLYING ISLANDS - /// - UM, - - /// - /// URUGUAY - /// - UY, - - /// - /// UZBEKISTAN - /// - UZ, - - /// - /// VANUATU - /// - VU, - - /// - /// VENEZUELA, BOLIVARIAN REPUBLIC OF - /// - VE, - - /// - /// VIET NAM - /// - VN, - - /// - /// VIRGIN ISLANDS, BRITISH - /// - VG, - - /// - /// VIRGIN ISLANDS, U.S. - /// - VI, - - /// - /// WALLIS AND FUTUNA - /// - WF, - - /// - /// WESTERN SAHARA - /// - EH, - - /// - /// YEMEN - /// - YE, - - /// - /// ZAMBIA - /// - ZM, - - /// - /// ZIMBABWE - /// - ZW, - - Unknown - } - - - internal static class CountryCodesExtensions_Version3 - { - public static CountryCodes_Version3 FromString(this CountryCodes_Version3 _, string s) - { - try - { - return (CountryCodes_Version3)Enum.Parse(typeof(CountryCodes_Version3), s); - } - catch - { - return CountryCodes_Version3.Unknown; - } - } // !FromString() - - - public static string EnumToString(this CountryCodes_Version3 c) - { - return c.ToString("g"); - } // !ToString() - } -}