Skip to content

Commit

Permalink
UBL correction, ApplicableHeaderTradeDelivery not part of the standard
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanstapel committed Nov 27, 2024
1 parent 3c93eee commit ad1b165
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions ZUGFeRD/InvoiceDescriptor22UblReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,18 +223,6 @@ public override InvoiceDescriptor Load(Stream stream)
// };
//}

string _despatchAdviceNo = XmlUtils.NodeAsString(doc.DocumentElement, "//cac:ApplicableHeaderTradeDelivery/cac:DespatchAdviceReferencedDocument/cbc:Id", nsmgr);
DateTime? _despatchAdviceDate = XmlUtils.NodeAsDateTime(doc.DocumentElement, "//cac:ApplicableHeaderTradeDelivery/cac:DespatchAdviceReferencedDocument/cbc:IssueDate", nsmgr);

if (_despatchAdviceDate.HasValue || !String.IsNullOrWhiteSpace(_despatchAdviceNo))
{
retval.DespatchAdviceReferencedDocument = new DespatchAdviceReferencedDocument()
{
ID = _despatchAdviceNo,
IssueDateTime = _despatchAdviceDate
};
}

// TODO: Find value //retval.Invoicee = _nodeAsParty(doc.DocumentElement, "//ram:ApplicableHeaderTradeSettlement/ram:InvoiceeTradeParty", nsmgr);
retval.Payee = _nodeAsParty(doc.DocumentElement, "//cac:PayeeParty", nsmgr);

Expand Down Expand Up @@ -331,6 +319,12 @@ public override InvoiceDescriptor Load(Stream stream)
break; // only one occurrence allowed in UBL
}

XmlNode despatchDocumentReferenceIdNode = doc.DocumentElement.SelectSingleNode("/ubl:Invoice/cac:DespatchDocumentReference/cbc:ID", nsmgr);
if (despatchDocumentReferenceIdNode != null)
{
retval.SetDespatchAdviceReferencedDocument(despatchDocumentReferenceIdNode.InnerText);
}

retval.AddTradePaymentTerms(
description: XmlUtils.NodeAsString(doc.DocumentElement, "//cac:PaymentTerms/cbc:Note", nsmgr),
dueDate: XmlUtils.NodeAsDateTime(doc.DocumentElement, "//cbc:DueDate", nsmgr)
Expand Down

0 comments on commit ad1b165

Please sign in to comment.