Skip to content

Commit

Permalink
documentation, invoice type rework
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanstapel committed Sep 7, 2020
1 parent 162286e commit f000f25
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 44 deletions.
21 changes: 15 additions & 6 deletions ZUGFeRD/AssociatedDocument.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,27 @@

namespace s2industries.ZUGFeRD
{
/// <summary>
/// Representation for general information on item level
/// </summary>
public class AssociatedDocument
{
/// <summary>
/// Detailed information in free text form
/// </summary>
public List<Note> Notes { get; set; } = new List<Note>();
public int? LineID { get; set; }

public AssociatedDocument()
{

}
/// <summary>
/// identifier of the invoice line item
/// </summary>
public int? LineID { get; set; }


public AssociatedDocument(int? lineID)
/// <summary>
/// Initializes a new associated document object, optionally passing a certain lineID
/// </summary>
/// <param name="lineID"></param>
public AssociatedDocument(int? lineID = null)
{
this.LineID = lineID;
}
Expand Down
27 changes: 27 additions & 0 deletions ZUGFeRD/BankAccount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,40 @@

namespace s2industries.ZUGFeRD
{
/// <summary>
/// This class holds information about a bank account. The class is used in different places,
/// e.g. for holding supplier and customer bank information
/// </summary>
public class BankAccount
{
/// <summary>
/// National account number (not SEPA)
/// </summary>
public string ID { get; set; }

/// <summary>
/// IBAN identifier for the bank account. This information is not yet validated.
/// </summary>
public string IBAN { get; set; }

/// <summary>
/// Payment service provider identifier
/// </summary>
public string BIC { get; set; }

/// <summary>
/// Legacy bank identifier
/// </summary>
public string Bankleitzahl { get; set; }

/// <summary>
/// Clear text name of the bank
/// </summary>
public string BankName { get; set; }

/// <summary>
/// Payment account name
/// </summary>
public string Name { get; set; }
}
}
15 changes: 15 additions & 0 deletions ZUGFeRD/GlobalID.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,18 @@ namespace s2industries.ZUGFeRD
/// </summary>
public class GlobalID
{
/// <summary>
/// The identification of articles based on a registered scheme
///
/// The global identifier of the article is a globally unique identifier of the product being assigned to it by its producer, bases on the rules of a global standardisation body.
/// </summary>
public string ID { get; set; }

/// <summary>
/// The identification of items based on a registered scheme
///
/// The schema of identification must be composed of the entries of the list published by the ISO/IEC 6523 Maintenance Agency.
/// </summary>
public string SchemeID { get; set; }

/// <summary>
Expand Down Expand Up @@ -69,13 +80,17 @@ public class GlobalID
/// </summary>
public const string SchemeID_Unknown = "0000";

#pragma warning disable CS1591 // Fehledes XML-Kommentar für öffentlich sichtbaren Typ oder Element
public GlobalID()
#pragma warning restore CS1591 // Fehledes XML-Kommentar für öffentlich sichtbaren Typ oder Element
{
this.ID = "";
this.SchemeID = GlobalID.SchemeID_Unknown;
} // !GlobalID()

#pragma warning disable CS1591 // Fehledes XML-Kommentar für öffentlich sichtbaren Typ oder Element
public GlobalID(string schemeID, string ID)
#pragma warning restore CS1591 // Fehledes XML-Kommentar für öffentlich sichtbaren Typ oder Element
{
this.ID = ID;
this.SchemeID = schemeID;
Expand Down
12 changes: 7 additions & 5 deletions ZUGFeRD/InvoiceDescriptor1Writer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,7 @@ private string _translateInvoiceType(InvoiceType type)
case InvoiceType.Invoice: return "RECHNUNG";
case InvoiceType.Correction: return "KORREKTURRECHNUNG";
case InvoiceType.CreditNote: return "GUTSCHRIFT";
case InvoiceType.DebitnoteRelatedToFinancialAdjustments: return "WERTBELASTUNG";
case InvoiceType.DebitNote: return "";
case InvoiceType.SelfBilledInvoice: return "";
default: return "";
Expand All @@ -847,14 +848,15 @@ private int _encodeInvoiceType(InvoiceType type)
// 84: 'Wertbelastung/Wertrechnung ohne Warenbezug'
// 380: 'Handelsrechnung (Rechnung für Waren und Dienstleistungen)'
// 389: 'Selbst ausgestellte Rechnung (Steuerrechtliche Gutschrift/Gutschriftsverfahren)'
//
// this is documented in ZUGFeRD-Format_1p0_c1p0_Codelisten.pdf
// all other types are mapped accordingly
switch (type)
{
case InvoiceType.Correction: return (int)InvoiceType.Invoice;
case InvoiceType.CreditNote: return (int)InvoiceType.Invoice;
case InvoiceType.DebitNote: return (int)InvoiceType.Invoice;
case InvoiceType.Invoice: return (int)InvoiceType.Invoice;
case InvoiceType.SelfBilledInvoice: return (int)InvoiceType.SelfBilledInvoice;
default: return (int)InvoiceType.Unknown;
case InvoiceType.DebitnoteRelatedToFinancialAdjustments: return (int)InvoiceType.DebitnoteRelatedToFinancialAdjustments;
case InvoiceType.Unknown: return (int)InvoiceType.Unknown;
default: return (int)InvoiceType.Invoice;
}
} // !_translateInvoiceType()
}
Expand Down
32 changes: 16 additions & 16 deletions ZUGFeRD/InvoiceDescriptor20Writer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -843,11 +843,18 @@ private string _translateInvoiceType(InvoiceType type)
{
switch (type)
{
case InvoiceType.SelfBilledInvoice:
case InvoiceType.Invoice: return "RECHNUNG";
case InvoiceType.Correction: return "KORREKTURRECHNUNG";
case InvoiceType.SelfBilledCreditNote:
case InvoiceType.CreditNote: return "GUTSCHRIFT";
case InvoiceType.DebitNote: return "";
case InvoiceType.SelfBilledInvoice: return "";
case InvoiceType.DebitNote: return "BELASTUNGSANZEIGE";
case InvoiceType.DebitnoteRelatedToFinancialAdjustments: return "WERTBELASTUNG";
case InvoiceType.PartialInvoice: return "TEILRECHNUNG";
case InvoiceType.PrepaymentInvoice: return "VORAUSZAHLUNGSRECHNUNG";
case InvoiceType.InvoiceInformation: return "KEINERECHNUNG";
case InvoiceType.Correction:
case InvoiceType.CorrectionOld: return "KORREKTURRECHNUNG";
case InvoiceType.Unknown: return "";
default: return "";
}
} // !_translateInvoiceType()
Expand All @@ -860,23 +867,16 @@ private int _encodeInvoiceType(InvoiceType type)
type -= 1000;
}

// only these types are allowed
// 84: 'Wertbelastung/Wertrechnung ohne Warenbezug'
// 380: 'Handelsrechnung (Rechnung für Waren und Dienstleistungen)'
// 389: 'Selbst ausgestellte Rechnung (Steuerrechtliche Gutschrift/Gutschriftsverfahren)'
switch (type)
if (type == InvoiceType.CorrectionOld)
{
case InvoiceType.Correction: return (int)InvoiceType.Invoice;
case InvoiceType.CreditNote: return (int)InvoiceType.Invoice;
case InvoiceType.DebitNote: return (int)InvoiceType.Invoice;
case InvoiceType.Invoice: return (int)InvoiceType.Invoice;
case InvoiceType.SelfBilledInvoice: return (int)InvoiceType.SelfBilledInvoice;
default: return (int)InvoiceType.Unknown;
return (int)InvoiceType.Correction;
}

return (int)type;
} // !_translateInvoiceType()


