Page extension 6144 E-Doc. Posted Sales Inv.
src/Apps/W1/EDocument/App/src/Extensions/EDocPostedSalesInv.PageExt.al87 lines, Copyright (c) Microsoft Corporation. MIT
// ------------------------------------------------------------------------------------------------// Copyright (c) Microsoft Corporation. All rights reserved.// Licensed under the MIT License. See License.txt in the project root for license information.// ------------------------------------------------------------------------------------------------namespace Microsoft.Sales.History;using Microsoft.eServices.EDocument;using Microsoft.eServices.EDocument.Processing.Message;pageextension 6144 "E-Doc. Posted Sales Inv." extends "Posted Sales Invoice"{ layout { addlast(FactBoxes) { part(EDocStatusFactBox; "E-Doc. Status FactBox") { ApplicationArea = Basic, Suite; Caption = 'E-Document'; ShowFilter = false; } part(EDocMessages; "E-Document Messages FactBox") { ApplicationArea = Basic, Suite; Caption = 'E-Document Messages'; ShowFilter = false; } } } actions { addafter("&Invoice") { group("E-Document") { action("OpenEDocument") { ApplicationArea = Basic, Suite; Caption = 'Open'; Image = Open; ToolTip = 'Opens the E-Document card page.'; Enabled = EDocumentExists; trigger OnAction() var EDocument: Record "E-Document"; begin EDocument.OpenEDocument(Rec.RecorDId); end; } action(CreateEDocument) { ApplicationArea = Basic, Suite; Caption = 'Create'; Image = CreateDocument; ToolTip = 'Creates an E-Document from the posted document and sends it via service.'; Enabled = not EDocumentExists; trigger OnAction() var EDocumentProcessing: Codeunit "E-Document Processing"; begin if EDocumentProcessing.CreateEDocumentFromPostedDocumentPage(Rec, Enum::"E-Document Type"::"Sales Invoice") then Message(EDocumentCreatedMsg) else Message(EDocumentNotCreatedMsg); end; } } } } var EDocumentExists: Boolean; EDocumentCreatedMsg: Label 'The e-document has been created.'; EDocumentNotCreatedMsg: Label 'The e-document could not be created.'; trigger OnAfterGetRecord() var EDocument: Record "E-Document"; begin EDocumentExists := EDocument.HasEDocument(Rec.RecordId()); CurrPage.EDocMessages.Page.SetSourceRecordId(Rec.RecordId()); CurrPage.EDocStatusFactBox.Page.SetDocumentRecordId(Rec.RecordId()); end;}