Skip to content

[W1][Codeunit][12][Gen. Jnl.-Post Line]` Add var NextVATEntryNo to OnAfterGLFinishPosting in Code #30275

@mavohra

Description

@mavohra

Why do you need this change?

We need to read the next VAT entry number after a G/L posting cycle completes, together with the G/L register record and the other entry counters. When a G/L posting cycle follows another posting context that already created VAT entries, the VAT entry numbering must continue from the prior context rather than starting from freshly queried database values.

The standard Code procedure calls FinishPosting which finalizes GLReg."To VAT Entry No." from NextVATEntryNo. After FinishPosting returns, OnAfterGLFinishPosting fires with GLReg, NextEntryNo, and NextTransactionNo as var parameters. However, NextVATEntryNo is not included, even though it is part of the same register state and was just used to set GLReg."To VAT Entry No.".

The existing OnAfterFinishPosting event fires inside FinishPosting and also does not include NextVATEntryNo. No event currently exposes NextVATEntryNo together with the other register fields after a posting cycle.

Describe the request

Add var NextVATEntryNo: Integer to the existing integration event OnAfterGLFinishPosting in the Code procedure in Codeunit 12 "Gen. Jnl.-Post Line". The new parameter follows the existing parameters at the end.

            OnCodeOnBeforeFinishPosting(GenJnlLine, Balancing, FirstEntryNo);
            IsTransactionConsistent := FinishPosting(GenJnlLine);
        end;

        OnAfterGLFinishPosting(
            GlobalGLEntry, GenJnlLine, IsTransactionConsistent, FirstTransactionNo, GLReg, TempGLEntryBuf,
            NextEntryNo, NextTransactionNo, NextVATEntryNo); // <---- New parameter at end

        GLEntryInconsistent := not IsTransactionConsistent;
    end;

Event Signature:

[IntegrationEvent(false, false)]
local procedure OnAfterGLFinishPosting(GLEntry: Record "G/L Entry"; var GenJnlLine: Record "Gen. Journal Line"; var IsTransactionConsistent: Boolean; FirstTransactionNo: Integer; var GLRegister: Record "G/L Register"; var TempGLEntryBuf: Record "G/L Entry" temporary; var NextEntryNo: Integer; var NextTransactionNo: Integer; var NextVATEntryNo: Integer)
begin
end;

Alternatives evaluated: OnAfterFinishPosting fires inside FinishPosting and passes GLReg as var but does not include NextVATEntryNo or NextTransactionNo. OnBeforeFinishPosting fires at the start of FinishPosting before G/L entries are inserted and before GLReg."To VAT Entry No." is set, so the register state is not yet final. OnAfterSettingIsTransactionConsistent fires before G/L entries are inserted. No event currently exposes NextVATEntryNo as var after a G/L posting cycle completes.

Internal work item: AB#639377

Metadata

Metadata

Assignees

No one assigned

    Labels

    FinanceGitHub request for Finance areaevent-requestRequest for adding an event

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions