Page extension 6149 E-Doc. Issued Fin. Charge Memo

E-Document Core, Microsoft.Sales.FinanceCharge

src/Apps/W1/EDocument/App/src/Extensions/EDocIssuedFinChargeMemo.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.FinanceCharge;using Microsoft.eServices.EDocument;using Microsoft.eServices.EDocument.Processing.Message;pageextension 6149 "E-Doc. Issued Fin. Charge Memo" extends "Issued Finance Charge Memo"{    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("&Memo")        {            group("E-Document")            {                action("OpenEDocument")                {                    ApplicationArea = Basic, Suite;                    Caption = 'Open';                    Image = CopyDocument;                    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"::"Issued Finance Charge Memo") 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;}