Table 53 Accounting Period Buffer

App
Base Application
Namespace
Microsoft.Foundation.Period
Versions
17-25, 27-28
Name by version
Batch Processing Parameter Map from 17, Accounting Period Buffer from 27

Fields, 4Keys, 1Procedures, 1

Versions171819202122232425262728

Source29

Source in 29

src/Layers/W1/BaseApp/Foundation/Period/AccountingPeriodBuffer.Table.al79 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.Foundation.Period;

table 53 "Accounting Period Buffer"
{
    Caption = 'Accounting Period Buffer';
    TableType = Temporary;
    Access = Internal;

    fields
    {
        field(1; "Starting Date"; Date)
        {
            Caption = 'Starting Date';
            ToolTip = 'Specifies the starting date of the accounting period.';
            NotBlank = true;

            trigger OnValidate()
            begin
                Name := Format("Starting Date", 0, PeriodNameTxt);
            end;
        }
        field(2; "Ending Date"; Date)
        {
            Caption = 'Ending Date';
            ToolTip = 'Specifies the ending date of the accounting period.';
            NotBlank = true;

            trigger OnValidate()
            begin
                Name := Format("Starting Date", 0, PeriodNameTxt);
            end;
        }
        field(3; Name; Text[30])
        {
            Caption = 'Name';
            ToolTip = 'Specifies the name of the accounting period.';
        }
        field(5; "Customer No. Filter"; Text[20])
        {
            Caption = 'Customer No. Filter';
            FieldClass = FlowFilter;
        }
    }

    keys
    {
        key(Key1; "Starting Date")
        {
            Clustered = true;
        }
    }

    var
        PeriodNameTxt: Label '<Month Text>, <Year4,4>', Locked = true;

    procedure FillBuffer();
    var
        AccountingPeriod: Record "Accounting Period";
    begin
        Rec.Reset();
        Rec.DeleteAll();
        if AccountingPeriod.FindSet() then begin
            Rec."Starting Date" := AccountingPeriod."Starting Date";
            if AccountingPeriod.Next() <> 0 then
                repeat
                    Rec.Validate("Ending Date", CalcDate('<-1D>', AccountingPeriod."Starting Date"));
                    Rec.Insert(true);
                    Rec.Init();
                    Rec."Starting Date" := AccountingPeriod."Starting Date";
                until AccountingPeriod.Next() = 0;
            Rec.Validate("Ending Date", 99991231D);
            Rec.Insert(true);
        end;
    end;
}