microsoft / ALAppExtensions

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

[Event Request] Page 10736 "Customer/Vendor Warnings 349" - Modify event OnBeforeCalcAmountsFromVATEntries() #18702

Closed XeMaTT closed 2 years ago

XeMaTT commented 2 years ago

Hello, We would need to modify event OnBeforeCalcAmountsFromVATEntries() in procedure "CalcAmountsFromVATEntries()" in page "Customer/Vendor Warnings 349". This issue is related to issue 18615

Modify event:

    [IntegrationEvent(false, false)]
    local procedure OnBeforeCalcAmountsFromVATEntries(var VATEntry: Record "VAT Entry"; var CustVendWarning349 Record "Customer/Vendor Warning 349")
    begin
    end;

Modify event here:

local procedure CalcAmountsFromVATEntries(var NormalAmount: Decimal; var AmountOpTri: Decimal; var AmountEUService: Decimal; EntryType: Enum "General Posting Type"; CustVendNo: Code[20]; FromDate: Date; ToDate: Date; StartDateFormula: DateFormula; EndDateFormula: DateFormula)
var
    VATEntry: Record "VAT Entry";
begin
    //++ Modify event
    OnBeforeCalcAmountsFromVATEntries(VATEntry, Rec);
    with VATEntry do begin
        SetRange(Type, EntryType);
        SetFilter("Document Type", '%1|%2', "Document Type"::Invoice, "Document Type"::"Credit Memo");
        SetRange("Bill-to/Pay-to No.", CustVendNo);
        SetRange("Posting Date", FromDate, ToDate);
        if FindSet then
            repeat
                if not IsCorrectiveCrMemoDiffPeriod(StartDateFormula, EndDateFormula) then
                    case true of
                        ((not "EU Service") and (not "EU 3-Party Trade")):
                            NormalAmount += Base + GetAppliedCorrCrMemosAmtFromDiffPeriod(VATEntry, FromDate, ToDate);
                        ("EU 3-Party Trade" and (not "EU Service")):
                            AmountOpTri += Base + GetAppliedCorrCrMemosAmtFromDiffPeriod(VATEntry, FromDate, ToDate);
                        "EU Service":
                            AmountEUService += Base + GetAppliedCorrCrMemosAmtFromDiffPeriod(VATEntry, FromDate, ToDate);
                    end;
            until Next() = 0;
    end;
end;
JesperSchulz commented 2 years ago

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.

Build ID: 42636.