Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Event to codeunit 31269 "Compensation - Post CZC" #28027

Open
DanielSmutek opened this issue Jan 30, 2025 · 0 comments
Open

New Event to codeunit 31269 "Compensation - Post CZC" #28027

DanielSmutek opened this issue Jan 30, 2025 · 0 comments

Comments

@DanielSmutek
Copy link

Describe the request

Please add following Event to codeunit 31269 "Compensation - Post CZC"

trigger OnRun()

...
...

        if Balance <> 0 then begin
            Clear(GenJournalLine);
            GenJournalLine.Validate("Posting Date", Rec."Posting Date");
            GenJournalLine.Validate("Document No.", Rec."No.");
            GenJournalLine.Validate("Account Type", GenJournalLine."Account Type"::"G/L Account");
            case true of
                Balance < 0:
                    GenJournalLine.Validate("Account No.", CompensationsSetupCZC."Credit Rounding Account");
                Balance > 0:
                    GenJournalLine.Validate("Account No.", CompensationsSetupCZC."Debit Rounding Account");
            end;
            GenJournalLine.Validate("Document Date", Rec."Document Date");
            GenJournalLine.Validate(Description, Rec.Description);
            GenJournalLine.Validate(Amount, Balance);
            GenJournalLine.Validate("Bal. Account Type", GenJournalLine."Bal. Account Type"::"G/L Account");
            GenJournalLine.Validate("Bal. Account No.", CompensationsSetupCZC."Compensation Bal. Account No.");
            GenJournalLine."Dimension Set ID" := CompensationLineCZC."Dimension Set ID";
            GenJournalLine."Shortcut Dimension 1 Code" := CompensationLineCZC."Shortcut Dimension 1 Code";
            GenJournalLine."Shortcut Dimension 2 Code" := CompensationLineCZC."Shortcut Dimension 2 Code";
            GenJournalLine."Source Code" := SourceCodeSetup."Compensation CZC";
            GenJournalLine."System-Created Entry" := true;
            // NEW EVENT >>
            OnRunOnBeforeRunBalanceGenJnlPostLine(GenJournalLine, CompensationLineCZC);
            // NEW EVENT <<

            GenJnlPostLine.RunWithCheck(GenJournalLine);
        end;

[IntegrationEvent(true, false)]
local procedure OnRunOnBeforeRunBalanceGenJnlPostLine(var GenJournalLine: Record "Gen. Journal Line"; var CompensationLineCZC: Record "Compensation Line CZC")
begin
end;

Additional context

We need this event for adding additional information to GenJnlPostLine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant