Page 1707 Deferral Sched. Arch. Subform

App
Base Application
Namespace
Microsoft.Finance.Deferral
Versions
17-28
Source table
5128

Procedures, 1

Versions171819202122232425262728

Source29

Source in 29

src/Layers/W1/BaseApp/Finance/Deferral/DeferralSchedArchSubform.Page.al106 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.Finance.Deferral;

/// <summary>
/// Read-only subform page displaying archived deferral schedule lines.
/// Shows historical period amounts and posting dates from archived documents.
/// </summary>
page 1707 "Deferral Sched. Arch. Subform"
{
    Caption = 'Deferral Schedule Detail';
    PageType = ListPart;
    SourceTable = "Deferral Line Archive";

    layout
    {
        area(content)
        {
            repeater(Group)
            {
                field("Posting Date"; Rec."Posting Date")
                {
                    ApplicationArea = Suite;
                }
                field(Description; Rec.Description)
                {
                    ApplicationArea = Suite;
                }
                field(Amount; Rec.Amount)
                {
                    ApplicationArea = Suite;
                }
            }
            group(Control8)
            {
                ShowCaption = false;
                group(Control7)
                {
                    ShowCaption = false;
                    field(TotalDeferral; TotalDeferral)
                    {
                        ApplicationArea = Suite;
                        AutoFormatType = 1;
                        AutoFormatExpression = '';
                        Caption = 'Total Amount to Defer';
                        Editable = false;
                        Enabled = false;
                        ToolTip = 'Specifies the total amount to defer.';
                    }
                }
            }
        }
    }

    actions
    {
    }

    trigger OnAfterGetCurrRecord()
    begin
        UpdateTotal();
    end;

    trigger OnAfterGetRecord()
    begin
        Changed := false;
    end;

    trigger OnNewRecord(BelowxRec: Boolean)
    begin
        UpdateTotal();
    end;

    var
        TotalDeferral: Decimal;
        Changed: Boolean;

    local procedure UpdateTotal()
    begin
        CalcTotal(Rec, TotalDeferral);
    end;

    local procedure CalcTotal(var DeferralLineArchive: Record "Deferral Line Archive"; var TotalDeferral: Decimal)
    var
        DeferralLineArchiveTemp: Record "Deferral Line Archive";
        ShowTotalDeferral: Boolean;
    begin
        DeferralLineArchiveTemp.CopyFilters(DeferralLineArchive);
        ShowTotalDeferral := DeferralLineArchiveTemp.CalcSums(Amount);
        if ShowTotalDeferral then
            TotalDeferral := DeferralLineArchiveTemp.Amount;
    end;

    /// <summary>
    /// Gets the changed status of the deferral schedule archive subform.
    /// </summary>
    /// <returns>True if the subform data has been modified, false otherwise</returns>
    procedure GetChanged(): Boolean
    begin
        exit(Changed);
    end;
}