Table 5223 Detailed Employee Ledger Entry

App
Base Application
Namespace
Microsoft.HumanResources.Payables
Versions
17-28

Fields, 29Keys, 3Procedures, 4Events, 2

Versions171819202122232425262728

Source29

Source in 29

src/Layers/W1/BaseApp/HumanResources/Payables/DetailedEmployeeLedgerEntry.Table.al306 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.HumanResources.Payables;

using Microsoft.Finance.Currency;
using Microsoft.Finance.Dimension;
using Microsoft.Finance.GeneralLedger.Journal;
using Microsoft.Finance.GeneralLedger.Ledger;
using Microsoft.Finance.ReceivablesPayables;
using Microsoft.Foundation.AuditCodes;
using Microsoft.HumanResources.Employee;
using Microsoft.Utilities;
using System.Security.AccessControl;
using System.Security.User;

table 5223 "Detailed Employee Ledger Entry"
{
    Caption = 'Detailed Employee Ledger Entry';
    LookupPageId = "Detailed Empl. Ledger Entries";
    DrillDownPageId = "Detailed Empl. Ledger Entries";
    Permissions = TableData "Detailed Employee Ledger Entry" = m;
    DataClassification = CustomerContent;

    fields
    {
        field(1; "Entry No."; Integer)
        {
            Caption = 'Entry No.';
            ToolTip = 'Specifies the entry number of the detailed employee ledger entry.';
        }
        field(2; "Employee Ledger Entry No."; Integer)
        {
            Caption = 'Employee Ledger Entry No.';
            ToolTip = 'Specifies the entry number of the employee ledger entry that the detailed employee ledger entry line was created for.';
            TableRelation = "Employee Ledger Entry";
        }
        field(3; "Entry Type"; Enum "Detailed CV Ledger Entry Type")
        {
            Caption = 'Entry Type';
            ToolTip = 'Specifies the entry type of the detailed employee ledger entry.';
        }
        field(4; "Posting Date"; Date)
        {
            Caption = 'Posting Date';
            ToolTip = 'Specifies the posting date of the detailed employee ledger entry.';
        }
        field(5; "Document Type"; Enum "Gen. Journal Document Type")
        {
            Caption = 'Document Type';
            ToolTip = 'Specifies the document type of the detailed employee ledger entry.';
        }
        field(6; "Document No."; Code[20])
        {
            Caption = 'Document No.';
            ToolTip = 'Specifies the document number of the transaction that created the entry.';
        }
        field(7; Amount; Decimal)
        {
            AutoFormatExpression = Rec."Currency Code";
            AutoFormatType = 1;
            Caption = 'Amount';
            ToolTip = 'Specifies the amount of the detailed employee ledger entry.';
        }
        field(8; "Amount (LCY)"; Decimal)
        {
            AutoFormatType = 1;
            AutoFormatExpression = '';
            Caption = 'Amount (LCY)';
        }
        field(9; "Employee No."; Code[20])
        {
            Caption = 'Employee No.';
            ToolTip = 'Specifies the number of the employee to which the entry is posted.';
            TableRelation = Employee;
        }
        field(10; "Currency Code"; Code[10])
        {
            Caption = 'Currency Code';
            ToolTip = 'Specifies the code for the currency if the amount is in a foreign currency.';
            TableRelation = Currency;
        }
        field(11; "User ID"; Code[50])
        {
            Caption = 'User ID';
            ToolTip = 'Specifies the ID of the user who posted the entry, to be used, for example, in the change log.';
            DataClassification = EndUserIdentifiableInformation;
            TableRelation = User."User Name";
            ValidateTableRelation = false;

            trigger OnValidate()
            var
                UserSelection: Codeunit "User Selection";
            begin
                UserSelection.ValidateUserName("User ID");
            end;
        }
        field(12; "Source Code"; Code[10])
        {
            Caption = 'Source Code';
            ToolTip = 'Specifies the source code that specifies where the entry was created.';
            TableRelation = "Source Code";
        }
        field(13; "Transaction No."; Integer)
        {
            Caption = 'Transaction No.';
            TableRelation = "G/L Transaction";
        }
        field(14; "Journal Batch Name"; Code[10])
        {
            Caption = 'Journal Batch Name';
        }
        field(15; "Reason Code"; Code[10])
        {
            Caption = 'Reason Code';
            ToolTip = 'Specifies the reason code, a supplementary source code that enables you to trace the entry.';
            TableRelation = "Reason Code";
        }
        field(16; "Debit Amount"; Decimal)
        {
            AutoFormatExpression = Rec."Currency Code";
            AutoFormatType = 1;
            BlankZero = true;
            Caption = 'Debit Amount';
            ToolTip = 'Specifies the total of the ledger entries that represent debits.';
        }
        field(17; "Credit Amount"; Decimal)
        {
            AutoFormatExpression = Rec."Currency Code";
            AutoFormatType = 1;
            BlankZero = true;
            Caption = 'Credit Amount';
            ToolTip = 'Specifies the total of the ledger entries that represent credits.';
        }
        field(18; "Debit Amount (LCY)"; Decimal)
        {
            AutoFormatType = 1;
            AutoFormatExpression = '';
            BlankZero = true;
            Caption = 'Debit Amount (LCY)';
        }
        field(19; "Credit Amount (LCY)"; Decimal)
        {
            AutoFormatType = 1;
            AutoFormatExpression = '';
            BlankZero = true;
            Caption = 'Credit Amount (LCY)';
        }
        field(21; "Initial Entry Global Dim. 1"; Code[20])
        {
            Caption = 'Initial Entry Global Dim. 1';
            ToolTip = 'Specifies the Global Dimension 1 code of the initial employee ledger entry.';
            TableRelation = "Dimension Value".Code where("Global Dimension No." = const(1));
        }
        field(22; "Initial Entry Global Dim. 2"; Code[20])
        {
            Caption = 'Initial Entry Global Dim. 2';
            ToolTip = 'Specifies the Global Dimension 2 code of the initial employee ledger entry.';
            TableRelation = "Dimension Value".Code where("Global Dimension No." = const(2));
        }
        field(35; "Initial Document Type"; Enum "Gen. Journal Document Type")
        {
            Caption = 'Initial Document Type';
            ToolTip = 'Specifies the document type that the initial vendor ledger entry was created with.';
        }
        field(36; "Applied Empl. Ledger Entry No."; Integer)
        {
            Caption = 'Applied Empl. Ledger Entry No.';
        }
        field(37; Unapplied; Boolean)
        {
            Caption = 'Unapplied';
            ToolTip = 'Specifies whether the entry has been unapplied (undone) from the Unapply Employee Entries window by the entry number shown in the Unapplied by Entry No. field.';
        }
        field(38; "Unapplied by Entry No."; Integer)
        {
            Caption = 'Unapplied by Entry No.';
            ToolTip = 'Specifies the number of the correcting entry, if the original entry has been unapplied (undone) from the Unapply Employee Entries window.';
            TableRelation = "Detailed Employee Ledger Entry";
        }
        field(42; "Application No."; Integer)
        {
            Caption = 'Application No.';
            Editable = false;
        }
        field(43; "Ledger Entry Amount"; Boolean)
        {
            Caption = 'Ledger Entry Amount';
            Editable = false;
        }
        field(44; "Posting Group"; Code[20])
        {
            Caption = 'Employee Posting Group';
            ToolTip = 'Specifies the employee''s market type to link business transactions to.';
            Editable = false;
            TableRelation = "Employee Posting Group";
        }
        field(45; "Exch. Rate Adjmt. Reg. No."; Integer)
        {
            Caption = 'Exch. Rate Adjmt. Reg. No.';
            Editable = false;
            TableRelation = "Exch. Rate Adjmt. Reg.";
        }
        field(95; "G/L Register No."; Integer)
        {
            Caption = 'G/L Register No.';
            Editable = false;
            TableRelation = "G/L Register";
        }
    }

    keys
    {
        key(Key1; "Entry No.")
        {
            Clustered = true;
        }
        key(Key2; "Employee Ledger Entry No.", "Posting Date")
        {
        }
        key(Key3; "Transaction No.", "Employee No.", "Entry Type")
        {
        }
    }

    fieldgroups
    {
    }

    trigger OnInsert()
    begin
        SetLedgerEntryAmount();
    end;

    [InherentPermissions(PermissionObjectType::TableData, Database::"Detailed Employee Ledger Entry", 'r')]
    procedure GetLastEntryNo(): Integer;
    var
        FindRecordManagement: Codeunit "Find Record Management";
    begin
        exit(FindRecordManagement.GetLastEntryIntFieldValue(Rec, FieldNo("Entry No.")))
    end;

    procedure UpdateDebitCredit(Correction: Boolean)
    begin
        if ((Amount > 0) or ("Amount (LCY)" > 0)) and not Correction or
           ((Amount < 0) or ("Amount (LCY)" < 0)) and Correction
        then begin
            "Debit Amount" := Amount;
            "Credit Amount" := 0;
            "Debit Amount (LCY)" := "Amount (LCY)";
            "Credit Amount (LCY)" := 0;
        end else begin
            "Debit Amount" := 0;
            "Credit Amount" := -Amount;
            "Debit Amount (LCY)" := 0;
            "Credit Amount (LCY)" := -"Amount (LCY)";
        end;

        OnAfterUpdateDebitCredit(Rec, Correction);
    end;

    procedure SetZeroTransNo(TransactionNo: Integer)
    var
        DetailedEmployeeLedgerEntry: Record "Detailed Employee Ledger Entry";
        ApplicationNo: Integer;
    begin
        DetailedEmployeeLedgerEntry.SetCurrentKey("Transaction No.");
        DetailedEmployeeLedgerEntry.SetRange("Transaction No.", TransactionNo);
        if DetailedEmployeeLedgerEntry.FindSet(true) then begin
            ApplicationNo := DetailedEmployeeLedgerEntry."Entry No.";
            repeat
                DetailedEmployeeLedgerEntry."Transaction No." := 0;
                DetailedEmployeeLedgerEntry."Application No." := ApplicationNo;
                OnSetZeroTransNoOnBeforeDetailedVendorLedgEntryModify(DetailedEmployeeLedgerEntry);
                DetailedEmployeeLedgerEntry.Modify();
            until DetailedEmployeeLedgerEntry.Next() = 0;
        end;
    end;

    local procedure SetLedgerEntryAmount()
    begin
        "Ledger Entry Amount" := not ("Entry Type" = "Entry Type"::Application);
    end;

    procedure GetUnrealizedGainLossAmount(EntryNo: Integer): Decimal
    begin
        SetCurrentKey("Employee Ledger Entry No.", "Entry Type");
        SetRange("Employee Ledger Entry No.", EntryNo);
        SetRange("Entry Type", "Entry Type"::"Unrealized Loss", "Entry Type"::"Unrealized Gain");
        CalcSums("Amount (LCY)");
        exit("Amount (LCY)");
    end;

    [IntegrationEvent(false, false)]
    local procedure OnAfterUpdateDebitCredit(var DetailedEmployeeLedgerEntry: Record "Detailed Employee Ledger Entry"; Correction: Boolean)
    begin
    end;

    [IntegrationEvent(false, false)]
    local procedure OnSetZeroTransNoOnBeforeDetailedVendorLedgEntryModify(var DetailedEmployeeLedgerEntry: Record "Detailed Employee Ledger Entry")
    begin
    end;
}