internal override bool Validate(InvoiceDescriptor descriptor, bool throwExceptions = true)
internal override bool Validate(InvoiceDescriptor descriptor, bool throwExceptions = true)
{
if (descriptor.Profile == Profile.BasicWL)
{
Expand All @@ -889,5 +889,5 @@ internal override bool Validate(InvoiceDescriptor descriptor, bool throwExceptio

return true;
} // !Validate()
}
}
}
30 changes: 15 additions & 15 deletions ZUGFeRD/InvoiceDescriptor21Writer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1053,11 +1053,18 @@ private string _translateInvoiceType(InvoiceType type)
{
switch (type)
{
case InvoiceType.SelfBilledInvoice:
case InvoiceType.Invoice: return "RECHNUNG";
case InvoiceType.Correction: return "KORREKTURRECHNUNG";
case InvoiceType.SelfBilledCreditNote:
case InvoiceType.CreditNote: return "GUTSCHRIFT";
case InvoiceType.DebitNote: return "";
case InvoiceType.SelfBilledInvoice: return "";
case InvoiceType.DebitNote: return "BELASTUNGSANZEIGE";
case InvoiceType.DebitnoteRelatedToFinancialAdjustments: return "WERTBELASTUNG";
case InvoiceType.PartialInvoice: return "TEILRECHNUNG";
case InvoiceType.PrepaymentInvoice: return "VORAUSZAHLUNGSRECHNUNG";
case InvoiceType.InvoiceInformation: return "KEINERECHNUNG";
case InvoiceType.Correction:
case InvoiceType.CorrectionOld: return "KORREKTURRECHNUNG";
case InvoiceType.Unknown: return "";
default: return "";
}
} // !_translateInvoiceType()
Expand All @@ -1070,19 +1077,12 @@ private int _encodeInvoiceType(InvoiceType type)
type -= 1000;
}

