stephanstapel / ZUGFeRD-csharp

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

TradeLineCommentItems leads to invalid XRechnung #124

Closed BarthauerSoftwareGmbH closed 3 years ago

BarthauerSoftwareGmbH commented 3 years ago

Hello,

I have a small Issue with the 'AddTradeLineCommentItem' Method and Export to XRechnung.

The TradeLineItems which are added through the above mentioned Method automaticly recieve the CategoryCode 'O'. Then validated the Invoice with the kosit validationtool I then recieve the following error:

[BR-O-02]-An Invoice that contains an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is "Not subject to VAT" shall not contain the Seller VAT identifier (BT-31), the Seller tax representative VAT identifier (BT-63) or the Buyer VAT identifier (BT-48).

If the User wants to add a Text above a TradeLineItem in the Invoice, is using TradeLineCommentItems only recommend for ZUGFeRD or is the use of the CategoryCode 'O' a error?

Attached is a zip file with the example Invoice and validation report: SampleInvoice_Report.zip

Johannes

stephanstapel commented 3 years ago

Thanks for submitting this. I'm just noting the background information and will fix it within the next days:

The PEPOL rule is:

(exists(//cac:ClassifiedTaxCategory[normalize-space(cbc:ID) = 'O'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']) and (not(//cac:AccountingSupplierParty/cac:Party/cac:PartyTaxScheme[cac:TaxScheme/(normalize-space(upper-case(cbc:ID)) = 'VAT')]/cbc:CompanyID) and not(//cac:TaxRepresentativeParty/cac:PartyTaxScheme[cac:TaxScheme/(normalize-space(upper-case(cbc:ID)) = 'VAT')]/cbc:CompanyID) and not(//cac:AccountingCustomerParty/cac:Party/cac:PartyTaxScheme[cac:TaxScheme/(normalize-space(upper-case(cbc:ID)) = 'VAT')]/cbc:CompanyID))) or not(//cac:ClassifiedTaxCategory[normalize-space(cbc:ID) = 'O'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT'])

The line item looks like this:

<ram:IncludedSupplyChainTradeLineItem>
      <ram:AssociatedDocumentLineDocument>
        <ram:LineID>1</ram:LineID>
        <ram:IncludedNote>
          <ram:Content>Test</ram:Content>
        </ram:IncludedNote>
      </ram:AssociatedDocumentLineDocument>
      <ram:SpecifiedTradeProduct>
        <ram:Name>TEXT</ram:Name>
      </ram:SpecifiedTradeProduct>
      <ram:SpecifiedLineTradeAgreement>
        <ram:GrossPriceProductTradePrice>
          <ram:ChargeAmount>0.00</ram:ChargeAmount>
        </ram:GrossPriceProductTradePrice>
        <ram:NetPriceProductTradePrice>
          <ram:ChargeAmount>0.00</ram:ChargeAmount>
        </ram:NetPriceProductTradePrice>
      </ram:SpecifiedLineTradeAgreement>
      <ram:SpecifiedLineTradeDelivery>
        <ram:BilledQuantity unitCode="Unknown">0.00</ram:BilledQuantity>
      </ram:SpecifiedLineTradeDelivery>
      <ram:SpecifiedLineTradeSettlement>
        <ram:ApplicableTradeTax>
          <ram:TypeCode>VAT</ram:TypeCode>
          <ram:ExemptionReason>Dienstleistungen außerhalb des Steueranwendungsbereichs</ram:ExemptionReason>
          <ram:CategoryCode>O</ram:CategoryCode>
        </ram:ApplicableTradeTax>
        <ram:SpecifiedTradeSettlementLineMonetarySummation>
          <ram:LineTotalAmount>0.00</ram:LineTotalAmount>
        </ram:SpecifiedTradeSettlementLineMonetarySummation>
      </ram:SpecifiedLineTradeSettlement>
    </ram:IncludedSupplyChainTradeLineItem>
stephanstapel commented 3 years ago

@BarthauerSoftwareGmbH : I'm asking myself if I should really fix it. The idea behind the rule is that VAT identifiers are not necessary if no VATs are present in the invoice. That makes sense to some extent. However, the rule also applies if I have some lines with VAT given and just one line with no VAT. And this imho doesn't make sense. So I'd probably not fix it in the library but leave it to the user not to specify the VAT identifier for seller and buyer.

What do you think?

BarthauerSoftwareGmbH commented 3 years ago

Hello @stephanstapel, sorry for the late reply.

What do you think?

Well, in the end, after reading the specification more, this seems to me more like a "problem" with the specification of XRechnung than with the Library. So it is okay to do nothing.

Atleast in our case it does seem that something like a 'TradeLineCommentItem' is not possible.

Thanks for taking the time :)