stephanstapel / ZUGFeRD-csharp

C# assembly for creating and reading ZUGFeRD invoices
Apache License 2.0
229 stars 120 forks source link

AdditionalReferencedDocument - AttachmentBinaryObject #333

Closed DasElias closed 2 months ago

DasElias commented 3 months ago

Hi,

two questions regarding the AdditionalReferencedDocument tag.

Kind regards, Elias

stephanstapel commented 3 months ago

grafik

DasElias commented 3 months ago

Thanks a lot for the quick response. I am not sure about the difference between SpecifiedLineTradeSettlement > AdditionalReferencedDocument vs. SpecifiedLineTradeAgreement > AdditionalReferencedDocument, but it seems that with the latter it is indeed possible to attach binary data on item level. Initially, I was referring to SpecifiedLineTradeAgreement > AdditionalReferencedDocument, hence my confusion since binary data can be attached via this property.

image

stephanstapel commented 3 months ago

Interesting. I have no idea why ZUGFeRD 2.2 looks so different. The latest version I can find on gefeg.com (https://portal3.gefeg.com/invoice/tthome/index/617afdc4-623f-44e0-a05b-5b878840e508?page=1&useSelectedItemPosition=true):

ApplicableHeaderTradeAgreement:

grafik

TradeLineItem:

grafik

which would be in line with the current implementation

DasElias commented 3 months ago

If we are both talking about this link, then, yes and no.

It should be noted that the node AdditionalReferencedDocument appears not only twice, but three times. The first two occurrences are the ones that you have already mentioned, which reflect the current implementation. However, there is the third occurence in SpecifiedLineTradeAgreement which seems to allow to reflect binary attachments on document line level.

image

If I were to submit a pull request to map the third node as well, would you have any idea how the library API implementation could be named to avoid confusion with the method that already exists? In my opinion, it would make sense to overload the method item.AddAdditionalReferencedDocument as follows:

stephanstapel commented 3 months ago

Can you please check my commit https://github.com/stephanstapel/ZUGFeRD-csharp/commit/1e032bb2866b9b8bdb7850c60170ab7a64a34738? I guess this should write the correct values.

I have no idea how to implement the third occurrence of AdditionalReferencedDocuments and would leave this for later.

Also I have added the overloaded function as suggested. Please let me know if it works for your use case!

stephanstapel commented 3 months ago

@DasElias can you confirm that the solution is now as desired?