// only these types are allowed
// 84: 'Wertbelastung/Wertrechnung ohne Warenbezug'
// 380: 'Handelsrechnung (Rechnung für Waren und Dienstleistungen)'
// 389: 'Selbst ausgestellte Rechnung (Steuerrechtliche Gutschrift/Gutschriftsverfahren)'
switch (type)
if (type == InvoiceType.CorrectionOld)
{
case InvoiceType.Correction: return (int)InvoiceType.Invoice;
case InvoiceType.CreditNote: return (int)InvoiceType.Invoice;
case InvoiceType.DebitNote: return (int)InvoiceType.Invoice;
case InvoiceType.Invoice: return (int)InvoiceType.Invoice;
case InvoiceType.SelfBilledInvoice: return (int)InvoiceType.SelfBilledInvoice;
default: return (int)InvoiceType.Unknown;
return (int)InvoiceType.Correction;
}
} // !_translateInvoiceType()

return (int)type;
} // !_translateInvoiceType()
}
}
8 changes: 8 additions & 0 deletions ZUGFeRD/InvoiceType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,16 @@

namespace s2industries.ZUGFeRD
{
/// <summary>
/// Type codes for the various kinds of documents that can be represented using ZUGFeRD.
/// </summary>
public enum InvoiceType
{
/// <summary>
/// Document/message for providing debit information related to financial adjustments to the relevant party.
/// </summary>
DebitnoteRelatedToFinancialAdjustments = 84,

/// <summary>
/// Self billed credit note (261)
/// is a Credit Note
Expand Down
4 changes: 2 additions & 2 deletions ZUGFeRD/ZUGFeRD.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
<PackageProjectUrl>https://github.com/stephanstapel/ZUGFeRD-csharp/</PackageProjectUrl>
<PackageTags>zugferd xml</PackageTags>
<Copyright>Stephan Stapel, s2 industries, 2020</Copyright>
<AssemblyVersion>3.2.1.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyTrademark>http://www.s2-industries.com</AssemblyTrademark>
<FileVersion>3.2.1.0</FileVersion>
<FileVersion>4.0.0.0</FileVersion>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<AssemblyName>s2industries.ZUGFeRD</AssemblyName>
<SignAssembly>true</SignAssembly>
Expand Down

0 comments on commit f000f25

Please sign in to comment.