microsoft / ALAppExtensions

Repository for collaboration on Microsoft AL application add-on and localization extensions for Microsoft Dynamics 365 Business Central.
MIT License
770 stars 610 forks source link

[Event Request] Codeunit 13 "Gen. Jnl.-Post Batch" - OnProcessBalanceOfLinesOnAfterSetVATEntryCreated #27000

Open RZ440 opened 1 month ago

RZ440 commented 1 month ago

Describe the request

Hello, can you please add a new event OnProcessBalanceOfLinesOnAfterSetVATEntryCreated in codeunit 13 "Gen. Jnl.-Post Batch"?

    local procedure ProcessBalanceOfLines(var GenJnlLine: Record "Gen. Journal Line"; var GenJnlLineVATInfoSource: Record "Gen. Journal Line"; var VATInfoSourceLineIsInserted: Boolean; var LastLineNo: Integer; CurrentICPartner: Code[20])
.
.
.
            LastDate := GenJnlLine."Posting Date";
            LastDocType := GenJnlLine."Document Type";
            if not GenJnlLine.EmptyLine() then
                LastDocNo := GenJnlLine."Document No.";
            LastFAAddCurrExchRate := GenJnlLine."FA Add.-Currency Factor";
            if GenJnlTemplate."Force Doc. Balance" then begin
                if not VATPostingSetup.Get(GenJnlLine."VAT Bus. Posting Group", GenJnlLine."VAT Prod. Posting Group") then
                    Clear(VATPostingSetup);
                if not BalVATPostingSetup.Get(GenJnlLine."Bal. VAT Bus. Posting Group", GenJnlLine."Bal. VAT Prod. Posting Group") then
                    Clear(BalVATPostingSetup);
                VATEntryCreated :=
                  VATEntryCreated or
                  ((GenJnlLine."Account Type" = GenJnlLine."Account Type"::"G/L Account") and (GenJnlLine."Account No." <> '') and
                   (GenJnlLine."Gen. Posting Type" in [GenJnlLine."Gen. Posting Type"::Purchase, GenJnlLine."Gen. Posting Type"::Sale]) and
                   (VATPostingSetup."VAT %" <> 0)) or
                  ((GenJnlLine."Bal. Account Type" = GenJnlLine."Bal. Account Type"::"G/L Account") and (GenJnlLine."Bal. Account No." <> '') and
                   (GenJnlLine."Bal. Gen. Posting Type" in [GenJnlLine."Bal. Gen. Posting Type"::Purchase, GenJnlLine."Bal. Gen. Posting Type"::Sale]) and
                   (BalVATPostingSetup."VAT %" <> 0));
                OnProcessBalanceOfLinesOnAfterSetVATEntryCreated(GenJnlLine, VATEntryCreated);
                if TempGenJnlLine3.IsCustVendICAdded(GenJnlLine) then begin
                    GenJnlLineVATInfoSource := GenJnlLine;
                    VATInfoSourceLineIsInserted := true;
                end;
    [IntegrationEvent(false, false)]
    local procedure OnProcessBalanceOfLinesOnAfterSetVATEntryCreated(GenJnlLine: Record "Gen. Journal Line"; var VATEntryCreated: Boolean)
    begin
    end;

Additional context

We would like to set VATEntryCreated to true even if the VAT Entry is zero. Internal work item: AB#545268