ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Event Request] Codeunit 5606 - FA Check Consistency - OnCheckSalesPostingOnAfterSetFALedgerEntryFilters

Open Codey42 opened this issue 4 years ago • 1 comments

Dear ALAppExtensions team,

Through this issue we would like to request adding event publisher OnCheckSalesPostingOnAfterSetFALedgerEntryFilters in Codeunit 5606 FA Check Consistency with the following signature (similar to OnCheckNormalPostingOnAfterSetFALedgerEntryFilters):

[IntegrationEvent(false, false)]
local procedure OnCheckSalesPostingOnAfterSetFALedgerEntryFilters(var FALedgerEntry: Record "FA Ledger Entry";
                                                                  FANo: Code[20];
                                                                  DepreciationBookCode: Code[10])
begin
end;

with VAR parameter FALedgerEntry. which would be called as follows in CheckSalesPosting:

local procedure CheckSalesPosting()
begin
    with FALedgEntry do begin
        if FADeprBook."Acquisition Date" = 0D then
            CreateAcquisitionCostError;
        SetCurrentKey("FA No.", "Depreciation Book Code", "Part of Book Value", "FA Posting Date");
        SetRange("FA No.", FANo);
        SetRange("Depreciation Book Code", DeprBookCode);
        SetRange("Part of Book Value", true);
        SetFilter("FA Posting Date", '%1..', FAPostingDate + 1);
        if Find('-') then
            CreateDisposalError;
        SetRange("Part of Book Value");
        SetCurrentKey("FA No.", "Depreciation Book Code", "Part of Depreciable Basis", "FA Posting Date");
        SetRange("Part of Depreciable Basis", true);
        // >>>> New >>>>>>>>>>>>>>>>
        OnCheckSalesPostingOnAfterSetFALedgerEntryFilters(FALedgEntry,FANo,DeprBookCode);
        // <<<< New <<<<<<<<<<<<<<<<
        if Find('-') then
            CreateDisposalError;
        SetRange("Part of Depreciable Basis");
        if not FADeprBook."Use FA Ledger Check" then
            DeprBook.TestField("Use FA Ledger Check", false)
        else begin
            SetCurrentKey(
                "FA No.", "Depreciation Book Code",
                "FA Posting Category", "FA Posting Type", "FA Posting Date");
            SetRange("FA Posting Category", "FA Posting Category"::" ");
            SetRange("FA Posting Type", "FA Posting Type"::"Proceeds on Disposal");
            SetRange("FA Posting Date");
            if Find('-') then
                repeat
                    NewAmount := NewAmount + Amount;
                    if NewAmount > 0 then
                        CreatePostingTypeError;
                until Next() = 0;
        end;
    end;
end;

Codey42 avatar Mar 30 '22 09:03 Codey42

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 09 '22 04:04 JesperSchulz