Page 5634 Recurring Fixed Asset Journal

Base Application, Microsoft.FixedAssets.Journal

src/Layers/W1/BaseApp/FixedAssets/FixedAsset/RecurringFixedAssetJournal.Page.al543 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.FixedAssets.Journal;using Microsoft.Finance.Dimension;using Microsoft.FixedAssets.FixedAsset;using Microsoft.FixedAssets.Posting;using Microsoft.Foundation.Reporting;page 5634 "Recurring Fixed Asset Journal"{    ApplicationArea = FixedAssets;    AutoSplitKey = true;    Caption = 'Recurring Fixed Asset Journals';    DataCaptionFields = "Journal Batch Name";    DelayedInsert = true;    PageType = Worksheet;    SaveValues = true;    SourceTable = "FA Journal Line";    UsageCategory = Tasks;    AboutTitle = 'About Recurring Fixed Asset Journal';    AboutText = 'With the **Recurring Fixed Asset Journal**, you can create and post transactions that reoccur with few or no changes to fixed assets.';    layout    {        area(content)        {            field(CurrentJnlBatchName; CurrentJnlBatchName)            {                ApplicationArea = FixedAssets;                Caption = 'Batch Name';                Lookup = true;                ToolTip = 'Specifies the name of the journal batch, a personalized journal layout, that the journal is based on.';                trigger OnLookup(var Text: Text): Boolean                begin                    CurrPage.SaveRecord();                    FAJnlManagement.LookupName(CurrentJnlBatchName, Rec);                    CurrPage.Update(false);                end;                trigger OnValidate()                begin                    FAJnlManagement.CheckName(CurrentJnlBatchName, Rec);                    CurrentJnlBatchNameOnAfterValidate();                end;            }            repeater(Control1)            {                ShowCaption = false;                field("Recurring Method"; Rec."Recurring Method")                {                    ApplicationArea = FixedAssets;                    AboutTitle = 'Recurring Method';                    AboutText = 'Specifies a recurring method F Fixed or V Variable.';                }                field("Recurring Frequency"; Rec."Recurring Frequency")                {                    ApplicationArea = FixedAssets;                    AboutTitle = 'Recurring Frequency';                    AboutText = 'This field contains a formula that determines how frequently the entry in the recurring fixed asset journal will be posted.';                }                field("FA Posting Date"; Rec."FA Posting Date")                {                    ApplicationArea = FixedAssets;                }                field("Posting Date"; Rec."Posting Date")                {                    ApplicationArea = FixedAssets;                    Visible = false;                }                field("Document Type"; Rec."Document Type")                {                    ApplicationArea = FixedAssets;                }                field("Document No."; Rec."Document No.")                {                    ApplicationArea = FixedAssets;                }                field("FA No."; Rec."FA No.")                {                    ApplicationArea = FixedAssets;                    ToolTip = 'Specifies the number of the related fixed asset. ';                    trigger OnValidate()                    begin                        FAJnlManagement.GetFA(Rec."FA No.", FADescription);                    end;                }                field("Depreciation Book Code"; Rec."Depreciation Book Code")                {                    ApplicationArea = FixedAssets;                }                field("FA Posting Type"; Rec."FA Posting Type")                {                    ApplicationArea = FixedAssets;                }                field(Description; Rec.Description)                {                    ApplicationArea = FixedAssets;                    ToolTip = 'Specifies a description of the fixed asset. ';                }                field(Amount; Rec.Amount)                {                    ApplicationArea = FixedAssets;                }                field("Debit Amount"; Rec."Debit Amount")                {                    ApplicationArea = FixedAssets;                    Visible = false;                }                field("Credit Amount"; Rec."Credit Amount")                {                    ApplicationArea = FixedAssets;                    Visible = false;                }                field("Depr. until FA Posting Date"; Rec."Depr. until FA Posting Date")                {                    ApplicationArea = FixedAssets;                    Visible = false;                }                field("Maintenance Code"; Rec."Maintenance Code")                {                    ApplicationArea = FixedAssets;                    Visible = false;                }                field("Insurance No."; Rec."Insurance No.")                {                    ApplicationArea = FixedAssets;                    Visible = false;                }                field("Budgeted FA No."; Rec."Budgeted FA No.")                {                    ApplicationArea = Suite;                    Visible = false;                }                field("Duplicate in Depreciation Book"; Rec."Duplicate in Depreciation Book")                {                    ApplicationArea = FixedAssets;                    Visible = false;                }                field("Use Duplication List"; Rec."Use Duplication List")                {                    ApplicationArea = FixedAssets;                    Visible = false;                }                field("FA Reclassification Entry"; Rec."FA Reclassification Entry")                {                    ApplicationArea = FixedAssets;                    Visible = false;                }                field("Index Entry"; Rec."Index Entry")                {                    ApplicationArea = FixedAssets;                    Visible = false;                }                field("FA Error Entry No."; Rec."FA Error Entry No.")                {                    ApplicationArea = FixedAssets;                    Visible = false;                }                field("Expiration Date"; Rec."Expiration Date")                {                    ApplicationArea = FixedAssets;                }                field("Shortcut Dimension 1 Code"; Rec."Shortcut Dimension 1 Code")                {                    ApplicationArea = Dimensions;                    Visible = DimVisible1;                }                field("Shortcut Dimension 2 Code"; Rec."Shortcut Dimension 2 Code")                {                    ApplicationArea = Dimensions;                    Visible = DimVisible2;                }                field(ShortcutDimCode3; ShortcutDimCode[3])                {                    ApplicationArea = Dimensions;                    CaptionClass = '1,2,3';                    TableRelation = "Dimension Value".Code where("Global Dimension No." = const(3),                                                                  "Dimension Value Type" = const(Standard),                                                                  Blocked = const(false));                    ToolTip = 'Specifies the dimension value code linked to the journal line.';                    Visible = DimVisible3;                    trigger OnValidate()                    begin                        Rec.ValidateShortcutDimCode(3, ShortcutDimCode[3]);                        OnAfterValidateShortcutDimCode(Rec, ShortcutDimCode, 3);                    end;                }                field(ShortcutDimCode4; ShortcutDimCode[4])                {                    ApplicationArea = Dimensions;                    CaptionClass = '1,2,4';                    TableRelation = "Dimension Value".Code where("Global Dimension No." = const(4),                                                                  "Dimension Value Type" = const(Standard),                                                                  Blocked = const(false));                    ToolTip = 'Specifies the dimension value code linked to the journal line.';                    Visible = DimVisible4;                    trigger OnValidate()                    begin                        Rec.ValidateShortcutDimCode(4, ShortcutDimCode[4]);                        OnAfterValidateShortcutDimCode(Rec, ShortcutDimCode, 4);                    end;                }                field(ShortcutDimCode5; ShortcutDimCode[5])                {                    ApplicationArea = Dimensions;                    CaptionClass = '1,2,5';                    TableRelation = "Dimension Value".Code where("Global Dimension No." = const(5),                                                                  "Dimension Value Type" = const(Standard),                                                                  Blocked = const(false));                    ToolTip = 'Specifies the dimension value code linked to the journal line.';                    Visible = DimVisible5;                    trigger OnValidate()                    begin                        Rec.ValidateShortcutDimCode(5, ShortcutDimCode[5]);                        OnAfterValidateShortcutDimCode(Rec, ShortcutDimCode, 5);                    end;                }                field(ShortcutDimCode6; ShortcutDimCode[6])                {                    ApplicationArea = Dimensions;                    CaptionClass = '1,2,6';                    TableRelation = "Dimension Value".Code where("Global Dimension No." = const(6),                                                                  "Dimension Value Type" = const(Standard),                                                                  Blocked = const(false));                    ToolTip = 'Specifies the dimension value code linked to the journal line.';                    Visible = DimVisible6;                    trigger OnValidate()                    begin                        Rec.ValidateShortcutDimCode(6, ShortcutDimCode[6]);                        OnAfterValidateShortcutDimCode(Rec, ShortcutDimCode, 6);                    end;                }                field(ShortcutDimCode7; ShortcutDimCode[7])                {                    ApplicationArea = Dimensions;                    CaptionClass = '1,2,7';                    TableRelation = "Dimension Value".Code where("Global Dimension No." = const(7),                                                                  "Dimension Value Type" = const(Standard),                                                                  Blocked = const(false));                    ToolTip = 'Specifies the dimension value code linked to the journal line.';                    Visible = DimVisible7;                    trigger OnValidate()                    begin                        Rec.ValidateShortcutDimCode(7, ShortcutDimCode[7]);                        OnAfterValidateShortcutDimCode(Rec, ShortcutDimCode, 7);                    end;                }                field(ShortcutDimCode8; ShortcutDimCode[8])                {                    ApplicationArea = Dimensions;                    CaptionClass = '1,2,8';                    TableRelation = "Dimension Value".Code where("Global Dimension No." = const(8),                                                                  "Dimension Value Type" = const(Standard),                                                                  Blocked = const(false));                    ToolTip = 'Specifies the dimension value code linked to the journal line.';                    Visible = DimVisible8;                    trigger OnValidate()                    begin                        Rec.ValidateShortcutDimCode(8, ShortcutDimCode[8]);                        OnAfterValidateShortcutDimCode(Rec, ShortcutDimCode, 8);                    end;                }            }            group(Control2)            {                ShowCaption = false;                fixed(Control1900116601)                {                    ShowCaption = false;                    group("FA Description")                    {                        Caption = 'FA Description';                        field(FADescription; FADescription)                        {                            ApplicationArea = FixedAssets;                            Editable = false;                            ShowCaption = false;                            ToolTip = 'Specifies a description of the fixed asset.';                        }                    }                }            }        }        area(factboxes)        {            systempart(Control1900383207; Links)            {                ApplicationArea = RecordLinks;                Visible = false;            }            systempart(Control1905767507; Notes)            {                ApplicationArea = Notes;                Visible = false;            }        }    }    actions    {        area(navigation)        {            group("&Line")            {                Caption = '&Line';                Image = Line;                action(Dimensions)                {                    AccessByPermission = TableData Dimension = R;                    ApplicationArea = Dimensions;                    Caption = 'Dimensions';                    Image = Dimensions;                    ShortCutKey = 'Alt+D';                    ToolTip = 'View or edit dimensions, such as area, project, or department, that you can assign to sales and purchase documents to distribute costs and analyze transaction history.';                    trigger OnAction()                    begin                        Rec.ShowDimensions();                        CurrPage.SaveRecord();                    end;                }            }            group("Fixed &Asset")            {                Caption = 'Fixed &Asset';                Image = FixedAssets;                action(Card)                {                    ApplicationArea = FixedAssets;                    Caption = 'Card';                    Image = EditLines;                    RunObject = Page "Fixed Asset Card";                    RunPageLink = "No." = field("FA No.");                    ShortCutKey = 'Shift+F7';                    ToolTip = 'View or change detailed information about the record on the document or journal line.';                }                action("Ledger E&ntries")                {                    ApplicationArea = FixedAssets;                    Caption = 'Ledger E&ntries';                    Image = FixedAssetLedger;                    //The property 'PromotedCategory' can only be set if the property 'Promoted' is set to 'true'                    //PromotedCategory = Process;                    RunObject = Codeunit "FA Jnl.-Show Entries";                    ShortCutKey = 'Ctrl+F7';                    ToolTip = 'View the history of transactions that have been posted for the selected record.';                }            }        }        area(processing)        {            group("P&osting")            {                Caption = 'P&osting';                Image = Post;                action("Test Report")                {                    ApplicationArea = FixedAssets;                    Caption = 'Test Report';                    Ellipsis = true;                    Image = TestReport;                    ToolTip = 'View a test report so that you can find and correct any errors before you perform the actual posting of the journal or document.';                    trigger OnAction()                    begin                        ReportPrint.PrintFAJnlLine(Rec);                    end;                }                action("P&ost")                {                    ApplicationArea = FixedAssets;                    Caption = 'P&ost';                    Image = PostOrder;                    ShortCutKey = 'F9';                    ToolTip = 'Finalize the document or journal by posting the amounts and quantities to the related accounts in your company books.';                    trigger OnAction()                    begin                        CODEUNIT.Run(CODEUNIT::"FA. Jnl.-Post", Rec);                        CurrentJnlBatchName := Rec.GetRangeMax("Journal Batch Name");                        CurrPage.Update(false);                    end;                }                action(Preview)                {                    ApplicationArea = FixedAssets;                    Caption = 'Preview Posting';                    Image = ViewPostedOrder;                    ShortCutKey = 'Ctrl+Alt+F9';                    ToolTip = 'Review the different types of entries that will be created when you post the document or journal.';                    trigger OnAction()                    var                        FAJnlPost: Codeunit "FA. Jnl.-Post";                    begin                        FAJnlPost.Preview(Rec);                    end;                }                action("Post and &Print")                {                    ApplicationArea = FixedAssets;                    Caption = 'Post and &Print';                    Image = PostPrint;                    ShortCutKey = 'Shift+F9';                    ToolTip = 'Finalize and prepare to print the document or journal. The values and quantities are posted to the related accounts. A report request window where you can specify what to include on the print-out.';                    trigger OnAction()                    begin                        CODEUNIT.Run(CODEUNIT::"FA. Jnl.-Post+Print", Rec);                        CurrentJnlBatchName := Rec.GetRangeMax("Journal Batch Name");                        CurrPage.Update(false);                    end;                }            }        }        area(Promoted)        {            group(Category_Process)            {                Caption = 'Process';                group(Category_Posting)                {                    Caption = 'Posting';                    ShowAs = SplitButton;                    actionref("P&ost_Promoted"; "P&ost")                    {                    }                    actionref("Post and &Print_Promoted"; "Post and &Print")                    {                    }                    actionref(Preview_Promoted; Preview)                    {                    }                }                actionref(Dimensions_Promoted; Dimensions)                {                }            }        }    }    trigger OnAfterGetCurrRecord()    begin        FAJnlManagement.GetFA(Rec."FA No.", FADescription);    end;    trigger OnAfterGetRecord()    begin        Rec.ShowShortcutDimCode(ShortcutDimCode);    end;    trigger OnNewRecord(BelowxRec: Boolean)    begin        Rec.SetUpNewLine(xRec);        Clear(ShortcutDimCode);    end;    trigger OnOpenPage()    var        JnlSelected: Boolean;    begin        SetDimensionsVisibility();        if Rec.IsOpenedFromBatch() then begin            CurrentJnlBatchName := Rec."Journal Batch Name";            FAJnlManagement.OpenJournal(CurrentJnlBatchName, Rec);            exit;        end;        FAJnlManagement.TemplateSelection(PAGE::"Recurring Fixed Asset Journal", true, Rec, JnlSelected);        if not JnlSelected then            Error('');        FAJnlManagement.OpenJournal(CurrentJnlBatchName, Rec);    end;    var        FAJnlManagement: Codeunit FAJnlManagement;        ReportPrint: Codeunit "Test Report-Print";        CurrentJnlBatchName: Code[10];        FADescription: Text[100];    protected var        ShortcutDimCode: array[8] of Code[20];        DimVisible1: Boolean;        DimVisible2: Boolean;        DimVisible3: Boolean;        DimVisible4: Boolean;        DimVisible5: Boolean;        DimVisible6: Boolean;        DimVisible7: Boolean;        DimVisible8: Boolean;    protected procedure CurrentJnlBatchNameOnAfterValidate()    begin        CurrPage.SaveRecord();        FAJnlManagement.SetName(CurrentJnlBatchName, Rec);        CurrPage.Update(false);    end;    local procedure SetDimensionsVisibility()    var        DimMgt: Codeunit DimensionManagement;    begin        DimVisible1 := false;        DimVisible2 := false;        DimVisible3 := false;        DimVisible4 := false;        DimVisible5 := false;        DimVisible6 := false;        DimVisible7 := false;        DimVisible8 := false;        DimMgt.UseShortcutDims(          DimVisible1, DimVisible2, DimVisible3, DimVisible4, DimVisible5, DimVisible6, DimVisible7, DimVisible8);        Clear(DimMgt);    end;    [IntegrationEvent(false, false)]    local procedure OnAfterValidateShortcutDimCode(var FAJournalLine: Record "FA Journal Line"; var ShortcutDimCode: array[8] of Code[20]; DimIndex: Integer)    begin    end;}