Page 372 Bank Account Ledger Entries

Base Application, Microsoft.Bank.Ledger

src/Layers/W1/BaseApp/Bank/Ledger/BankAccountLedgerEntries.Page.al458 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.Bank.Ledger;using Microsoft.Bank.BankAccount;using Microsoft.Bank.Check;using Microsoft.Finance.Dimension;using Microsoft.Finance.GeneralLedger.Ledger;using Microsoft.Finance.GeneralLedger.Reversal;using Microsoft.Finance.GeneralLedger.Setup;using Microsoft.Foundation.AuditCodes;using Microsoft.Foundation.Navigate;using System.Security.User;/// <summary>/// Displays bank account ledger entries in a list view with filtering and navigation capabilities./// Provides read-only access to posted bank transactions with drill-down to related documents,/// dimensions, check entries, and reversal functionality for authorized users./// </summary>page 372 "Bank Account Ledger Entries"{    ApplicationArea = Basic, Suite;    Caption = 'Bank Account Ledger Entries';    DataCaptionFields = "Bank Account No.";    DeleteAllowed = false;    Editable = false;    InsertAllowed = false;    PageType = List;    AboutTitle = 'About Bank Account Ledger Entries';    AboutText = 'View and match detailed bank account ledger entries including amounts, document details, and running balances to bank statement lines for accurate bank reconciliation and financial tracking.';    SourceTable = "Bank Account Ledger Entry";    SourceTableView = sorting("Bank Account No.", "Posting Date")                      order(descending);    UsageCategory = History;    layout    {        area(content)        {            repeater(Control1)            {                ShowCaption = false;                field("Posting Date"; Rec."Posting Date")                {                    ApplicationArea = Basic, Suite;                    Editable = false;                }                field("Document Type"; Rec."Document Type")                {                    ApplicationArea = Basic, Suite;                    Editable = false;                }                field("Document No."; Rec."Document No.")                {                    ApplicationArea = Basic, Suite;                    Editable = false;                }                field("Bank Account No."; Rec."Bank Account No.")                {                    ApplicationArea = Basic, Suite;                    Editable = false;                }                field(Description; Rec.Description)                {                    ApplicationArea = Basic, Suite;                    Editable = false;                }                field("Global Dimension 1 Code"; Rec."Global Dimension 1 Code")                {                    ApplicationArea = Dimensions;                    Editable = false;                    Visible = Dim1Visible;                }                field("Global Dimension 2 Code"; Rec."Global Dimension 2 Code")                {                    ApplicationArea = Dimensions;                    Editable = false;                    Visible = Dim2Visible;                }                field("Our Contact Code"; Rec."Our Contact Code")                {                    ApplicationArea = Basic, Suite;                    Editable = false;                    Visible = false;                }                field("Currency Code"; Rec."Currency Code")                {                    ApplicationArea = Suite;                    Editable = false;                    Visible = false;                }                field(Amount; Rec.Amount)                {                    ApplicationArea = Basic, Suite;                    Visible = AmountVisible;                    Editable = false;                }                field("Debit Amount"; Rec."Debit Amount")                {                    ApplicationArea = Basic, Suite;                    Visible = DebCredAmountVisible;                }                field("Credit Amount"; Rec."Credit Amount")                {                    ApplicationArea = Basic, Suite;                    Visible = DebCredAmountVisible;                }                field(RunningBalance; CalcRunningAccBalance.GetBankAccBalance(Rec))                {                    ApplicationArea = Basic, Suite;                    Caption = 'Running Balance';                    ToolTip = 'Specifies the running balance.';                    AutoFormatExpression = Rec."Currency Code";                    AutoFormatType = 1;                }                field("Amount (LCY)"; Rec."Amount (LCY)")                {                    ApplicationArea = Basic, Suite;                    Editable = false;                    ToolTip = 'Specifies the amount of the entry in LCY.';                    Visible = AmountVisible;                }                field("Debit Amount (LCY)"; Rec."Debit Amount (LCY)")                {                    ApplicationArea = Basic, Suite;                    ToolTip = 'Specifies the total of the ledger entries that represent debits, expressed in LCY.';                    Visible = DebCredAmountVisible;                }                field("Credit Amount (LCY)"; Rec."Credit Amount (LCY)")                {                    ApplicationArea = Basic, Suite;                    ToolTip = 'Specifies the total of the ledger entries that represent credits, expressed in LCY.';                    Visible = DebCredAmountVisible;                }                field(RunningBalanceLCY; CalcRunningAccBalance.GetBankAccBalanceLCY(Rec))                {                    ApplicationArea = Basic, Suite;                    Caption = 'Running Balance (LCY)';                    ToolTip = 'Specifies the running balance in LCY.';                    AutoFormatType = 1;                    AutoFormatExpression = '';                    Visible = false;                }                field("Remaining Amount"; Rec."Remaining Amount")                {                    ApplicationArea = Basic, Suite;                    Editable = false;                    ToolTip = 'Specifies the amount that remains to be applied to if the entry has not been completely applied to.';                    Visible = false;                }                field("Bal. Account Type"; Rec."Bal. Account Type")                {                    ApplicationArea = Basic, Suite;                    Editable = false;                    Visible = false;                }                field("Bal. Account No."; Rec."Bal. Account No.")                {                    ApplicationArea = Basic, Suite;                    Editable = false;                    Visible = false;                }                field(Open; Rec.Open)                {                    ApplicationArea = Basic, Suite;                    Editable = false;                    ToolTip = 'Specifies whether the amount on the bank account entry has been fully applied to or if there is still a remaining amount that must be applied to.';                }                field("User ID"; Rec."User ID")                {                    ApplicationArea = Basic, Suite;                    Editable = false;                    Visible = false;                    trigger OnDrillDown()                    var                        UserMgt: Codeunit "User Management";                    begin                        UserMgt.DisplayUserInformation(Rec."User ID");                    end;                }                field("Source Code"; Rec."Source Code")                {                    ApplicationArea = Suite;                    Editable = false;                    Visible = false;                }                field("Reason Code"; Rec."Reason Code")                {                    ApplicationArea = Suite;                    Editable = false;                    Visible = false;                }                field(Reversed; Rec.Reversed)                {                    ApplicationArea = Basic, Suite;                    Visible = false;                }                field("Reversed by Entry No."; Rec."Reversed by Entry No.")                {                    ApplicationArea = Basic, Suite;                    Visible = false;                }                field("Reversed Entry No."; Rec."Reversed Entry No.")                {                    ApplicationArea = Basic, Suite;                    Visible = false;                }                field("Entry No."; Rec."Entry No.")                {                    ApplicationArea = Basic, Suite;                    Editable = false;                }                field("Dimension Set ID"; Rec."Dimension Set ID")                {                    ApplicationArea = Dimensions;                    Visible = false;                }                field("Shortcut Dimension 3 Code"; Rec."Shortcut Dimension 3 Code")                {                    ApplicationArea = Dimensions;                    Editable = false;                    Visible = Dim3Visible;                }                field("Shortcut Dimension 4 Code"; Rec."Shortcut Dimension 4 Code")                {                    ApplicationArea = Dimensions;                    Editable = false;                    Visible = Dim4Visible;                }                field("Shortcut Dimension 5 Code"; Rec."Shortcut Dimension 5 Code")                {                    ApplicationArea = Dimensions;                    Editable = false;                    Visible = Dim5Visible;                }                field("Shortcut Dimension 6 Code"; Rec."Shortcut Dimension 6 Code")                {                    ApplicationArea = Dimensions;                    Editable = false;                    Visible = Dim6Visible;                }                field("Shortcut Dimension 7 Code"; Rec."Shortcut Dimension 7 Code")                {                    ApplicationArea = Dimensions;                    Editable = false;                    Visible = Dim7Visible;                }                field("Shortcut Dimension 8 Code"; Rec."Shortcut Dimension 8 Code")                {                    ApplicationArea = Dimensions;                    Editable = false;                    Visible = Dim8Visible;                }            }        }        area(factboxes)        {            systempart(Control1900383207; Links)            {                ApplicationArea = RecordLinks;                Visible = false;            }            systempart(Control1905767507; Notes)            {                ApplicationArea = Notes;                Visible = false;            }            part(GLEntriesPart; "G/L Entries Part")            {                ApplicationArea = Basic, Suite;                Caption = 'Related G/L Entries';                ShowFilter = false;                SubPageLink = "Posting Date" = field("Posting Date"), "Document No." = field("Document No.");            }        }    }    actions    {        area(navigation)        {            group("Ent&ry")            {                Caption = 'Ent&ry';                Image = Entry;                action("Check Ledger E&ntries")                {                    ApplicationArea = Basic, Suite;                    Caption = 'Check Ledger E&ntries';                    Image = CheckLedger;                    RunObject = Page "Check Ledger Entries";                    RunPageLink = "Bank Account Ledger Entry No." = field("Entry No.");                    RunPageView = sorting("Bank Account Ledger Entry No.");                    ShortCutKey = 'Shift+F7';                    ToolTip = 'View check ledger entries that result from posting transactions in a payment journal for the relevant bank account.';                }                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;                }                action(SetDimensionFilter)                {                    ApplicationArea = Dimensions;                    Caption = 'Set Dimension Filter';                    Ellipsis = true;                    Image = "Filter";                    ToolTip = 'Limit the entries according to the dimension filters that you specify. NOTE: If you use a high number of dimension combinations, this function may not work and can result in a message that the SQL server only supports a maximum of 2100 parameters.';                    trigger OnAction()                    begin                        Rec.SetFilter("Dimension Set ID", DimensionSetIDFilter.LookupFilter());                    end;                }            }        }        area(processing)        {            group("F&unctions")            {                Caption = 'F&unctions';                Image = "Action";                action("Reverse Transaction")                {                    ApplicationArea = Basic, Suite;                    Caption = 'Reverse Transaction';                    Ellipsis = true;                    Image = ReverseRegister;                    ToolTip = 'Undo an erroneous journal posting.';                    trigger OnAction()                    var                        ReversalEntry: Record "Reversal Entry";                        SourceCodeSetup: Record "Source Code Setup";                    begin                        Clear(ReversalEntry);                        if Rec.Reversed then                            ReversalEntry.AlreadyReversedEntry(Rec.TableCaption, Rec."Entry No.");                        if Rec."Journal Batch Name" = '' then begin                            SourceCodeSetup.Get();                            if Rec."Source Code" <> SourceCodeSetup."Payment Reconciliation Journal" then                                if Rec."Source Code" <> SourceCodeSetup."Trans. Bank Rec. to Gen. Jnl." then                                    ReversalEntry.TestFieldError();                        end;                        Rec.TestField("Transaction No.");                        ReversalEntry.ReverseTransaction(Rec."Transaction No.");                        Clear(CalcRunningAccBalance);                        CurrPage.Update(false);                    end;                }            }            action("&Navigate")            {                ApplicationArea = Basic, Suite;                Caption = 'Find entries...';                Image = Navigate;                ShortCutKey = 'Ctrl+Alt+Q';                ToolTip = 'Find entries and documents that exist for the document number and posting date on the selected document. (Formerly this action was named Navigate.)';                trigger OnAction()                begin                    Navigate.SetDoc(Rec."Posting Date", Rec."Document No.");                    Navigate.Run();                end;            }        }        area(Promoted)        {            group(Category_Process)            {                Caption = 'Process', Comment = 'Generated from the PromotedActionCategories property index 1.';                actionref("&Navigate_Promoted"; "&Navigate")                {                }                actionref("Reverse Transaction_Promoted"; "Reverse Transaction")                {                }                group(Category_Category4)                {                    Caption = 'Entry', Comment = 'Generated from the PromotedActionCategories property index 3.';                    actionref(Dimensions_Promoted; Dimensions)                    {                    }                    actionref(SetDimensionFilter_Promoted; SetDimensionFilter)                    {                    }                    actionref("Check Ledger E&ntries_Promoted"; "Check Ledger E&ntries")                    {                    }                }            }            group(Category_Report)            {                Caption = 'Report', Comment = 'Generated from the PromotedActionCategories property index 2.';            }        }    }    trigger OnOpenPage()    var        GLSetup: Record "General Ledger Setup";        BankAccount: Record "Bank Account";    begin        SetDimVisibility();        BankAccount.SetLoadFields("Currency Code");        if Rec.GetFilter("Bank Account No.") <> '' then begin            Rec.CopyFilter("Bank Account No.", BankAccount."No.");            if BankAccount.FindFirst() then                IsForeignCurrency := BankAccount."Currency Code" <> '';        end;        GLSetup.SetLoadFields("Show Amounts");        GLSetup.Get();        AmountVisible := GLSetup."Show Amounts" in [GLSetup."Show Amounts"::"Amount Only", GLSetup."Show Amounts"::"All Amounts"];        DebCredAmountVisible := GLSetup."Show Amounts" in [GLSetup."Show Amounts"::"Debit/Credit Only", GLSetup."Show Amounts"::"All Amounts"];    end;    var        CalcRunningAccBalance: Codeunit "Calc. Running Acc. Balance";        Navigate: Page Navigate;        DimensionSetIDFilter: Page "Dimension Set ID Filter";    protected var        Dim1Visible: Boolean;        Dim2Visible: Boolean;        Dim3Visible: Boolean;        Dim4Visible: Boolean;        Dim5Visible: Boolean;        Dim6Visible: Boolean;        Dim7Visible: Boolean;        Dim8Visible: Boolean;        AmountVisible: Boolean;        DebCredAmountVisible: Boolean;        IsForeignCurrency: Boolean;    local procedure SetDimVisibility()    var        DimensionManagement: Codeunit DimensionManagement;    begin        DimensionManagement.UseShortcutDims(Dim1Visible, Dim2Visible, Dim3Visible, Dim4Visible, Dim5Visible, Dim6Visible, Dim7Visible, Dim8Visible);    end;}