Page 524 Report Selection - Reminder, source in 29

Source29

src/Layers/W1/BaseApp/Sales/Reminder/ReportSelectionReminder.Page.al196 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.Reminder;

using Microsoft.Foundation.Reporting;
using System.Reflection;

/// <summary>
/// Configures which reports are used when printing or emailing reminders and finance charges.
/// </summary>
page 524 "Report Selection - Reminder"
{
    AboutTitle = 'About report selection for reminders';
    AboutText = 'On this page, you set up the default reports that are used when printing or emailing reminders and finance charge memos. Use the Usage field to select the type of document, then specify which reports to use in the list below.';
    AdditionalSearchTerms = 'Report Selections Reminder/Finance Charge, Finance Charge';
    ApplicationArea = Suite;
    Caption = 'Report Selection - Reminder';
    PageType = Worksheet;
    SaveValues = true;
    SourceTable = "Report Selections";
    UsageCategory = Administration;

    layout
    {
        area(content)
        {
            field(ReportUsage2; ReportUsage2)
            {
                ApplicationArea = Suite;
                Caption = 'Usage';
                ToolTip = 'Specifies which type of document the report is used for.';

                trigger OnValidate()
                begin
                    SetUsageFilter(true);
                end;
            }
            repeater(Control1)
            {
                ShowCaption = false;
                field(Sequence; Rec.Sequence)
                {
                    ApplicationArea = Suite;
                    ToolTip = 'Specifies a number that indicates where this report is in the printing order.';
                }
                field("Report ID"; Rec."Report ID")
                {
                    ApplicationArea = Suite;
                    LookupPageID = Objects;
                    ToolTip = 'Specifies the object ID of the report.';
                }
                field("Report Caption"; Rec."Report Caption")
                {
                    ApplicationArea = Suite;
                    DrillDown = false;
                    LookupPageID = Objects;
                    ToolTip = 'Specifies the display name of the report.';
                }
                field("Use for Email Body"; Rec."Use for Email Body")
                {
                    ApplicationArea = Basic, Suite;
                    ToolTip = 'Specifies that summarized information, such as invoice number, due date, and payment service link, will be inserted in the body of the email that you send.';
                }
                field("Use for Email Attachment"; Rec."Use for Email Attachment")
                {
                    ApplicationArea = Basic, Suite;
                    ToolTip = 'Specifies that the related document will be attached to the email.';
                }
                field(EmailBodyName; Rec."Email Body Layout Name")
                {
                    ApplicationArea = Basic, Suite;
                    ToolTip = 'Specifies the name of the email body layout that is used.';
                }
                field(EmailBodyPublisher; Rec."Email Body Layout Publisher")
                {
                    ApplicationArea = Basic, Suite;
                    ToolTip = 'Specifies the publisher of the email body layout that is used.';
                    Visible = false;
                }
                field("Email Body Layout Code"; Rec."Email Body Layout Code")
                {
                    ApplicationArea = Basic, Suite;
                    ToolTip = 'Specifies the ID of the custom email body layout that is used.';
                    Visible = false;
                }
                field("Email Body Layout Description"; Rec."Email Body Layout Description")
                {
                    ApplicationArea = Basic, Suite;
                    ToolTip = 'Specifies a description of the custom email body layout that is used.';
                    Visible = CustomLayoutsExist;

#if not CLEAN28
                    trigger OnDrillDown()
                    var
                        CustomReportLayout: Record "Custom Report Layout";
                    begin
#pragma warning disable AL0432
                        if CustomReportLayout.LookupLayoutOK(Rec."Report ID") then
#pragma warning restore AL0432
                            Rec.Validate("Email Body Layout Code", CustomReportLayout.Code);
                    end;
#endif
                }
            }
        }
        area(factboxes)
        {
            systempart(Control1900383207; Links)
            {
                ApplicationArea = RecordLinks;
                Visible = false;
            }
            systempart(Control1905767507; Notes)
            {
                ApplicationArea = Notes;
                Visible = false;
            }
        }
    }

    actions
    {
    }

    trigger OnNewRecord(BelowxRec: Boolean)
    begin
        Rec.NewRecord();
    end;

    trigger OnOpenPage()
    begin
        InitUsageFilter();
        SetUsageFilter(false);
        CustomLayoutsExist := Rec.DoesAnyCustomLayotExist();
    end;

    var
        ReportUsage2: Enum "Report Selection Usage Reminder";
        CustomLayoutsExist: Boolean;

    local procedure SetUsageFilter(ModifyRec: Boolean)
    begin
        if ModifyRec then
            if Rec.Modify() then;
        Rec.FilterGroup(2);
        case ReportUsage2 of
            Enum::"Report Selection Usage Reminder"::Reminder:
                Rec.SetRange(Usage, Enum::"Report Selection Usage"::Reminder);
            Enum::"Report Selection Usage Reminder"::"Fin. Charge":
                Rec.SetRange(Usage, Enum::"Report Selection Usage"::"Fin.Charge");
            Enum::"Report Selection Usage Reminder"::"Reminder Test":
                Rec.SetRange(Usage, Enum::"Report Selection Usage"::"Rem.Test");
            Enum::"Report Selection Usage Reminder"::"Fin. Charge Test":
                Rec.SetRange(Usage, Enum::"Report Selection Usage"::"F.C.Test");
        end;
        OnSetUsageFilterOnAfterSetFiltersByReportUsage(Rec, ReportUsage2);
        Rec.FilterGroup(0);
        CurrPage.Update();
    end;

    local procedure InitUsageFilter()
    var
        ReportUsage: Enum "Report Selection Usage";
    begin
        if Rec.GetFilter(Usage) <> '' then begin
            if Evaluate(ReportUsage, Rec.GetFilter(Usage)) then
                case ReportUsage of
                    Enum::"Report Selection Usage"::Reminder:
                        ReportUsage2 := ReportUsage2::Reminder;
                    Enum::"Report Selection Usage"::"Fin.Charge":
                        ReportUsage2 := ReportUsage2::"Fin. Charge";
                    Enum::"Report Selection Usage"::"Rem.Test":
                        ReportUsage2 := ReportUsage2::"Reminder Test";
                    Enum::"Report Selection Usage"::"F.C.Test":
                        ReportUsage2 := ReportUsage2::"Fin. Charge Test";
                    else
                        OnInitUsageFilterOnElseCase(ReportUsage, ReportUsage2);
                end;
            Rec.SetRange(Usage);
        end;
    end;

    [IntegrationEvent(false, false)]
    local procedure OnSetUsageFilterOnAfterSetFiltersByReportUsage(var Rec: Record "Report Selections"; ReportUsage2: Enum "Report Selection Usage Reminder")
    begin
    end;

    [IntegrationEvent(false, false)]
    local procedure OnInitUsageFilterOnElseCase(ReportUsage: Enum "Report Selection Usage"; var ReportUsage2: Enum "Report Selection Usage Reminder")
    begin
    end;
}