In the Oseberg PEPPOL solution, you can customize your data output using Events. Contact your Business Central partner for implementing custom code.
If you have questions regarding your customization needs, please contact Oseberg Support for assistance.
Extension Development
For customizing the extenison output, On Line and On Prem, you must use events.
app.json
In your app.json file, please add dependency on the app:
{ "id": "49206e10-c889-400d-8465-bde6555e00fc", "publisher": "Oseberg Solutions AS", "name": "E-invoice PEPPOL Bis", "version": "20.0.0.0" }
Factoring example
When using factoring, you will often need to change your paymentid and bank account according to your Factoring Vendor. You can do this by using the following code:
[EventSubscriber(ObjectType::Codeunit, Codeunit::"OSB_PEPPOL_Management", 'GetPaymentMeansInfoOnAfterEvent', '', true, true)] local procedure "OSB_PEPPOL_Management_GetPaymentMeansInfoOnAfterEvent" ( SalesHeader: Record "Sales Header"; var PaymentCounter: Integer; var PaymentCount: Integer; var PaymentMeansCode: Text; var PaymentMeansListID: text; var PaymentChannelCode: text; var PaymentID: Text; var PrimaryAccountNumberID: Text; var NetworkID: Text; ProcessedDocType: Enum OSB_Peppol_ProcessedDocType ) begin PaymentID = GetCustomPaymentId(); end; [EventSubscriber(ObjectType::Codeunit, Codeunit::"OSB_PEPPOL_Management", 'GetPaymentMeansPayeeFinancialAcc_OnAfterEvent', '', true, true)] local procedure "OSB_PEPPOL_Management_GetPaymentMeansPayeeFinancialAcc_OnAfterEvent" ( SalesHeader: Record "Sales Header"; var PaymentCounter: Integer; var PaymentCount: integer; var PayeeFinancialAccountID: Text; var PaymentMeansSchemeID: Text; var FinancialInstitutionBranchID: Text; var FinancialInstitutionID: Text; var FinancialInstitutionSchemeID: Text; var FinancialInstitutionName: Text ) begin PayeeFinancialAccountID := GetCustomPayeeFinancialAccount(); end;
AdditionalDocumentReference
When additional information is needed in the xml, use AdditionalDocumentReference tag.
[EventSubscriber(ObjectType::Codeunit, Codeunit::OSB_PEPPOL_ExportBis30, 'PDFAttachments_OnBeforeCount', '', false, false)] LOCAL PROCEDURE OSB_PEPPOLExportBis30_PDFAttachments_OnBeforeCount(Rec: Variant; VAR Count: Integer; VAR isHandled: Boolean; ProcessedDocType: Enum OSB_PEPPOL_ProcessedDocType); BEGIN Count := 1; //Specifies how many additional document references to be added isHandled := true; END; [EventSubscriber(ObjectType::Codeunit, Codeunit::OSB_PEPPOL_ExportBis30, 'PDFAttachments_OnBeforeAttachment', '', false, false)] LOCAL PROCEDURE OSB_PEPPOLExportBis30_PDFAttachments_OnBeforeAttachment(VAR SalesHeader: Record "Sales Header"; VAR AdditionalDocumentReferenceID: Text; VAR AdditionalDocRefDocumentType: Text; VAR URI: Text; VAR MimeCode: Text; VAR EmbeddedDocumentBinaryObject: BigText; VAR filename: Text; VAR DocId: Integer; VAR isHandled: Boolean; ProcessedDocType: Enum OSB_PEPPOL_ProcessedDocType); BEGIN GetBirthDate(SalesHeader, AdditionalDocumentReferenceID, AdditionalDocRefDocumentType, URI, MimeCode, EmbeddedDocumentBinaryObject, filename, DocId, isHandled); END; LOCAL PROCEDURE GetBirthDate(VAR SalesHeader: Record "Sales Header"; VAR AdditionalDocumentReferenceID: Text; VAR AdditionalDocRefDocumentType: Text; VAR URI: Text; VAR MimeCode: Text; VAR EmbeddedDocumentBinaryObject: BigText; VAR filename: Text; VAR DocId: Integer; VAR isHandled: Boolean); VAR BEGIN AdditionalDocumentReferenceID := ''; AdditionalDocRefDocumentType := ''; URI := ''; MimeCode := ''; filename := ''; DocId := 0; AdditionalDocumentReferenceID := '10.10.1973'; AdditionalDocRefDocumentType := 'BIRTHDATE'; isHandled := TRUE; END;
Result
<cac:AdditionalDocumentReference> <cbc:ID>10.10.1973</cbc:ID> <cbc:DocumentTypeCode>BIRTHDATE</cbc:DocumentTypeCode> </cac:AdditionalDocumentReference>
Role Tailored Client
Implementing the Role Tailored Client is version specific as Microsoft has developed the sending routines in the NAV versions. Please follow the guide regarding your NAV version.
NAV 2016
NAV 2016 has two ways of sending documents. Either using Print button or “Send…” button.
Send button
For using “Send” or “Post and Send..” button you need to implement some code in standard NAV.
Please add the following code in Table 60.
Add event procedure:
[Integration(TRUE,TRUE)] LOCAL PROCEDURE OSBEHF_OnBeforeSend@44(ReportUsage@1006 : Integer;RecordVariant@1005 : Variant;DocNo@1004 : Code[20];ToCust@1003 : Code[20];DocName@1002 : Text[150];CustomerFieldNo@1001 : Integer;DocumentNoFieldNo@1000 : Integer;VAR IsHandled@1007 : Boolean); BEGIN END;
Modify Send procedure:
PROCEDURE Send@11(ReportUsage@1005 : Integer;RecordVariant@1004 : Variant;DocNo@1003 : Code[20];ToCust@1002 : Code[20];DocName@1001 : Text[150];CustomerFieldNo@1000 : Integer;DocumentNoFieldNo@1006 : Integer); VAR IsHandled@1000000000 : Boolean; BEGIN //OSBEHF+ IsHandled := FALSE; OSBEHF_OnBeforeSend(ReportUsage,RecordVariant,DocNo,ToCust,DocName,CustomerFieldNo,DocumentNoFieldNo,IsHandled); IF IsHandled THEN EXIT; //OSBEHF- SendToVAN(RecordVariant); SendToPrinter(ReportUsage,RecordVariant,ToCust); TrySendToEMailGroupedMultipleSelection(ReportUsage,RecordVariant,DocumentNoFieldNo,DocName,CustomerFieldNo); SendToDisk(ReportUsage,RecordVariant,DocNo,DocName,ToCust); END;
Print button
Implementing the print routine or other business logic:
Add codeunit 15027002 OSB_PEPPOLExportBis30 as a variable.
Call the function with the appropriate document
boolean := OSB_PEPPOLExportBis30.DocumentSendingPrint(SalesInvHeader);
IF the customer is qualified for PEPPOL the procedure sends the document and returns true.
If the customer is not qualified for PEPPOL it returns false, so that another channel can be used.
OSB_PEPPOLExportBis30.DocumentSendingPrint handles table id’s 112,114,5992,5994
Menu Suite
Add page 15027000 as part of the menu suite.