ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Event Request] Codeunit "Exch. Rate Adjmt. Process" - PrepareTempEmplLedgEntry()

Open KennyTangBS opened this issue 2 years ago • 1 comments

Describe the request

Please add new integration events OnPrepareTempEmplLedgEntryOnAfterSetEmplLedgerEntryFilters() with parameter EmployeeLedgerEntry2 and OnPrepareTempEmplLedgEntryOnAfterSetDtldEmplLedgerEntryFilters() with parameter DtldEmplLedgEntry2 in the Codeunit "Exch. Rate Adjmt. Process" Example:

local procedure PrepareTempEmplLedgEntry(var Employee: Record Employee; var TempEmployeeLedgerEntry: Record "Employee Ledger Entry" temporary);
    var
        EmployeeLedgerEntry2: Record "Employee Ledger Entry";
        DtldEmplLedgEntry2: Record "Detailed Employee Ledger Entry";
    begin
        TempEmployeeLedgerEntry.DeleteAll();

        Currency.CopyFilter(Code, EmployeeLedgerEntry2."Currency Code");
        EmployeeLedgerEntry2.FilterGroup(2);
        EmployeeLedgerEntry2.SetFilter("Currency Code", '<>%1', '');
        OnPrepareTempEmplLedgEntryOnAfterSetEmplLedgerEntryFilters(EmployeeLedgerEntry2);
        EmployeeLedgerEntry2.FilterGroup(0);

        DtldEmplLedgEntry2.Reset();
        DtldEmplLedgEntry2.SetCurrentKey("Employee No.", "Posting Date", "Entry Type");
        DtldEmplLedgEntry2.SetRange("Employee No.", Employee."No.");
        DtldEmplLedgEntry2.SetRange("Posting Date", CalcDate('<+1D>', ExchRateAdjmtParameters."End Date"), DMY2Date(31, 12, 9999));
        OnPrepareTempEmplLedgEntryOnAfterSetDtldEmplLedgerEntryFilters(DtldEmplLedgEntry2);
        if DtldEmplLedgEntry2.Find('-') then
            repeat
                EmployeeLedgerEntry2."Entry No." := DtldEmplLedgEntry2."Employee Ledger Entry No.";
                if EmployeeLedgerEntry2.Find('=') then
                    if (EmployeeLedgerEntry2."Posting Date" >= ExchRateAdjmtParameters."Start Date") and
                        (EmployeeLedgerEntry2."Posting Date" <= ExchRateAdjmtParameters."End Date")
                    then begin
                        TempEmployeeLedgerEntry."Entry No." := EmployeeLedgerEntry2."Entry No.";
                        if TempEmployeeLedgerEntry.Insert() then;
                    end;
            until DtldEmplLedgEntry2.Next() = 0;

        EmployeeLedgerEntry2.SetCurrentKey("Employee No.", Open);
        EmployeeLedgerEntry2.SetRange("Employee No.", Employee."No.");
        EmployeeLedgerEntry2.SetRange(Open, true);
        EmployeeLedgerEntry2.SetRange("Posting Date", 0D, ExchRateAdjmtParameters."End Date");
        OnPrepareTempEmplLedgEntryOnAfterSetEmplLedgerEntryFilters(EmployeeLedgerEntry2);
        if EmployeeLedgerEntry2.Find('-') then
            repeat
                TempEmployeeLedgerEntry."Entry No." := EmployeeLedgerEntry2."Entry No.";
                if TempEmployeeLedgerEntry.Insert() then;
            until EmployeeLedgerEntry2.Next() = 0;
        EmployeeLedgerEntry2.Reset();
    end;
[IntegrationEvent(false, false)]
    local procedure OnPrepareTempEmplLedgEntryOnAfterSetEmplLedgerEntryFilters(var EmployeeLedgerEntry: Record "Employee Ledger Entry")
    begin
    end;
[IntegrationEvent(false, false)]
    local procedure OnPrepareTempEmplLedgEntryOnAfterSetDtldEmplLedgerEntryFilters(var DtldEmplLedgEntry: Record "Detailed Employee Ledger Entry")
    begin
    end;

Additional context

This request is to add more filter of the Employee Ledger Entry and Detailed Employee Ledger Entry records. Internal work item: AB#507934

KennyTangBS avatar Mar 18 '24 22:03 KennyTangBS

Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. Please do not reply to this, as we do not monitor closed issues. If you have follow-up questions or requests, please create a new issue where you reference this one.

Build ID: 18615.

JesperSchulz avatar Apr 17 '24 12:04 JesperSchulz