ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Event Request] codeunit 5601 "FA Insert G/L Account"

Open MiRo65 opened this issue 6 years ago • 2 comments

Could we please have 2 events raised in function InsertBufferBalAcc. CodeExample:

    with FAAlloc do begin
        Reset;
        SetRange(Code, PostingGrCode);
        SetRange("Allocation Type", FAPostingType);
        if Find('-') then
            repeat
                if ("Account No." = '') and ("Allocation %" > 0) then
                    TestField("Account No.");
                TotalPercent := TotalPercent + "Allocation %";
                NewAmount :=
                  DepreciationCalc.CalcRounding(DeprBookCode, AllocAmount * TotalPercent / 100) - TotalAllocAmount;
                TotalAllocAmount := TotalAllocAmount + NewAmount;
                if Abs(TotalAllocAmount) > Abs(AllocAmount) then
                    NewAmount := AllocAmount - (TotalAllocAmount - NewAmount);
                Clear(FAGLPostBuf);
                FAGLPostBuf."Account No." := "Account No.";

                DimensionSetIDArr[2] := "Dimension Set ID";
                FAGLPostBuf."Dimension Set ID" :=
                  DimMgt.GetCombinedDimensionSetID(
                    DimensionSetIDArr, FAGLPostBuf."Global Dimension 1 Code", FAGLPostBuf."Global Dimension 2 Code");

                FAGLPostBuf.Amount := NewAmount;
                FAGLPostBuf."Automatic Entry" := AutomaticEntry;
                FAGLPostBuf.Correction := Correction;
                FAGLPostBuf."FA Posting Group" := Code;
                FAGLPostBuf."FA Allocation Type" := "Allocation Type";
                FAGLPostBuf."FA Allocation Line No." := "Line No.";
                // start kvspsa - Event Raiser
                **OnAfterAssignFAAllocToFAGLPostBufOnRepeatOnInsertBufferBalAcc(FAAlloc, FAGLPostBuf);**
                // stop kvspsa
                if NewAmount <> 0 then begin
                    FADimMgt.CheckFAAllocDim(FAAlloc, FAGLPostBuf."Dimension Set ID");
                    InsertBufferEntry;
                end;
            until Next = 0;
        if Abs(TotalAllocAmount) < Abs(AllocAmount) then begin
            NewAmount := AllocAmount - TotalAllocAmount;
            Clear(FAGLPostBuf);
            FAGLPostBuf."Account No." := GLAccNo;
            FAGLPostBuf.Amount := NewAmount;
            FAGLPostBuf."Global Dimension 1 Code" := GlobalDim1Code;
            FAGLPostBuf."Global Dimension 2 Code" := GlobalDim2Code;
            TableID[1] := DATABASE::"G/L Account";
            No[1] := GLAccNo;
            FAGLPostBuf."Dimension Set ID" :=
              DimMgt.GetDefaultDimID(TableID, No, '', FAGLPostBuf."Global Dimension 1 Code",
                FAGLPostBuf."Global Dimension 2 Code", DimSetID, 0);
            FAGLPostBuf."Automatic Entry" := AutomaticEntry;
            FAGLPostBuf.Correction := Correction;
            // start kvspsa - Event Raiser
            **OnAfterAssignFAAllocToFAGLPostBufOnInsertBufferBalAcc(FAAlloc, FAGLPostBuf);**
            // stop kvspsa
            if NewAmount <> 0 then
                InsertBufferEntry;
        end;
    end;
end;

Thank you

MiRo65 avatar Jan 09 '20 14:01 MiRo65

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. We will update this issue with information about availability.

bc-ghost avatar Jan 14 '20 13:01 bc-ghost

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. We will update this issue with information about availability.

bc-ghost avatar Jan 21 '20 13:01 bc-ghost