When the Customizable Report Pack is set up to create ZUGFeRD compliant invoice and credit memo PDFs, the default behavior is that all documents will be ZUGFeRD compliant. However, in some cases, you might want to send a normal PDF without the electronic ZUGFeRD document.
To do this, you need to subscribe to the “OnDocument2InvoiceDescriptor” event in the “ForNAV eDocument Interface” codeunit, and add the code “eInvoice.”Document Type” := eInvoice.”Document Type”::Unknown;” which will filter out the specific documents.
[EventSubscriber(ObjectType::Codeunit, Codeunit::”ForNAV eDocument Interface”, OnDocument2InvoiceDescriptor, ”, false, false)]
local procedure OnDocument2InvoiceDescriptor(var InvoiceDescriptor: Record “ForNAV InvoiceDescriptor”; var eInvoice: Record “ForNAV eInvoice”)
var
Invoice: Record “Sales Invoice Header”;
begin
if (eInvoice.Profile <> eInvoice.Profile::XRechnung) and (eInvoice.”Document Type” = eInvoice.”Document Type”::Invoice) then begin
if Invoice.Get(eInvoice.”No.”) then begin
if Invoice.”Bill-to Customer No.” = ‘10000’ then
eInvoice.”Document Type” := eInvoice.”Document Type”::Unknown;
end;
end;
end;