Page 752 Standard Gen. Journal Subform

Base Application, Microsoft.Finance.GeneralLedger.Journal

src/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/StandardGenJournalSubform.Page.al372 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.GeneralLedger.Journal;using Microsoft.Finance.Dimension;/// <summary>/// Provides line-level entry interface for standard general journal templates as a subform component./// Enables users to define individual journal line configurations within standard journal templates./// </summary>/// <remarks>/// Subform component for standard journal line management within standard journal templates./// Provides detailed line configuration including account assignments, amounts, dimensions, and posting parameters./// Key features: Line-level template configuration, account and dimension setup, amount and description templates./// Integration: Used as part of standard journal template management, supports line-by-line template definition./// </remarks>page 752 "Standard Gen. Journal Subform"{    AutoSplitKey = true;    Caption = 'Lines';    DelayedInsert = true;    LinksAllowed = false;    MultipleNewLines = true;    PageType = ListPart;    SourceTable = "Standard General Journal Line";    layout    {        area(content)        {            repeater(Control1)            {                ShowCaption = false;                field("Document Type"; Rec."Document Type")                {                    ApplicationArea = Suite;                }                field("Account Type"; Rec."Account Type")                {                    ApplicationArea = Suite;                }                field("Account No."; Rec."Account No.")                {                    ApplicationArea = Suite;                }                field(Description; Rec.Description)                {                    ApplicationArea = Suite;                }                field("Business Unit Code"; Rec."Business Unit Code")                {                    ApplicationArea = Basic, Suite;                    Visible = false;                }                field("Salespers./Purch. Code"; Rec."Salespers./Purch. Code")                {                    ApplicationArea = Suite;                }                field("Campaign No."; Rec."Campaign No.")                {                    ApplicationArea = RelationshipMgmt;                    Visible = false;                }                field("Currency Code"; Rec."Currency Code")                {                    ApplicationArea = Suite;                    Visible = false;                }                field("Gen. Posting Type"; Rec."Gen. Posting Type")                {                    ApplicationArea = Suite;                }                field("Gen. Bus. Posting Group"; Rec."Gen. Bus. Posting Group")                {                    ApplicationArea = Suite;                }                field("Gen. Prod. Posting Group"; Rec."Gen. Prod. Posting Group")                {                    ApplicationArea = Suite;                }                field("VAT Bus. Posting Group"; Rec."VAT Bus. Posting Group")                {                    ApplicationArea = Basic, Suite;                }                field("VAT Prod. Posting Group"; Rec."VAT Prod. Posting Group")                {                    ApplicationArea = Basic, Suite;                }                field(Amount; Rec.Amount)                {                    ApplicationArea = Suite;                }                field("Debit Amount"; Rec."Debit Amount")                {                    ApplicationArea = Suite;                    Visible = false;                }                field("Credit Amount"; Rec."Credit Amount")                {                    ApplicationArea = Suite;                    Visible = false;                }                field("VAT Amount"; Rec."VAT Amount")                {                    ApplicationArea = Basic, Suite;                    Visible = false;                }                field("VAT Difference"; Rec."VAT Difference")                {                    ApplicationArea = Basic, Suite;                    Visible = false;                }                field("Bal. VAT Amount"; Rec."Bal. VAT Amount")                {                    ApplicationArea = Basic, Suite;                }                field("Bal. VAT Difference"; Rec."Bal. VAT Difference")                {                    ApplicationArea = Basic, Suite;                    Visible = false;                }                field("Bal. Account Type"; Rec."Bal. Account Type")                {                    ApplicationArea = Suite;                }                field("Bal. Account No."; Rec."Bal. Account No.")                {                    ApplicationArea = Suite;                }                field("Bal. Gen. Posting Type"; Rec."Bal. Gen. Posting Type")                {                    ApplicationArea = Suite;                }                field("Bal. Gen. Bus. Posting Group"; Rec."Bal. Gen. Bus. Posting Group")                {                    ApplicationArea = Suite;                }                field("Bal. Gen. Prod. Posting Group"; Rec."Bal. Gen. Prod. Posting Group")                {                    ApplicationArea = Suite;                }                field("Bal. VAT Bus. Posting Group"; Rec."Bal. VAT Bus. Posting Group")                {                    ApplicationArea = Basic, Suite;                    Visible = false;                }                field("Bal. VAT Prod. Posting Group"; Rec."Bal. VAT Prod. Posting Group")                {                    ApplicationArea = Basic, Suite;                    Visible = false;                }                field("Bill-to/Pay-to No."; Rec."Bill-to/Pay-to No.")                {                    ApplicationArea = Basic, Suite;                    Visible = false;                }                field("Ship-to/Order Address Code"; Rec."Ship-to/Order Address Code")                {                    ApplicationArea = Basic, Suite;                    Visible = false;                }                field("Payment Terms Code"; Rec."Payment Terms Code")                {                    ApplicationArea = Suite;                }                field("Applies-to Doc. Type"; Rec."Applies-to Doc. Type")                {                    ApplicationArea = Basic, Suite;                    Visible = false;                }                field("On Hold"; Rec."On Hold")                {                    ApplicationArea = Suite;                    Visible = false;                }                field("Bank Payment Type"; Rec."Bank Payment Type")                {                    ApplicationArea = Basic, Suite;                    Visible = false;                }                field("Reason Code"; Rec."Reason Code")                {                    ApplicationArea = Suite;                    Visible = false;                }                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("ShortcutDimCode[3]"; 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));                    Visible = DimVisible3;                    trigger OnValidate()                    begin                        Rec.ValidateShortcutDimCode(3, ShortcutDimCode[3]);                    end;                }                field("ShortcutDimCode[4]"; 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));                    Visible = DimVisible4;                    trigger OnValidate()                    begin                        Rec.ValidateShortcutDimCode(4, ShortcutDimCode[4]);                    end;                }                field("ShortcutDimCode[5]"; 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));                    Visible = DimVisible5;                    trigger OnValidate()                    begin                        Rec.ValidateShortcutDimCode(5, ShortcutDimCode[5]);                    end;                }                field("ShortcutDimCode[6]"; 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));                    Visible = DimVisible6;                    trigger OnValidate()                    begin                        Rec.ValidateShortcutDimCode(6, ShortcutDimCode[6]);                    end;                }                field("ShortcutDimCode[7]"; 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));                    Visible = DimVisible7;                    trigger OnValidate()                    begin                        Rec.ValidateShortcutDimCode(7, ShortcutDimCode[7]);                    end;                }                field("ShortcutDimCode[8]"; 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));                    Visible = DimVisible8;                    trigger OnValidate()                    begin                        Rec.ValidateShortcutDimCode(8, ShortcutDimCode[8]);                    end;                }                field("External Document No."; Rec."External Document No.")                {                    ApplicationArea = Basic, Suite;                    Visible = false;                }            }        }    }    actions    {        area(processing)        {            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();                    end;                }            }        }    }    trigger OnAfterGetRecord()    begin        Rec.ShowShortcutDimCode(ShortcutDimCode);    end;    trigger OnNewRecord(BelowxRec: Boolean)    begin        Clear(ShortcutDimCode);        Rec."Source Code" := GetSourceCodeFromJnlTemplate();    end;    trigger OnOpenPage()    begin        SetDimensionsVisibility();    end;    protected var        ShortcutDimCode: array[8] of Code[20];        DimVisible1: Boolean;        DimVisible2: Boolean;        DimVisible3: Boolean;        DimVisible4: Boolean;        DimVisible5: Boolean;        DimVisible6: Boolean;        DimVisible7: Boolean;        DimVisible8: Boolean;    local procedure GetSourceCodeFromJnlTemplate(): Code[10]    var        GenJnlTemplate: Record "Gen. Journal Template";    begin        GenJnlTemplate.Get(Rec."Journal Template Name");        exit(GenJnlTemplate."Source Code");    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;}