ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Event Request] Page 1191 "Create Employee Payment" - OnUpdateTempBufferFromEmployeeLedgerEntry, OnBeforeUpdateGnlJnlLineDimensionsFromTempBuffer

Open MatjazSega opened this issue 4 years ago • 1 comments

Hello,

There are events in Create Payments page that can be used to transfer custom fields from Vendor Ledger Entry to General Journal Line. Similar events are missing in Create Employee Payments page.

We would need the following events:

page 1191 "Create Employee Payment"
{

....

    local procedure CopyEmployeeLedgerEntriesToTempEmplPaymentBuffer(var EmployeeLedgerEntry: Record "Employee Ledger Entry")
    var
        PaymentAmt: Decimal;
    begin
        if EmployeeLedgerEntry.Find('-') then
            repeat
                EmployeeLedgerEntry.CalcFields("Remaining Amount");
                if (EmployeeLedgerEntry."Applies-to ID" = '') and (EmployeeLedgerEntry."Remaining Amount" < 0) then begin
                    TempEmplPaymentBuffer."Employee No." := EmployeeLedgerEntry."Employee No.";
                    TempEmplPaymentBuffer."Currency Code" := EmployeeLedgerEntry."Currency Code";
                    TempEmplPaymentBuffer."Payment Method Code" := EmployeeLedgerEntry."Payment Method Code";
                    TempEmplPaymentBuffer."Creditor No." := EmployeeLedgerEntry."Creditor No.";
                    TempEmplPaymentBuffer."Payment Reference" := EmployeeLedgerEntry."Payment Reference";
                    TempEmplPaymentBuffer."Exported to Payment File" := EmployeeLedgerEntry."Exported to Payment File";
                    // NEW CODE >>>
                    OnUpdateTempBufferFromEmployeeLedgerEntry(TempEmplPaymentBuffer, EmployeeLedgerEntry);
                    // NEW CODE <<<
                    TempEmplPaymentBuffer."Dimension Entry No." := 0;
                    TempEmplPaymentBuffer."Global Dimension 1 Code" := '';
                    TempEmplPaymentBuffer."Global Dimension 2 Code" := '';
                    TempEmplPaymentBuffer."Dimension Set ID" := 0;
                    TempEmplPaymentBuffer."Employee Ledg. Entry No." := EmployeeLedgerEntry."Entry No.";

        ....
    end;

....

    local procedure CopyTempEmpPaymentBuffersToGenJnlLines()
    var
        CompanyInformation: Record "Company Information";
        GenJnlLine: Record "Gen. Journal Line";
        GenJournalBatch: Record "Gen. Journal Batch";
        GenJournalTemplate: Record "Gen. Journal Template";
        Employee: Record Employee;
        BalAccType: Enum "Gen. Journal Account Type";
        LastLineNo: Integer;
    begin
        ....
                    "Applies-to Doc. No." := TempEmplPaymentBuffer."Employee Ledg. Entry Doc. No.";
                    Validate("Payment Method Code", TempEmplPaymentBuffer."Payment Method Code");
                    "Creditor No." := CopyStr(TempEmplPaymentBuffer."Creditor No.", 1, MaxStrLen("Creditor No."));
                    "Payment Reference" := CopyStr(TempEmplPaymentBuffer."Payment Reference", 1, MaxStrLen("Payment Reference"));
                    "Exported to Payment File" := TempEmplPaymentBuffer."Exported to Payment File";
                    "Applies-to Ext. Doc. No." := TempEmplPaymentBuffer."Applies-to Ext. Doc. No.";

                    // NEW CODE >>>
                    OnBeforeUpdateGnlJnlLineDimensionsFromTempBuffer(GenJnlLine, TempEmplPaymentBuffer);
                    // NEW CODE <<<
                    UpdateDimensions(GenJnlLine, TempEmplPaymentBuffer);
                    Insert;
                end;
            until TempEmplPaymentBuffer.Next() = 0;
    end;

....

    // NEW EVENT >>>
    [IntegrationEvent(false, false)]
    local procedure OnUpdateTempBufferFromEmployeeLedgerEntry(var TempEmplPaymentBuffer: Record "Employee Payment Buffer" temporary; EmployeeLedgerEntry: Record "Employee Ledger Entry")
    begin
    end;
    // NEW EVENT <<<

    // NEW EVENT >>>
    [IntegrationEvent(false, false)]
    local procedure OnBeforeUpdateGnlJnlLineDimensionsFromTempBuffer(var GenJournalLine: Record "Gen. Journal Line"; TempEmplPaymentBuffer: Record "Employee Payment Buffer" temporary)
    begin
    end;
    // NEW EVENT <<<
}

MatjazSega avatar Apr 22 '22 10:04 MatjazSega

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.

JesperSchulz avatar Apr 28 '22 05:04 JesperSchulz