ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Event Request] table 5902 "Service Line" - OnBeforeUpdateAmounts

Open iltererdogan opened this issue 5 years ago • 1 comments

Hi,

Is it possible to add OnBeforeUpdateAmounts publisher to service line table?

    procedure UpdateAmounts()
    var
        CustCheckCrLimit: Codeunit "Cust-Check Cr. Limit";
        ExpectedLineAmount: Decimal;
        ShouldCheckCrLimit: Boolean;
        // <<new
        IsHandled: Boolean;
        // >>new
    begin
        // <<new
        IsHandled := false;
        OnBeforeUpdateAmounts(Rec, xRec, CurrFieldNo, IsHandled);
        if IsHandled then
            exit;
        // >>new

        if GuiAllowed and (CurrFieldNo <> 0) then
            ConfirmAdjPriceLineChange;

        GetServHeader;

        if "Line Amount" <> xRec."Line Amount" then
            "VAT Difference" := 0;
        ExpectedLineAmount := Round(
                     CalcChargeableQty * "Unit Price",
                     Currency."Amount Rounding Precision") - "Line Discount Amount";
        if "Line Amount" <> ExpectedLineAmount then begin
            "Line Amount" := ExpectedLineAmount;
            "VAT Difference" := 0;
        end;
        if ServHeader."Tax Area Code" = '' then
            UpdateVATAmounts;

        InitOutstandingAmount;
        ShouldCheckCrLimit := not IsCustCrLimitChecked and (CurrFieldNo <> 0);
        OnUpdateAmountsOnAfterCalcShouldCheckCrLimit(Rec, IsCustCrLimitChecked, CurrFieldNo, ShouldCheckCrLimit);
        if ShouldCheckCrLimit then begin
            IsCustCrLimitChecked := true;
            CustCheckCrLimit.ServiceLineCheck(Rec);
        end;
        UpdateRemainingCostsAndAmounts;

        OnAfterUpdateAmounts(Rec);
    end;

    // <<new
    [IntegrationEvent(false, false)]
    local procedure OnBeforeUpdateAmounts(var ServiceLine: Record "Service Line"; xServiceLine: Record "Service Line"; CurrentFieldNo: Integer; var IsHandled: Boolean)
    begin
    end;
    // >>new

iltererdogan avatar Nov 22 '21 15:11 iltererdogan

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 Nov 29 '21 06:11 JesperSchulz