Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanstapel committed Oct 10, 2024
2 parents 3c93a8a + c86e4ee commit eff8353
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 24 deletions.
24 changes: 13 additions & 11 deletions ZUGFeRD/InvoiceDescriptor22UBLWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -265,19 +265,21 @@ public override void Save(InvoiceDescriptor descriptor, Stream stream, ZUGFeRDFo
{
// PayeeFinancialAccount
Writer.WriteStartElement("cac", "PayeeFinancialAccount");

Writer.WriteElementString("cbc", "ID", account.IBAN);
Writer.WriteElementString("cbc", "Name", account.Name);
Writer.WriteOptionalElementString("cbc", "Name", account.Name);

Writer.WriteStartElement("cac", "FinancialInstitutionBranch");
Writer.WriteElementString("cbc", "ID", account.BIC);
if (!string.IsNullOrWhiteSpace(account.BIC))
{
Writer.WriteStartElement("cac", "FinancialInstitutionBranch");
Writer.WriteElementString("cbc", "ID", account.BIC);

//[UBL - CR - 664] - A UBL invoice should not include the FinancialInstitutionBranch FinancialInstitution
//Writer.WriteStartElement("cac", "FinancialInstitution");
//Writer.WriteElementString("cbc", "Name", account.BankName);
//[UBL - CR - 664] - A UBL invoice should not include the FinancialInstitutionBranch FinancialInstitution
//Writer.WriteStartElement("cac", "FinancialInstitution");
//Writer.WriteElementString("cbc", "Name", account.BankName);

//Writer.WriteEndElement(); // !FinancialInstitution
Writer.WriteEndElement(); // !FinancialInstitutionBranch
//Writer.WriteEndElement(); // !FinancialInstitution
Writer.WriteEndElement(); // !FinancialInstitutionBranch
}

Writer.WriteEndElement(); // !PayeeFinancialAccount
}
Expand Down Expand Up @@ -632,11 +634,11 @@ private void _writeOptionalParty(ProfileAwareXmlTextWriter writer, PartyTypes pa
}

writer.WriteStartElement("cac", "PostalAddress");

Writer.WriteElementString("cbc", "StreetName", party.Street);
Writer.WriteOptionalElementString("cbc", "StreetName", party.Street);
Writer.WriteOptionalElementString("cbc", "AdditionalStreetName", party.AddressLine3);
Writer.WriteElementString("cbc", "CityName", party.City);
Writer.WriteElementString("cbc", "PostalZone", party.Postcode);
Writer.WriteOptionalElementString("cbc", "CountrySubentity", party.CountrySubdivisionName);

writer.WriteStartElement("cac", "Country");

Expand Down
8 changes: 4 additions & 4 deletions ZUGFeRD/InvoiceDescriptor23CIIWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -438,13 +438,13 @@ public override void Save(InvoiceDescriptor descriptor, Stream stream, ZUGFeRDFo
}
#endregion

#region SpecifiedTradeAllowanceCharge (Basic, Comfort, Extended)
//Abschläge auf Ebene der Rechnungsposition (Basic, Comfort, Extended)
if (new Profile[] { Profile.Basic, Profile.Comfort, Profile.Extended, Profile.XRechnung }.Contains(descriptor.Profile))
#region SpecifiedTradeAllowanceCharge (Basic, Comfort, Extended, XRechnung)
//Abschläge auf Ebene der Rechnungsposition (Basic, Comfort, Extended, XRechnung)
if (new Profile[] { Profile.Basic, Profile.Comfort, Profile.Extended, Profile.XRechnung1, Profile.XRechnung }.Contains(descriptor.Profile))
{
if (tradeLineItem.GetSpecifiedTradeAllowanceCharges().Count > 0)
{
Writer.WriteStartElement("ram", "SpecifiedTradeAllowanceCharge", Profile.Basic | Profile.Comfort | Profile.Extended | Profile.XRechnung);
Writer.WriteStartElement("ram", "SpecifiedTradeAllowanceCharge", Profile.Basic | Profile.Comfort | Profile.Extended | Profile.XRechnung1 | Profile.XRechnung);

foreach (TradeAllowanceCharge specifiedTradeAllowanceCharge in tradeLineItem.GetSpecifiedTradeAllowanceCharges()) // BT-147
{
Expand Down
14 changes: 5 additions & 9 deletions ZUGFeRD/Party.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,12 @@
* specific language governing permissions and limitations
* under the License.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace s2industries.ZUGFeRD
{
/// <summary>
/// Detailed information about a party that has a certain role within an invoice
/// </summary>
public class Party
/// <summary>
/// Detailed information about a party that has a certain role within an invoice
/// </summary>
public class Party
{
/// <summary>
/// Party identifier
Expand Down Expand Up @@ -65,6 +60,7 @@ public class Party

/// <summary>
/// Street name and number
/// e.g. used for BT-35
/// </summary>
public string Street { get; set; }
/// <summary>
Expand Down

0 comments on commit eff8353

Please sign in to comment.