ZUGFeRD-csharp icon indicating copy to clipboard operation
ZUGFeRD-csharp copied to clipboard

There is 0..* for InvoiceReferencedDocument not only 0..1

Open mbreig opened this issue 3 years ago • 8 comments

In XRechnung specification the group BG-3 is defined as 0..*. BG-3 describes the invoices on which the current invoice depends on. In the current implementation of ZUGFeRD-csharp (v9.0.0) it is only possible to define maximum one invoice.

mbreig avatar Sep 28 '22 09:09 mbreig

Do you have an xml example on how this looks with multiple reference documents?

stephanstapel avatar Sep 28 '22 11:09 stephanstapel

Have a look at https://edna-bundesverband.de/wp-content/uploads/ZUGFeRD-2-Umsetzungsempfehlungen-v.2.0.2.pdf page 33 chapter "2.5.3.12" (sorry this document is in German) I think for every referenced invoice there might be a "ram:InvoiceReferencedDocument"-node with none or one date (BT-26) and the document reference (BT-25). For BT-25 I would take the unique invoice number.

mbreig avatar Sep 28 '22 12:09 mbreig

Alright. But how would it look with multiple reference documents? Like this:

<ram:InvoiceReferencedDocument>
  <ram:IssuerAssignedID>RECHNUNG000</ram:IssuerAssignedID>
  <ram:FormattedIssueDateTime>
    <qdt:DateTimeString format="102">20190902</qdt:DateTimeString>
  </ram:FormattedIssueDateTime>
</ram:InvoiceReferencedDocument>
<ram:InvoiceReferencedDocument>
  <ram:IssuerAssignedID>RECHNUNG000</ram:IssuerAssignedID>
  <ram:FormattedIssueDateTime>
    <qdt:DateTimeString format="102">20190902</qdt:DateTimeString>
  </ram:FormattedIssueDateTime>
</ram:InvoiceReferencedDocument>

?

stephanstapel avatar Sep 28 '22 14:09 stephanstapel

Yes that seemed to be correct for me (except the use of the same dokid and -date in both nodes).

I think it is like the additional documents that are included in the xml-file via the node "AdditionalReferencedDocument".

And so there must be an

AddInvoiceReferencedDocument

like there is an

AddAdditionalReferencedDocument

for the included files.

mbreig avatar Sep 28 '22 15:09 mbreig

alright. Unfortunately this will break the API, i.e. it'll be necessary to release a new major version then

stephanstapel avatar Sep 28 '22 15:09 stephanstapel

I have checked a sample XRechnung-file with a list of two refrenced invoices (your sample above) in the kosit validator and it did not accept this file (with only one referenced invoice everything is fine). A short look in the ZUGFeRD-reference shows that there is only one "InvoiceReferencedDocument"-node allowed. XRechnung v2.2 says"0..*". And this is not a misprint because the description of this node says: "Eine Gruppe von Informationselementen, die Informationen über eine oder mehrere vorausgegangene Rechnung(en) enthalten" I hate it. Because of the different "interpretation" of the e-invoice specification it make no sence at this time to modify your API. Sorry for creating this issue. Regards Marcus

mbreig avatar Sep 29 '22 06:09 mbreig

Thanks a lot for your investigation! Unfortunately this is not the first time that there is 'something' between the docs and the implementation.

How about going for a list, stating in the docs that currently only 0..1 is supported by the validators and adding a occurrency check to the validator which is executed automatically before saving a file?

stephanstapel avatar Sep 29 '22 06:09 stephanstapel

I think this idea sounds good.

mbreig avatar Sep 29 '22 07:09 mbreig